- Timestamp:
- 2014-04-29T03:24:57+02:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AlignInLineAction.java
r7005 r7025 52 52 * InvalidSelection exception has to be raised when action can't be perform 53 53 */ 54 private class InvalidSelection extends Exception {54 private static class InvalidSelection extends Exception { 55 55 56 56 /** -
trunk/src/org/openstreetmap/josm/actions/ExpertToggleAction.java
r7005 r7025 29 29 30 30 private static synchronized void fireExpertModeChanged(boolean isExpert) { 31 { 32 Iterator<WeakReference<ExpertModeChangeListener>> it = listeners.iterator(); 33 while (it.hasNext()) { 34 WeakReference<ExpertModeChangeListener> wr = it.next(); 35 ExpertModeChangeListener listener = wr.get(); 36 if (listener == null) { 37 it.remove(); 38 continue; 39 } 40 listener.expertChanged(isExpert); 31 Iterator<WeakReference<ExpertModeChangeListener>> it1 = listeners.iterator(); 32 while (it1.hasNext()) { 33 WeakReference<ExpertModeChangeListener> wr = it1.next(); 34 ExpertModeChangeListener listener = wr.get(); 35 if (listener == null) { 36 it1.remove(); 37 continue; 41 38 } 39 listener.expertChanged(isExpert); 42 40 } 43 { 44 Iterator<WeakReference<Component>> it = visibilityToggleListeners.iterator(); 45 while (it.hasNext()) { 46 WeakReference<Component> wr = it.next(); 47 Component c = wr.get(); 48 if (c == null) { 49 it.remove(); 50 continue; 51 } 52 c.setVisible(isExpert); 41 Iterator<WeakReference<Component>> it2 = visibilityToggleListeners.iterator(); 42 while (it2.hasNext()) { 43 WeakReference<Component> wr = it2.next(); 44 Component c = wr.get(); 45 if (c == null) { 46 it2.remove(); 47 continue; 53 48 } 49 c.setVisible(isExpert); 54 50 } 55 51 } -
trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java
r7005 r7025 1172 1172 1173 1173 for (RelationMember rm : r.getMembers()) { 1174 if ( rm.getRole().equalsIgnoreCase("outer")) {1174 if ("outer".equalsIgnoreCase(rm.getRole())) { 1175 1175 outerWays.add(rm.getWay()); 1176 1176 hasKnownOuter |= selectedWays.contains(rm.getWay()); 1177 1177 } 1178 else if ( rm.getRole().equalsIgnoreCase("inner")) {1178 else if ("inner".equalsIgnoreCase(rm.getRole())) { 1179 1179 innerWays.add(rm.getWay()); 1180 1180 } … … 1328 1328 1329 1329 for (RelationRole r : rels) { 1330 if (r.rel.isMultipolygon() && r.role.equalsIgnoreCase("outer")) {1330 if (r.rel.isMultipolygon() && "outer".equalsIgnoreCase(r.role)) { 1331 1331 multiouters.add(r); 1332 1332 continue; -
trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
r6453 r7025 149 149 for (String arg : args) { 150 150 int eq = arg.indexOf('='); 151 if (eq == -1 || ! arg.substring(0, eq).equalsIgnoreCase("zoom")) continue;151 if (eq == -1 || !"zoom".equalsIgnoreCase(arg.substring(0, eq))) continue; 152 152 153 153 zoomLvl = Integer.parseInt(arg.substring(eq + 1)); -
trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java
r7005 r7025 104 104 105 105 switch (Main.pref.getInteger("merge-nodes.mode", 0)) { 106 case 0: {106 case 0: 107 107 Node targetNode = candidates.get(size - 1); 108 108 for (final Node n : candidates) { // pick last one … … 110 110 } 111 111 return targetNode; 112 } 113 case 1: { 114 double east = 0, north = 0; 112 case 1: 113 double east1 = 0, north1 = 0; 115 114 for (final Node n : candidates) { 116 east += n.getEastNorth().east(); 117 north += n.getEastNorth().north(); 118 } 119 120 return new Node(new EastNorth(east / size, north / size)); 121 } 122 case 2: { 115 east1 += n.getEastNorth().east(); 116 north1 += n.getEastNorth().north(); 117 } 118 119 return new Node(new EastNorth(east1 / size, north1 / size)); 120 case 2: 123 121 final double[] weights = new double[size]; 124 122 … … 133 131 } 134 132 135 double east = 0, north= 0, weight = 0;133 double east2 = 0, north2 = 0, weight = 0; 136 134 for (int i = 0; i < size; i++) { 137 135 final EastNorth en = candidates.get(i).getEastNorth(); 138 136 final double w = weights[i]; 139 east += en.east() * w;140 north += en.north() * w;137 east2 += en.east() * w; 138 north2 += en.north() * w; 141 139 weight += w; 142 140 } 143 141 144 return new Node(new EastNorth(east / weight, north / weight)); 145 } 142 return new Node(new EastNorth(east2 / weight, north2 / weight)); 146 143 default: 147 144 throw new RuntimeException("unacceptable merge-nodes.mode"); -
trunk/src/org/openstreetmap/josm/actions/mapmode/ParallelWays.java
r7005 r7025 89 89 90 90 // Ugly method of ensuring that the offset isn't inverted. I'm sure there is a better and more elegant way, but I'm starting to get sleepy, so I do this for now. 91 { 92 Way refWay = ways.get(refWayIndex); 93 boolean refWayReversed = true; 94 for (int i = 0; i < sortedNodes.size() - 1; i++) { 95 if (sortedNodes.get(i) == refWay.firstNode() && sortedNodes.get(i + 1) == refWay.getNode(1)) { 96 refWayReversed = false; 97 break; 98 } 91 Way refWay = ways.get(refWayIndex); 92 boolean refWayReversed = true; 93 for (int i = 0; i < sortedNodes.size() - 1; i++) { 94 if (sortedNodes.get(i) == refWay.firstNode() && sortedNodes.get(i + 1) == refWay.getNode(1)) { 95 refWayReversed = false; 96 break; 99 97 } 100 if (refWayReversed) {101 Collections.reverse(sortedNodes); // need to keep the orientation of the reference way.102 }98 } 99 if (refWayReversed) { 100 Collections.reverse(sortedNodes); // need to keep the orientation of the reference way. 103 101 } 104 102 -
trunk/src/org/openstreetmap/josm/data/imagery/GeorefImage.java
r7005 r7025 72 72 switch (state) { 73 73 case FAILED: 74 { 75 BufferedImage img = createImage(); 76 layer.drawErrorTile(img); 77 this.image = img; 74 BufferedImage imgFailed = createImage(); 75 layer.drawErrorTile(imgFailed); 76 this.image = imgFailed; 78 77 break; 79 }80 78 case NOT_IN_CACHE: 81 {82 79 BufferedImage img = createImage(); 83 80 Graphics g = img.getGraphics(); … … 93 90 this.image = img; 94 91 break; 95 }96 92 default: 97 93 if (this.image != null) { -
trunk/src/org/openstreetmap/josm/data/osm/QuadBuckets.java
r7005 r7025 614 614 return ret; 615 615 } 616 617 public void printTree() {618 printTreeRecursive(root, 0);619 }620 621 private void printTreeRecursive(QBLevel<T> level, int indent) {622 if (level == null) {623 printIndented(indent, "<empty child>");624 return;625 }626 printIndented(indent, level);627 if (level.hasContent()) {628 for (T o : level.content) {629 printIndented(indent, o);630 }631 }632 for (QBLevel<T> child : level.getChildren()) {633 printTreeRecursive(child, indent + 2);634 }635 }636 637 private void printIndented(int indent, Object msg) {638 for (int i = 0; i < indent; i++) {639 System.out.print(' ');640 }641 System.out.println(msg);642 }643 616 } -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2GridShiftFile.java
r7005 r7025 127 127 in.read(b8); 128 128 in.read(b8); 129 shiftType = new String(b8 );129 shiftType = new String(b8, Utils.UTF_8); 130 130 in.read(b8); 131 131 in.read(b8); -
trunk/src/org/openstreetmap/josm/data/projection/datum/NTV2SubGrid.java
r6995 r7025 186 186 */ 187 187 private boolean isCoordWithin(double lon, double lat) { 188 if ((lon >= minLon) && (lon < maxLon) && (lat >= minLat) && (lat < maxLat)) 189 return true; 190 else 191 return false; 188 return (lon >= minLon) && (lon < maxLon) && (lat >= minLat) && (lat < maxLat); 192 189 } 193 190 -
trunk/src/org/openstreetmap/josm/data/validation/tests/DuplicateRelation.java
r7005 r7025 101 101 * Class to store relation members 102 102 */ 103 private class RelationMembers {103 private static class RelationMembers { 104 104 /** List of member objects of the relation */ 105 105 private List<RelMember> members; -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r7012 r7025 71 71 72 72 /** The spell check key substitutions: the key should be substituted by the value */ 73 pr otectedstatic Map<String, String> spellCheckKeyData;73 private static Map<String, String> spellCheckKeyData; 74 74 /** The spell check preset values */ 75 pr otectedstatic MultiMap<String, String> presetsValueData;75 private static MultiMap<String, String> presetsValueData; 76 76 /** The TagChecker data */ 77 pr otectedstatic final List<CheckerData> checkerData = new ArrayList<>();78 pr otectedstatic final List<String> ignoreDataStartsWith = new ArrayList<>();79 pr otectedstatic final List<String> ignoreDataEquals = new ArrayList<>();80 pr otectedstatic final List<String> ignoreDataEndsWith = new ArrayList<>();81 pr otectedstatic final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<>();77 private static final List<CheckerData> checkerData = new ArrayList<>(); 78 private static final List<String> ignoreDataStartsWith = new ArrayList<>(); 79 private static final List<String> ignoreDataEquals = new ArrayList<>(); 80 private static final List<String> ignoreDataEndsWith = new ArrayList<>(); 81 private static final List<IgnoreKeyPair> ignoreDataKeyPair = new ArrayList<>(); 82 82 83 83 /** The preferences prefix */ -
trunk/src/org/openstreetmap/josm/data/validation/tests/UnclosedWays.java
r7005 r7025 57 57 * @param engMessage The English message 58 58 */ 59 @SuppressWarnings("unchecked")60 59 public UnclosedWaysCheck(int code, String key, String engMessage) { 61 this(code, key, engMessage, Collections. EMPTY_LIST);60 this(code, key, engMessage, Collections.<String>emptyList()); 62 61 } 63 62 -
trunk/src/org/openstreetmap/josm/data/validation/util/Entities.java
r7005 r7025 368 368 switch (isHexChar) { 369 369 case 'X' : 370 case 'x' : {370 case 'x' : 371 371 entityValue = Integer.parseInt(entityContent.substring(2), 16); 372 372 break; 373 } 374 default : { 373 default : 375 374 entityValue = Integer.parseInt(entityContent.substring(1), 10); 376 }377 375 } 378 376 if (entityValue > 0xFFFF) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r7005 r7025 14 14 import java.awt.event.MouseAdapter; 15 15 import java.awt.event.MouseEvent; 16 import java.io.UnsupportedEncodingException; 16 17 import java.net.HttpURLConnection; 17 18 import java.net.URI; 19 import java.net.URISyntaxException; 18 20 import java.net.URLEncoder; 19 21 import java.util.ArrayList; … … 1142 1144 } 1143 1145 }); 1144 } catch ( Exception e1) {1146 } catch (URISyntaxException | UnsupportedEncodingException e1) { 1145 1147 Main.error(e1); 1146 1148 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r7005 r7025 184 184 BugReportExceptionHandler.handleException(e); 185 185 } 186 187 186 } 188 187 }; … … 200 199 // reload if the history is not in the cache yet 201 200 return true; 202 else if (!p.isNew() && h.getByVersion(p.getUniqueId()) == null)201 else 203 202 // reload if the history object of the selected object is not in the cache yet 204 return true; 205 else 206 return false; 203 return (!p.isNew() && h.getByVersion(p.getUniqueId()) == null); 207 204 } 208 205 }; … … 215 212 } 216 213 }; 217 218 214 } -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserModel.java
r7005 r7025 427 427 case 2: 428 428 return isCurrentPointInTime(row); 429 case 3: {430 HistoryOsmPrimitive p = getPrimitive(row);431 if (p != null && p.getTimestamp() != null)432 return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(p .getTimestamp());429 case 3: 430 HistoryOsmPrimitive p3 = getPrimitive(row); 431 if (p3 != null && p3.getTimestamp() != null) 432 return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(p3.getTimestamp()); 433 433 return null; 434 } 435 case 4: { 436 HistoryOsmPrimitive p = getPrimitive(row); 437 if (p != null) { 438 User user = p.getUser(); 434 case 4: 435 HistoryOsmPrimitive p4 = getPrimitive(row); 436 if (p4 != null) { 437 User user = p4.getUser(); 439 438 if (user != null) 440 439 return user.getName(); 441 440 } 442 441 return null; 443 }444 442 } 445 443 return null; -
trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
r7005 r7025 297 297 OsmApi.getOsmApi().closeChangeset(changeset, progressMonitor.createSubTaskMonitor(0, false)); 298 298 } 299 } catch ( Exception e) {299 } catch (OsmTransferException e) { 300 300 if (uploadCanceled) { 301 301 Main.info(tr("Ignoring caught exception because upload is canceled. Exception is: {0}", e.toString())); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r7021 r7025 704 704 break; 705 705 case CANCEL: 706 {707 706 if (yLayer != null) { 708 707 for (ImageEntry ie : yLayer.data) { … … 712 711 } 713 712 break; 714 }715 713 case AGAIN: 716 714 actionPerformed(null); 717 715 break; 718 716 case DONE: 719 {720 717 Main.pref.put("geoimage.timezone", formatTimezone(timezone)); 721 718 Main.pref.put("geoimage.delta", Long.toString(delta * 1000)); … … 751 748 752 749 break; 753 }754 750 default: 755 751 throw new IllegalStateException(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/LineElemStyle.java
r6909 r7025 99 99 switch (type) { 100 100 case NORMAL: 101 { 102 Float widthOnDefault = getWidth(c_def, WIDTH, null); 103 width = getWidth(c, WIDTH, widthOnDefault); 104 break; 105 } 101 width = getWidth(c, WIDTH, getWidth(c_def, WIDTH, null)); 102 break; 106 103 case CASING: 107 {108 104 Float casingWidth = c.get(type.prefix + WIDTH, null, Float.class, true); 109 105 if (casingWidth == null) { … … 115 111 if (casingWidth == null) 116 112 return null; 117 Float widthOnDefault = getWidth(c_def, WIDTH, null); 118 width = getWidth(c, WIDTH, widthOnDefault); 113 width = getWidth(c, WIDTH, getWidth(c_def, WIDTH, null)); 119 114 if (width == null) { 120 115 width = 0f; … … 122 117 width += 2 * casingWidth; 123 118 break; 124 }125 119 case LEFT_CASING: 126 120 case RIGHT_CASING: -
trunk/src/org/openstreetmap/josm/gui/preferences/SourceEditor.java
r7024 r7025 1340 1340 } 1341 1341 } 1342 } catch ( Exception e) {1342 } catch (IOException e) { 1343 1343 if (canceled) 1344 1344 // ignore the exception and return -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/CodeProjectionChoice.java
r7015 r7025 67 67 * Comparator that compares the number part of the code numerically. 68 68 */ 69 private class CodeComparator implements Comparator<String> {69 private static class CodeComparator implements Comparator<String> { 70 70 final Pattern codePattern = Pattern.compile("([a-zA-Z]+):(\\d+)"); 71 71 @Override -
trunk/src/org/openstreetmap/josm/gui/preferences/projection/PuwgProjectionChoice.java
r6717 r7025 10 10 public class PuwgProjectionChoice extends ListProjectionChoice { 11 11 12 p ublicstatic final String[] CODES = {12 private static final String[] CODES = { 13 13 "EPSG:2180", 14 14 "EPSG:2176", … … 17 17 "EPSG:2179" 18 18 }; 19 public static final String[] NAMES = { 19 20 private static final String[] NAMES = { 20 21 tr("PUWG 1992 (Poland)"), 21 22 tr("PUWG 2000 Zone {0} (Poland)", 5), -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
r7012 r7025 1156 1156 throwParseException(st, "expected '=' after " + name); 1157 1157 } 1158 if ( name.equalsIgnoreCase("WEIGHT")) {1158 if ("WEIGHT".equalsIgnoreCase(name)) { 1159 1159 if (st.nextToken() == StreamTokenizer.TT_NUMBER) { 1160 1160 node.setWeight(st.nval); … … 1164 1164 } 1165 1165 } 1166 else if ( name.equalsIgnoreCase("NAME")) {1166 else if ("NAME".equalsIgnoreCase(name)) { 1167 1167 if (st.nextToken() == StreamTokenizer.TT_WORD) { 1168 1168 if (node instanceof Leaf) { … … 1218 1218 } 1219 1219 else if (token == StreamTokenizer.TT_WORD) { 1220 if ( st.sval.equalsIgnoreCase("WEIGHT")) {1220 if ("WEIGHT".equalsIgnoreCase(st.sval)) { 1221 1221 parseAttribute(st.sval, st, parent); 1222 1222 } -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r7005 r7025 29 29 30 30 private static final List<Proxy> NO_PROXY_LIST = Collections.singletonList(Proxy.NO_PROXY); 31 32 private static final String IPV4_LOOPBACK = "127.0.0.1"; 33 private static final String IPV6_LOOPBACK = "::1"; 31 34 32 35 /** … … 142 145 proxyExceptions = new HashSet<>( 143 146 Main.pref.getCollection(ProxyPreferencesPanel.PROXY_EXCEPTIONS, 144 Arrays.asList(new String[]{"localhost", "127.0.0.1"}))147 Arrays.asList(new String[]{"localhost", IPV4_LOOPBACK, IPV6_LOOPBACK})) 145 148 ); 146 149 } -
trunk/src/org/openstreetmap/josm/io/OsmChangeReader.java
r7012 r7025 22 22 * List of possible actions. 23 23 */ 24 p ublicstatic final String[] ACTIONS = {"create", "modify", "delete"};24 private static final String[] ACTIONS = {"create", "modify", "delete"}; 25 25 26 26 /** -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r7013 r7025 55 55 56 56 /** Used by plugins to register themselves as data postprocessors. */ 57 p ublicstatic List<OsmServerReadPostprocessor> postprocessors;57 private static List<OsmServerReadPostprocessor> postprocessors; 58 58 59 59 /** register a new postprocessor */ -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r7012 r7025 185 185 * List of unmaintained plugins. Not really up-to-date as the vast majority of plugins are not really maintained after a few months, sadly... 186 186 */ 187 p ublicstatic final String [] UNMAINTAINED_PLUGINS = new String[] {"gpsbabelgui", "Intersect_way"};187 private static final String [] UNMAINTAINED_PLUGINS = new String[] {"gpsbabelgui", "Intersect_way"}; 188 188 189 189 /** -
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r6830 r7025 11 11 import javax.sound.sampled.AudioSystem; 12 12 import javax.sound.sampled.DataLine; 13 import javax.sound.sampled.LineUnavailableException; 13 14 import javax.sound.sampled.SourceDataLine; 15 import javax.sound.sampled.UnsupportedAudioFileException; 14 16 import javax.swing.JOptionPane; 15 17 … … 339 341 } 340 342 command.ok(stateChange); 341 } catch ( Exception startPlayingException) {343 } catch (LineUnavailableException | IOException | UnsupportedAudioFileException startPlayingException) { 342 344 command.failed(startPlayingException); // sets state 343 345 } -
trunk/src/org/openstreetmap/josm/tools/AudioUtil.java
r6889 r7025 3 3 4 4 import java.io.File; 5 import java.io.IOException; 6 import java.net.MalformedURLException; 5 7 import java.net.URL; 6 8 … … 8 10 import javax.sound.sampled.AudioInputStream; 9 11 import javax.sound.sampled.AudioSystem; 12 import javax.sound.sampled.UnsupportedAudioFileException; 10 13 11 14 import org.openstreetmap.josm.Main; … … 40 43 double calibration = Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */); 41 44 return naturalLength / calibration; 42 } catch ( Exception e) {45 } catch (UnsupportedAudioFileException | IOException e) { 43 46 return 0.0; 44 47 } -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r7024 r7025 770 770 @Override 771 771 public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException { 772 if ( localName.equalsIgnoreCase("img")) {772 if ("img".equalsIgnoreCase(localName)) { 773 773 String val = atts.getValue("src"); 774 774 if (val.endsWith(fn))
Note:
See TracChangeset
for help on using the changeset viewer.