- Timestamp:
- 2023-08-09T15:30:01+02:00 (18 months ago)
- Location:
- trunk
- Files:
-
- 132 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/native/docker-test.sh
r17976 r18801 1 #!/bin/bash 2 1 3 docker build . -t josm/josm 2 4 mkdir -p test/report 3 docker run -it --name josm -v `pwd`/test/report:/josm/test/report josm/josm5 docker run -it --name josm -v "$(pwd)"/test/report:/josm/test/report josm/josm 4 6 docker rm josm 5 7 docker rmi josm/josm -
trunk/native/windows/win-jpackage.sh
r18525 r18801 38 38 #sed -i "s|%josm-source-dir%|$(pwd)|g" native/windows/main.wxs 39 39 cp native/windows/main.wxs native/windows/main.wxs.bak 40 sed -i 's?%josm-source-dir%?'`pwd`'?'native/windows/main.wxs40 sed -i "s?%josm-source-dir%?$(pwd)?" native/windows/main.wxs 41 41 sed -i 's?"/c/?"c:/?g' native/windows/main.wxs 42 42 sed -i 's?"/d/?"d:/?g' native/windows/main.wxs … … 47 47 for type in exe msi 48 48 do 49 jpackage $JPACKAGEOPTIONS -n "JOSM" --input dist --main-jar josm-custom.jar \ 49 jpackage "$JPACKAGEOPTIONS" -n "JOSM" --input dist --main-jar josm-custom.jar \ 50 50 --main-class org.openstreetmap.josm.gui.MainApplication \ 51 51 --icon ./native/windows/logo.ico --type $type --dest app \ … … 86 86 mv native/windows/main.wxs.bak native/windows/main.wxs 87 87 88 mv app/JOSM-1.5. $1.exe app/JOSM.exe89 mv app/JOSM-1.5. $1.msi app/JOSM.msi88 mv app/JOSM-1.5."$1".exe app/JOSM.exe 89 mv app/JOSM-1.5."$1".msi app/JOSM.msi 90 90 91 91 # Workaround to https://bugs.openjdk.java.net/browse/JDK-8261845 -
trunk/scripts/BuildProjectionDefinitions.java
r16344 r18801 93 93 if (list.isEmpty()) 94 94 throw new AssertionError("EPSG file seems corrupted"); 95 Pattern badDmsPattern = Pattern.compile("(\\d+(?:\\.\\d+)?d\\d+(?:\\.\\d+)?')( N|S|E|W)");95 Pattern badDmsPattern = Pattern.compile("(\\d+(?:\\.\\d+)?d\\d+(?:\\.\\d+)?')([NSEW])"); 96 96 for (ProjectionDefinition pd : list) { 97 97 // DMS notation without second causes problems with cs2cs, add 0" … … 145 145 146 146 if (printStats) { 147 System.out.print ln(String.format("loaded %d entries from %s", epsgJosm.size(), JOSM_EPSG_FILE));148 System.out.print ln(String.format("loaded %d entries from %s", epsgProj4.size(), PROJ4_EPSG_FILE));149 System.out.print ln(String.format("loaded %d entries from %s", esriProj4.size(), PROJ4_ESRI_FILE));147 System.out.printf("loaded %d entries from %s%n", epsgJosm.size(), JOSM_EPSG_FILE); 148 System.out.printf("loaded %d entries from %s%n", epsgProj4.size(), PROJ4_EPSG_FILE); 149 System.out.printf("loaded %d entries from %s%n", esriProj4.size(), PROJ4_ESRI_FILE); 150 150 System.out.println(); 151 151 System.out.println("some entries from proj.4 have not been included:"); 152 System.out.print ln(String.format(" * already in the maintained JOSM list: %d entries", noInJosm));152 System.out.printf(" * already in the maintained JOSM list: %d entries%n", noInJosm); 153 153 if (noInProj4 > 0) { 154 System.out.print ln(String.format(" * ESRI already in the standard EPSG list: %d entries", noInProj4));155 } 156 System.out.print ln(String.format(" * deprecated: %d entries", noDeprecated));157 System.out.print ln(String.format(" * using +proj=geocent, which is 3D (X,Y,Z) and not useful in JOSM: %d entries", noGeocent));154 System.out.printf(" * ESRI already in the standard EPSG list: %d entries%n", noInProj4); 155 } 156 System.out.printf(" * deprecated: %d entries%n", noDeprecated); 157 System.out.printf(" * using +proj=geocent, which is 3D (X,Y,Z) and not useful in JOSM: %d entries%n", noGeocent); 158 158 if (noEllipsoid > 0) { 159 System.out.print ln(String.format(" * unsupported ellipsoids: %d entries", noEllipsoid));159 System.out.printf(" * unsupported ellipsoids: %d entries%n", noEllipsoid); 160 160 System.out.println(" in particular: " + ellipsoidMap); 161 161 } 162 162 if (noBaseProjection > 0) { 163 System.out.print ln(String.format(" * unsupported base projection: %d entries", noBaseProjection));163 System.out.printf(" * unsupported base projection: %d entries%n", noBaseProjection); 164 164 System.out.println(" in particular: " + baseProjectionMap); 165 165 } 166 166 if (noDatumgrid > 0) { 167 System.out.print ln(String.format(" * requires data file for vertical datum conversion: %d entries", noDatumgrid));167 System.out.printf(" * requires data file for vertical datum conversion: %d entries%n", noDatumgrid); 168 168 System.out.println(" in particular: " + datumgridMap); 169 169 } 170 170 if (noNadgrid > 0) { 171 System.out.print ln(String.format(" * requires data file for datum conversion: %d entries", noNadgrid));171 System.out.printf(" * requires data file for datum conversion: %d entries%n", noNadgrid); 172 172 System.out.println(" in particular: " + nadgridMap); 173 173 } 174 174 if (noOmercNoBounds > 0) { 175 System.out.print ln(String.format(176 " * projection is Oblique Mercator (requires bounds), but no bounds specified: %d entries", noOmercNoBounds ));175 System.out.printf( 176 " * projection is Oblique Mercator (requires bounds), but no bounds specified: %d entries%n", noOmercNoBounds); 177 177 } 178 178 if (noEquatorStereo > 0) { 179 System.out.print ln(String.format(" * projection is Equatorial Stereographic (see #15970): %d entries", noEquatorStereo));179 System.out.printf(" * projection is Equatorial Stereographic (see #15970): %d entries%n", noEquatorStereo); 180 180 } 181 181 System.out.println(); 182 System.out.print ln(String.format("written %d entries from %s", noJosm, JOSM_EPSG_FILE));183 System.out.print ln(String.format("written %d entries from %s", noProj4, PROJ4_EPSG_FILE));184 System.out.print ln(String.format("written %d entries from %s", noEsri, PROJ4_ESRI_FILE));182 System.out.printf("written %d entries from %s%n", noJosm, JOSM_EPSG_FILE); 183 System.out.printf("written %d entries from %s%n", noProj4, PROJ4_EPSG_FILE); 184 System.out.printf("written %d entries from %s%n", noEsri, PROJ4_ESRI_FILE); 185 185 } 186 186 } -
trunk/scripts/SyncEditorLayerIndex.java
r18723 r18801 70 70 * Compare and analyse the differences of the editor layer index and the JOSM imagery list. 71 71 * The goal is to keep both lists in sync. 72 * 73 * The editor layer index project (https://github.com/osmlab/editor-layer-index) 74 * provides also a version in the JOSM format, but the GEOJSON is the original source 75 * format, so we read that. 76 * 77 * How to run: 78 * ----------- 79 * 80 * Main JOSM binary needs to be in classpath, e.g. 81 * 82 * $ java -cp ../dist/josm-custom.jar SyncEditorLayerIndex 83 * 84 * Add option "-h" to show the available command line flags. 72 * <p> 73 * The <a href="https://github.com/osmlab/editor-layer-index">editor layer index</a> project 74 * provides also a version in the JOSM format, but the GEOJSON is the original source format, so we read that. 75 * <p> 76 * For running, the main JOSM binary needs to be in classpath, e.g. 77 * <p> 78 * {@code $ java -cp ../dist/josm-custom.jar SyncEditorLayerIndex} 79 * <p> 80 * Add option {@code -h} to show the available command line flags. 85 81 */ 86 82 @SuppressWarnings("unchecked") … … 294 290 void myprintln(String s) { 295 291 String color; 292 final String escaped = s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">"); 296 293 if ((color = isSkipString(s)) != null) { 297 294 skip.remove(s); 298 295 if (optionXhtmlBody || optionXhtml) { 299 296 s = "<pre style=\"margin:3px;color:"+color+"\">" 300 + s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")+"</pre>";297 + escaped +"</pre>"; 301 298 } 302 299 if (!optionNoSkip) { … … 310 307 (s.startsWith("!") ? "orange" : 311 308 (s.startsWith("~") ? "red" : "brown")))); 312 s = "<pre style=\"margin:3px;color:"+color+"\">"+ s.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">")+"</pre>";309 s = "<pre style=\"margin:3px;color:"+color+"\">"+ escaped +"</pre>"; 313 310 } 314 311 if ((s.startsWith("+ ") || s.startsWith("+++ ELI") || s.startsWith("#")) && optionNoEli) { -
trunk/scripts/TagInfoExtract.java
r18760 r18801 90 90 * Run from the base directory of a JOSM checkout: 91 91 * <p> 92 * <pre> 92 93 * java -cp dist/josm-custom.jar TagInfoExtract --type mappaint 93 94 * java -cp dist/josm-custom.jar TagInfoExtract --type presets 94 95 * java -cp dist/josm-custom.jar TagInfoExtract --type external_presets 96 * </pre> 95 97 */ 96 98 public class TagInfoExtract { … … 245 247 .build()); 246 248 if (options.outputFile == null) { 247 System.out.println(writer .toString());249 System.out.println(writer); 248 250 } 249 251 } -
trunk/scripts/TaggingPresetSchemeWikiGenerator.java
r16644 r18801 23 23 24 24 /** 25 * This script generates the wiki content for https://josm.openstreetmap.de/wiki/TaggingPresets#Attributes 25 * This script generates the wiki content for <a href="https://josm.openstreetmap.de/wiki/TaggingPresets#Attributes"> 26 * TaggingPresets#Attributes</a> 26 27 */ 27 28 public final class TaggingPresetSchemeWikiGenerator { -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r18181 r18801 519 519 } 520 520 if ((checkRes & Command.IS_INCOMPLETE) != 0) { 521 boolean answer = showConfirmOutlyingOperationDialog(operation + "_incomplete", incompleteDialogMessage, dialogTitle); 522 if (!answer) 523 return false; 521 return showConfirmOutlyingOperationDialog(operation + "_incomplete", incompleteDialogMessage, dialogTitle); 524 522 } 525 523 return true; -
trunk/src/org/openstreetmap/josm/actions/UnJoinNodeWayAction.java
r17188 r18801 157 157 result.removeIf(way -> way.getNodesCount() <= 2); 158 158 159 if (selectedWays.isEmpty()) 160 return result; 161 else { 162 // Return only selected ways 159 // Return only selected ways 160 if (!selectedWays.isEmpty()) { 163 161 result.removeIf(way -> !selectedWays.contains(way)); 164 return result;165 162 } 163 return result; 166 164 } 167 165 -
trunk/src/org/openstreetmap/josm/actions/UploadAction.java
r18752 r18801 62 62 * if they want to be able to veto an upload. 63 63 * <p> 64 * B edefault, the standard upload dialog is the only element in the list.64 * By default, the standard upload dialog is the only element in the list. 65 65 * Plugins should normally insert their code before that, so that the upload 66 66 * dialog is the last thing shown before upload really starts; on occasion -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r18208 r18801 136 136 * 137 137 * @param layer the data layer from which we upload a subset of primitives 138 * @param toUpload the primitives to upload. If null or empty returns immediatel ly138 * @param toUpload the primitives to upload. If null or empty returns immediately 139 139 */ 140 140 public void uploadPrimitives(OsmDataLayer layer, Collection<OsmPrimitive> toUpload) { -
trunk/src/org/openstreetmap/josm/actions/corrector/ReverseWayTagCorrector.java
r17289 r18801 99 99 100 100 StringBuilder result = new StringBuilder(); 101 result.append(text .substring(0, m.start(2)))101 result.append(text, 0, m.start(2)) 102 102 .append(leftRight.equals(a) ? b : a) 103 103 .append(text.substring(m.end(2))); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java
r13927 r18801 104 104 * Future<?> future = task.download(); 105 105 * // DON'T run this on the Swing EDT or JOSM will freeze 106 * future.get(); // waits for the dowload task to complete 106 * future.get(); // waits for the download task to complete 107 107 * </pre> 108 108 * -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java
r18211 r18801 106 106 * Future<?> future = task.download(...); 107 107 * // DON'T run this on the Swing EDT or JOSM will freeze 108 * future.get(); // waits for the dowload task to complete 108 * future.get(); // waits for the download task to complete 109 109 * </pre> 110 110 * -
trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java
r17896 r18801 208 208 * segments for the given pointer position (via MouseEvent) and modifiers. 209 209 * @param e current mouse event 210 * @param modifiers extended mouse modifiers, not necessarly taken from the given mouse event 210 * @param modifiers extended mouse modifiers, not necessarily taken from the given mouse event 211 211 */ 212 212 private void addHighlighting(MouseEvent e, int modifiers) { … … 256 256 * 257 257 * @param e current mouse event 258 * @param modifiers extended mouse modifiers, not necessarly taken from the given mouse event 258 * @param modifiers extended mouse modifiers, not necessarily taken from the given mouse event 259 259 */ 260 260 private void updateCursor(MouseEvent e, int modifiers) { -
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawSnapHelper.java
r18612 r18801 465 465 EastNorth enOpt = null; 466 466 double dOpt = 1e5; 467 for (EastNorth en: pointsToProject) { // searching for bes ht projection467 for (EastNorth en: pointsToProject) { // searching for best projection 468 468 double l1 = (en.east()-e0)*pe+(en.north()-n0)*pn; 469 469 double d1 = Math.abs(l1-l); -
trunk/src/org/openstreetmap/josm/actions/upload/UploadHook.java
r13028 r18801 7 7 8 8 /** 9 * Change ,or block,the upload.9 * Change or block the upload. 10 10 * 11 11 * The UploadHook may modify the uploaded data silently, it may display a … … 17 17 18 18 /** 19 * Check ,and/or change,the data to be uploaded.19 * Check and/or change the data to be uploaded. 20 20 * Default implementation is to approve the upload. 21 21 * @param apiDataSet the data to upload, modify this to change the data. -
trunk/src/org/openstreetmap/josm/command/AddPrimitivesCommand.java
r18724 r18801 104 104 Optional<PrimitiveData> o = data.stream() 105 105 .filter(pd -> pd.getPrimitiveId().equals(osm.getPrimitiveId())).findAny(); 106 if (o.isPresent()) { 107 osm.load(o.get()); 108 } 106 o.ifPresent(osm::load); 109 107 } else { 110 108 ds.addPrimitive(osm); -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r18395 r18801 510 510 511 511 if (ws.getWay().isClosed()) { 512 // If the way is circular (first and last nodes are the same), the way shouldn't be split ted512 // If the way is circular (first and last nodes are the same), the way shouldn't be split 513 513 514 514 List<Node> n = new ArrayList<>(); -
trunk/src/org/openstreetmap/josm/data/Bounds.java
r18695 r18801 502 502 /** 503 503 * Determines if this Bounds object crosses the 180th Meridian. 504 * See http://wiki.openstreetmap.org/wiki/180th_meridian 504 * See <a href="http://wiki.openstreetmap.org/wiki/180th_meridian">180th Meridian</a>. 505 505 * @return true if this Bounds object crosses the 180th Meridian. 506 506 */ -
trunk/src/org/openstreetmap/josm/data/Version.java
r18211 r18801 46 46 47 47 /** 48 * Initializes the version info sfrom the revision resource file48 * Initializes the version info from the revision resource file 49 49 * 50 50 * @param revisionInfo the revision info from a revision resource file as InputStream -
trunk/src/org/openstreetmap/josm/data/gpx/GpxTrackSegment.java
r18494 r18801 47 47 for (WayPoint tpt : wayPoints) { 48 48 if (last != null) { 49 Double d = last.greatCircleDistance(tpt);50 if (! d.isNaN() && !d.isInfinite()) {49 double d = last.greatCircleDistance(tpt); 50 if (!Double.isNaN(d) && !Double.isInfinite(d)) { 51 51 result += d; 52 52 } -
trunk/src/org/openstreetmap/josm/data/imagery/DefaultLayer.java
r18723 r18801 9 9 10 10 import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryType; 11 import org.openstreetmap.josm.tools.Utils; 11 12 12 13 /** … … 34 35 this.layerName = layerName == null ? "" : layerName; 35 36 this.style = style == null ? "" : style; 36 if (imageryType != ImageryType.WMTS && !(tileMatrixSet == null || "".equals(tileMatrixSet))) {37 if (imageryType != ImageryType.WMTS && !Utils.isEmpty(tileMatrixSet)) { 37 38 throw new IllegalArgumentException(tr("{0} imagery has tileMatrixSet defined to: {1}", imageryType, tileMatrixSet)); 38 39 } -
trunk/src/org/openstreetmap/josm/data/imagery/OffsetBookmark.java
r16436 r18801 285 285 286 286 /** 287 * Stores the bookma krs in the settings.287 * Stores the bookmarks in the settings. 288 288 */ 289 289 public static void saveBookmarks() { -
trunk/src/org/openstreetmap/josm/data/oauth/IOAuthToken.java
r18665 r18801 13 13 * Sign a client 14 14 * @param client The client to sign 15 * @throws OAuthException if the OAuth token type is unknown (AKA we do't know how to handle it) 15 * @throws OAuthException if the OAuth token type is unknown (AKA we don't know how to handle it) 16 16 */ 17 17 void sign(HttpClient client) throws OAuthException; -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r18303 r18801 155 155 156 156 /** 157 * Returns the list of changesets contained in the cache.158 * @return the list of changesets contained in the cache157 * Returns the set of changesets contained in the cache. 158 * @return the set of changesets contained in the cache 159 159 */ 160 160 public Set<Changeset> getChangesets() { -
trunk/src/org/openstreetmap/josm/data/osm/DataSet.java
r18724 r18801 374 374 375 375 /** 376 * Replies the setof changeset tags to be applied when or if this is ever uploaded.377 * @return the setof changeset tags376 * Replies the map of changeset tags to be applied when or if this is ever uploaded. 377 * @return the map of changeset tags 378 378 * @see #addChangeSetTag 379 379 */ -
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r17981 r18801 150 150 151 151 /** 152 * Postprocess the dataset and fix all merged references to point to the actual 153 * data. 152 * Postprocess the dataset and fix all merged references to point to the actual data. 154 153 */ 155 154 public void fixReferences() { -
trunk/src/org/openstreetmap/josm/data/osm/FilterMatcher.java
r17980 r18801 78 78 79 79 FilterInfo(Filter filter) throws SearchParseError { 80 if (filter.mode == SearchMode.remove || filter.mode == SearchMode.in_selection) { 81 isDelete = true; 82 } else { 83 isDelete = false; 84 } 80 isDelete = filter.mode == SearchMode.remove || filter.mode == SearchMode.in_selection; 85 81 86 82 Match compiled = SearchCompiler.compile(filter); -
trunk/src/org/openstreetmap/josm/data/osm/IPrimitive.java
r17981 r18801 288 288 * 289 289 * @return date of last modification 290 * @see # getInstant290 * @see #setInstant 291 291 */ 292 292 Instant getInstant(); … … 394 394 /** 395 395 * Get an object to synchronize the style cache on. This <i>should</i> be a field that does not change during paint. 396 * By default, it returns the current object, but should be overriden to avoid some performance issues. 396 * By default, it returns the current object, but should be overridden to avoid some performance issues. 397 397 * @return A non-{@code null} object to synchronize on when painting 398 398 */ -
trunk/src/org/openstreetmap/josm/data/osm/Node.java
r18494 r18801 359 359 360 360 /** 361 * Replies the set of referring ways.362 * @return the set of referring ways361 * Replies the list of referring ways. 362 * @return the list of referring ways 363 363 * @since 12031 364 364 */ -
trunk/src/org/openstreetmap/josm/data/osm/OsmDataManager.java
r14143 r18801 71 71 Optional<OsmDataLayer> layer = MainApplication.getLayerManager().getLayersOfType(OsmDataLayer.class).stream() 72 72 .filter(l -> l.data.equals(ds)).findFirst(); 73 if (layer.isPresent()) { 74 MainApplication.getLayerManager().setActiveLayer(layer.get()); 75 } 73 layer.ifPresent(osmDataLayer -> MainApplication.getLayerManager().setActiveLayer(osmDataLayer)); 76 74 } 77 75 -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r18516 r18801 992 992 993 993 /** 994 * Equal ,if the id (and class)isequal.995 * 996 * A nprimitive is equal to its incomplete counter994 * Equal if the id (and class) are equal. 995 * <p> 996 * A primitive is equal to its incomplete counterpart. 997 997 */ 998 998 @Override … … 1010 1010 /** 1011 1011 * Return the id plus the class type encoded as hashcode or super's hashcode if id is 0. 1012 * 1013 * A nprimitive has the same hashcode as its incomplete counterpart.1012 * <p> 1013 * A primitive has the same hashcode as its incomplete counterpart. 1014 1014 */ 1015 1015 @Override -
trunk/src/org/openstreetmap/josm/data/osm/OsmUtils.java
r18208 r18801 36 36 /** 37 37 * Discouraged synonym for {@link #TRUE_VALUE} 38 */ 38 * @deprecated since xxx, use {@link #TRUE_VALUE} instead. 39 */ 40 @Deprecated 39 41 public static final String trueval = TRUE_VALUE; 40 42 /** 41 43 * Discouraged synonym for {@link #FALSE_VALUE} 42 */ 44 * @deprecated since xxx, use {@link #FALSE_VALUE} instead. 45 */ 46 @Deprecated 43 47 public static final String falseval = FALSE_VALUE; 44 48 /** 45 49 * Discouraged synonym for {@link #REVERSE_VALUE} 46 */ 50 * @deprecated since xxx, use {@link #REVERSE_VALUE} instead. 51 */ 52 @Deprecated 47 53 public static final String reverseval = REVERSE_VALUE; 48 54 … … 54 60 * Converts a string to a boolean value 55 61 * @param value The string to convert 56 * @return {@link Boolean#TRUE} if that string represents a true value, 57 * {@link Boolean#FALSE} if it represents a false value, 58 * <code>null</code>otherwise.62 * @return {@link Boolean#TRUE} if that string represents a true value,<br> 63 * {@link Boolean#FALSE} if it represents a false value,<br> 64 * {@code null} otherwise. 59 65 */ 60 66 public static Boolean getOsmBoolean(String value) { … … 75 81 public static String getNamedOsmBoolean(String value) { 76 82 Boolean res = getOsmBoolean(value); 77 return res == null ? value : (res ? trueval : falseval);83 return res == null ? value : (res ? TRUE_VALUE : FALSE_VALUE); 78 84 } 79 85 … … 119 125 * Check if a tag value represents a boolean false value 120 126 * @param value The value to check 121 * @return true if it is a true value.127 * @return true if it is a false value. 122 128 */ 123 129 public static boolean isFalse(String value) { … … 138 144 /** 139 145 * Creates a new OSM primitive around (0,0) according to the given assertion. Originally written for unit tests, 140 * this can also be used in another places like validation of local MapCSS validator rules.146 * this can also be used in other places like validation of local MapCSS validator rules. 141 147 * Ways and relations created using this method are empty. 142 148 * @param assertion The assertion describing OSM primitive (ex: "way name=Foo railway=rail") … … 151 157 /** 152 158 * Creates a new OSM primitive according to the given assertion. Originally written for unit tests, 153 * this can also be used in another places like validation of local MapCSS validator rules.159 * this can also be used in other places like validation of local MapCSS validator rules. 154 160 * @param assertion The assertion describing OSM primitive (ex: "way name=Foo railway=rail") 155 161 * @param around the coordinate at which the primitive will be located -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r18208 r18801 525 525 public Collection<OsmPrimitive> getIncompleteMembers() { 526 526 return Arrays.stream(members) 527 .filter(rm -> rm.getMember().isIncomplete())528 527 .map(RelationMember::getMember) 528 .filter(OsmPrimitive::isIncomplete) 529 529 .collect(Collectors.toSet()); 530 530 } -
trunk/src/org/openstreetmap/josm/data/osm/Storage.java
r17860 r18801 15 15 16 16 /** 17 * A Set-like class that allows looking up equivalent preexising instance. 17 * A Set-like class that allows looking up equivalent preexisting instance. 18 18 * It is useful wherever one would use self-mapping construct like 19 19 * <code>Map<T,T>.put(t,t)</code>, that is, for caches, uniqueness filters or similar. -
trunk/src/org/openstreetmap/josm/data/osm/search/SearchCompiler.java
r18496 r18801 919 919 this.key = key; 920 920 this.value = value == null ? "" : value; 921 if ( "".equals(this.value) && "*".equals(key)) {921 if (this.value.isEmpty() && "*".equals(key)) { 922 922 mode = Mode.NONE; 923 } else if ( "".equals(this.value)) {923 } else if (this.value.isEmpty()) { 924 924 if (regexp) { 925 925 mode = Mode.MISSING_KEY_REGEXP; -
trunk/src/org/openstreetmap/josm/data/projection/Ellipsoid.java
r16630 r18801 357 357 double lat0 = 2*Math.atan(Math.exp(latIso))-Math.PI/2; 358 358 double lati = lat0; 359 double lati1 = 1.0; // random value to start the iterative process us359 double lati1 = 1.0; // random value to start the iterative processes 360 360 while (Math.abs(lati1-lati) >= epsilon) { 361 361 lati = lati1; -
trunk/src/org/openstreetmap/josm/data/tagging/ac/AutoCompletionPriority.java
r12859 r18801 127 127 return ds; 128 128 129 int std = Boolean.compare(inStandard, other.inStandard); 130 if (std != 0) 131 return std; 132 133 return 0; 129 return Boolean.compare(inStandard, other.inStandard); 134 130 } 135 131 -
trunk/src/org/openstreetmap/josm/data/validation/ValidationTask.java
r18776 r18801 43 43 * @param tests the tests to run 44 44 * @param validatedPrimitives the collection of primitives to validate. 45 * @param formerValidatedPrimitives the last collection of primitives being validate s. May be null.45 * @param formerValidatedPrimitives the last collection of primitives being validated. May be null. 46 46 */ 47 47 public ValidationTask(Collection<Test> tests, … … 58 58 * @param tests the tests to run 59 59 * @param validatedPrimitives the collection of primitives to validate. 60 * @param formerValidatedPrimitives the last collection of primitives being validate s. May be null.60 * @param formerValidatedPrimitives the last collection of primitives being validated. May be null. 61 61 * @param beforeUpload {@code true} if this is being run prior to upload 62 62 * @since 18752 -
trunk/src/org/openstreetmap/josm/data/validation/routines/EmailValidator.java
r10338 r18801 126 126 127 127 /** 128 * <p>Checks if a field has a valid e-mail address.</p>129 * 130 * @param email The value validation is being performed on. 128 * Checks if a field has a valid e-mail address. 129 * 130 * @param email The value validation is being performed on. A <code>null</code> 131 131 * value is considered invalid. 132 132 * @return true if the email address is valid. -
trunk/src/org/openstreetmap/josm/data/validation/routines/InetAddressValidator.java
r18208 r18801 157 157 for (int index = 0; index < octets.length; index++) { 158 158 String octet = octets[index]; 159 if (octet. length() == 0) {159 if (octet.isEmpty()) { 160 160 emptyOctets++; 161 161 if (emptyOctets > 1) { -
trunk/src/org/openstreetmap/josm/data/validation/routines/UrlValidator.java
r17374 r18801 258 258 259 259 /** 260 * Customizable constructor. Validation behavior is modifed by passing in options. 260 * Customizable constructor. Validation behavior is modified by passing in options. 261 261 * @param schemes the set of valid schemes. Ignored if the ALLOW_ALL_SCHEMES option is set. 262 262 * @param authorityValidator Regular expression validator used to validate the authority part -
trunk/src/org/openstreetmap/josm/data/validation/tests/Highways.java
r18284 r18801 99 99 if (w.isClosed() && w.hasTag(HIGHWAY, CLASSIFIED_HIGHWAYS) && w.hasTag("junction", "circular", "roundabout") 100 100 && IN_DOWNLOADED_AREA_STRICT.test(w)) { 101 // TODO: find out how to handle split tedroundabouts (see #12841)101 // TODO: find out how to handle split roundabouts (see #12841) 102 102 testWrongRoundabout(w); 103 103 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/Lanes.java
r17863 r18801 64 64 .build()); 65 65 } 66 } catch (NumberFormatException ignore) {67 Logging.debug( ignore.getMessage());66 } catch (NumberFormatException e) { 67 Logging.debug(e.getMessage()); 68 68 } 69 69 } … … 76 76 final String backward = Utils.firstNonNull(p.get("lanes:backward"), "0"); 77 77 try { 78 if (Integer.parseInt(lanes) < Integer.parseInt(forward) + Integer.parseInt(backward)) { 79 errors.add(TestError.builder(this, Severity.WARNING, 3101) 80 .message(tr("Number of {0} greater than {1}", tr("{0}+{1}", "lanes:forward", "lanes:backward"), "lanes")) 81 .primitives(p) 82 .build()); 83 } 84 } catch (NumberFormatException ignore) {85 Logging.debug( ignore.getMessage());78 if (Integer.parseInt(lanes) < Integer.parseInt(forward) + Integer.parseInt(backward)) { 79 errors.add(TestError.builder(this, Severity.WARNING, 3101) 80 .message(tr("Number of {0} greater than {1}", tr("{0}+{1}", "lanes:forward", "lanes:backward"), "lanes")) 81 .primitives(p) 82 .build()); 83 } 84 } catch (NumberFormatException e) { 85 Logging.debug(e.getMessage()); 86 86 } 87 87 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java
r18757 r18801 446 446 // add frequently changing info to progress monitor so that it 447 447 // doesn't seem to hang when test takes longer than 0.5 seconds 448 if (cnt % 10000 == 0 && stopwatch.elapsed() >= 500) { 448 if (cnt % 10_000 == 0 && stopwatch.elapsed() >= 500) { 449 449 progressMonitor.setExtraText(tr(" {0}: {1} of {2} elements done", title, cnt, selection.size())); 450 450 } -
trunk/src/org/openstreetmap/josm/data/validation/tests/RelationChecker.java
r18506 r18801 10 10 import java.util.EnumSet; 11 11 import java.util.HashMap; 12 import java.util.HashSet; 12 13 import java.util.Iterator; 13 14 import java.util.LinkedHashMap; … … 16 17 import java.util.List; 17 18 import java.util.Map; 19 import java.util.Set; 18 20 import java.util.stream.Collectors; 19 21 … … 430 432 431 433 private void checkLoop(Relation parent, List<Relation> path) { 432 if (path.contains(parent)) { 434 Set<Relation> pathSet = new HashSet<>(path); 435 if (pathSet.contains(parent)) { 433 436 Iterator<List<Relation>> iter = loops.iterator(); 437 Set<Relation> loop = new HashSet<>(); 434 438 while (iter.hasNext()) { 435 List<Relation> loop =iter.next();439 loop.addAll(iter.next()); 436 440 if (loop.size() > path.size() && loop.containsAll(path)) { 437 441 // remove same loop with irrelevant parent 438 442 iter.remove(); 439 } else if (path.size() >= loop.size() && path.containsAll(loop)) { 443 } else if (path.size() >= loop.size() && pathSet.containsAll(loop)) { 440 444 // same or smaller loop is already known 441 445 return; 442 446 } 447 loop.clear(); 443 448 } 444 449 if (path.get(0).equals(parent)) { -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r18281 r18801 915 915 } 916 916 917 if ( fixedKey != null && !"".equals(fixedKey) && !fixedKey.equals(key)) {917 if (!Utils.isEmpty(fixedKey) && !fixedKey.equals(key)) { 918 918 final String proposedKey = fixedKey; 919 919 // misspelled preset key -
trunk/src/org/openstreetmap/josm/data/validation/tests/UntaggedWay.java
r18176 r18801 113 113 } 114 114 115 // #20393 - ways tagged with just area=yes are ca tchedby MapCSS tests115 // #20393 - ways tagged with just area=yes are caught by MapCSS tests 116 116 if (!w.isTagged() && !w.hasTag("area", OsmUtils.TRUE_VALUE) && !waysUsedInRelations.contains(w)) { 117 117 if (w.hasKeys()) { -
trunk/src/org/openstreetmap/josm/data/vector/DataStore.java
r18305 r18801 80 80 /** 81 81 * Add a datasource to this data set 82 * @param dataSource The data soure to add82 * @param dataSource The datasource to add 83 83 */ 84 84 public void addDataSource(DataSource dataSource) { -
trunk/src/org/openstreetmap/josm/data/vector/VectorDataStore.java
r18578 r18801 80 80 mergeWays(mergedRelation); 81 81 } else if (!(primitive instanceof IWay)) { 82 // Can't merge, ever (one of the child sis a node/relation)82 // Can't merge, ever (one of the children is a node/relation) 83 83 mergedRelation.remove(JOSM_MERGE_TYPE_KEY); 84 84 } -
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r18751 r18801 993 993 994 994 if (Config.getPref().getBoolean("debug.edt-checker.enable", Version.getInstance().isLocalBuild())) { 995 // Repaint manager is registered so late for a reason - there islots of violation during startup process995 // Repaint manager is registered so late for a reason - there are lots of violations during startup process 996 996 // but they don't seem to break anything and are difficult to fix 997 997 Logging.info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console"); … … 1191 1191 UIManager.put("OptionPane.cancelIcon", ImageProvider.getIfAvailable("cancel")); 1192 1192 UIManager.put("OptionPane.noIcon", UIManager.get("OptionPane.cancelIcon")); 1193 // Ensures caret color is the same thantext foreground color, see #122571193 // Ensures caret color is the same as text foreground color, see #12257 1194 1194 // See https://docs.oracle.com/javase/8/docs/api/javax/swing/plaf/synth/doc-files/componentProperties.html 1195 1195 for (String p : Arrays.asList( -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMergeModel.java
r18221 r18801 635 635 * participates in the current {@link ComparePairType} 636 636 * 637 * @return true, if the if the{@link ListRole} of this {@link EntriesTableModel}637 * @return true, if the {@link ListRole} of this {@link EntriesTableModel} 638 638 * participates in the current {@link ComparePairType} 639 639 * -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/AbstractListMerger.java
r17333 r18801 775 775 776 776 /** 777 * Java 1.5 doesn't know nAction.SELECT_KEY. Wires a toggle button to this action777 * Java 1.5 doesn't know Action.SELECT_KEY. Wires a toggle button to this action 778 778 * such that the action gets notified about item state changes and the button gets 779 779 * notified about selection state changes of the action. -
trunk/src/org/openstreetmap/josm/gui/conflict/pair/ComparePairType.java
r16626 r18801 23 23 24 24 /** 25 * compare their version of an {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with the merged ver esion25 * compare their version of an {@link org.openstreetmap.josm.data.osm.OsmPrimitive} with the merged version 26 26 */ 27 27 THEIR_WITH_MERGED(tr("Their with Merged"), THEIR_ENTRIES, MERGED_ENTRIES); -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/MultiValueCellEditor.java
r18221 r18801 217 217 protected void renderValue(Object value) { 218 218 setFont(UIManager.getFont("ComboBox.font")); 219 if ( String.class.isInstance(value)) {220 setText( String.class.cast(value));221 } else if (MultiValueDecisionType .class.isInstance(value)) {222 switch(MultiValueDecisionType .class.cast(value)) {219 if (value instanceof String) { 220 setText((String) value); 221 } else if (value instanceof MultiValueDecisionType) { 222 switch((MultiValueDecisionType) value) { 223 223 case UNDECIDED: 224 224 setText(tr("Choose a value")); -
trunk/src/org/openstreetmap/josm/gui/correction/CorrectionTable.java
r10125 r18801 39 39 40 40 final int correctionsSize = correctionTableModel.getCorrections().size(); 41 final int lines = correctionsSize >MAX_VISIBLE_LINES? MAX_VISIBLE_LINES : correctionsSize;41 final int lines = Math.min(correctionsSize, MAX_VISIBLE_LINES); 42 42 setPreferredScrollableViewportSize(new Dimension(400, lines * getRowHeight())); 43 43 getColumnModel().getColumn(correctionTableModel.getApplyColumn()).setPreferredWidth(40); -
trunk/src/org/openstreetmap/josm/gui/dialogs/CommandStackDialog.java
r18715 r18801 511 511 512 512 /** 513 * Action to undo or redo all commands up to (and including) the seleced item. 513 * Action to undo or redo all commands up to (and including) the selected item. 514 514 */ 515 515 protected class UndoRedoAction extends JosmAction implements IEnabledStateUpdating { -
trunk/src/org/openstreetmap/josm/gui/dialogs/RelationListDialog.java
r18792 r18801 14 14 import java.util.Collections; 15 15 import java.util.EnumSet; 16 import java.util.HashSet; 16 17 import java.util.List; 17 18 import java.util.Set; … … 592 593 public void setSelectedRelations(Collection<? extends IRelation<?>> sel) { 593 594 if (!Utils.isEmpty(sel)) { 594 if (!getVisibleRelations().containsAll(sel)) { 595 if (!new HashSet<>(getVisibleRelations()).containsAll(sel)) { 595 596 resetFilter(); 596 597 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetsInActiveDataLayerListModel.java
r13434 r18801 82 82 // is already registered to receive DataChangedEvents from the current edit layer 83 83 DataSet ds = e.getSource().getActiveDataSet(); 84 if (ds != null) { 85 initFromDataSet(ds); 86 } else { 87 initFromDataSet(null); 88 } 84 initFromDataSet(ds); 89 85 } 90 86 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/UidInputFieldValidator.java
r18208 r18801 66 66 try { 67 67 int uid = Integer.parseInt(value.trim()); 68 if (uid > 0) 69 return uid; 70 return 0; 68 return Math.max(uid, 0); 71 69 } catch (NumberFormatException e) { 72 70 return 0; -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r18692 r18801 136 136 * If no object is selected, the dialog list is empty. 137 137 * If only one is selected, all tags of this object are selected. 138 * If more than one object areselected, the sum of all tagsaredisplayed. If the138 * If more than one object is selected, the sum of all tags is displayed. If the 139 139 * different objects share the same tag, the shared value is displayed. If they have 140 140 * different values, all of them are put in a combo box and the string "<different>" -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java
r18793 r18801 899 899 900 900 /** 901 * Asks confirmationbefore adding a primitive. 901 * Asks confirmation before adding a primitive. 902 902 * @param primitive primitive to add 903 903 * @return {@code true} is user confirms the operation, {@code false} otherwise -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTable.java
r16495 r18801 27 27 import org.openstreetmap.josm.actions.HistoryInfoAction; 28 28 import org.openstreetmap.josm.actions.ZoomToAction; 29 import org.openstreetmap.josm.data.osm.IPrimitive; 29 30 import org.openstreetmap.josm.data.osm.OsmPrimitive; 30 31 import org.openstreetmap.josm.data.osm.Relation; … … 131 132 Collection<RelationMember> sel = getMemberTableModel().getSelectedMembers(); 132 133 final Set<OsmPrimitive> toHighlight = sel.stream() 133 .filter(r -> r.getMember().isUsable())134 134 .map(RelationMember::getMember) 135 .filter(IPrimitive::isUsable) 135 136 .collect(Collectors.toSet()); 136 137 SwingUtilities.invokeLater(() -> { -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java
r18556 r18801 551 551 public Set<OsmPrimitive> getChildPrimitives(Collection<? extends OsmPrimitive> referenceSet) { 552 552 if (referenceSet == null) return null; 553 Collection<? extends OsmPrimitive> referenceActualSet = referenceSet instanceof Set ? 554 (Set<? extends OsmPrimitive>) referenceSet : new HashSet<>(referenceSet); 553 555 return members.stream() 554 .filter(m -> referenceSet.contains(m.getMember()))555 556 .map(RelationMember::getMember) 557 .filter(referenceActualSet::contains) 556 558 .collect(Collectors.toSet()); 557 559 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java
r18208 r18801 432 432 /** 433 433 * Returns the filter list 434 * @return the list of primitives used for filtering434 * @return the set of primitives used for filtering 435 435 */ 436 436 public Set<? extends OsmPrimitive> getFilter() { -
trunk/src/org/openstreetmap/josm/gui/download/BookmarkSelection.java
r18265 r18801 144 144 gc.weightx = 1.0; 145 145 gc.weighty = 1.0; 146 gc.gridx = 1;147 146 dlg.add(new JScrollPane(bookmarks), gc); 148 147 -
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java
r16694 r18801 6 6 import java.awt.BorderLayout; 7 7 import java.awt.Dimension; 8 import java.util. Arrays;8 import java.util.stream.Stream; 9 9 10 10 import javax.swing.JPanel; … … 19 19 20 20 /** 21 * HistoryBrowser is a nUI component which displays history information about an {@link OsmPrimitive}.21 * HistoryBrowser is a UI component which displays history information about an {@link OsmPrimitive}. 22 22 * 23 23 * @since 1709 … … 162 162 model = null; 163 163 } 164 Arrays.asList(tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer).stream()164 Stream.of(tagInfoViewer, nodeListViewer, relationMemberListViewer, coordinateInfoViewer) 165 165 .filter(Destroyable.class::isInstance).forEach(Destroyable::destroy); 166 166 tagInfoViewer = null; -
trunk/src/org/openstreetmap/josm/gui/io/ActionFlagsTableCell.java
r17308 r18801 27 27 * handles everything on its own, in other words it renders itself and also functions 28 28 * as editor so the checkboxes may be set by the user. 29 * 29 * <p> 30 30 * Intended usage is like this: 31 31 * <code> … … 35 35 * <br>col.setCellEditor(aftc); 36 36 * </code> 37 * 37 * <p> 38 38 * Note: Do not use the same object both as <code>TableCellRenderer</code> and 39 39 * <code>TableCellEditor</code> - this can mess up the current editor component -
trunk/src/org/openstreetmap/josm/gui/io/ChangesetManagementPanel.java
r18283 r18801 54 54 private JosmComboBoxModel<Changeset> model; 55 55 private JCheckBox cbCloseAfterUpload; 56 private JButton btnClose;57 56 58 57 /** … … 127 126 gc.gridx++; 128 127 CloseChangesetAction closeChangesetAction = new CloseChangesetAction(); 129 btnClose = new JButton(closeChangesetAction); 128 JButton btnClose = new JButton(closeChangesetAction); 130 129 btnClose.setPreferredSize(prefSize); 131 130 btnClose.setMinimumSize(prefSize); … … 278 277 public void changesetCacheUpdated(ChangesetCacheEvent event) { 279 278 // This listener might have been called by a background task. 280 SwingUtilities.invokeLater( () ->refreshCombo());279 SwingUtilities.invokeLater(this::refreshCombo); 281 280 } 282 281 } -
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetDialog.java
r18211 r18801 181 181 * Sets whether this dialog is canceled 182 182 * 183 * @param canceled true, if this dialog is canceld 183 * @param canceled true, if this dialog is canceled 184 184 */ 185 185 protected void setCanceled(boolean canceled) { -
trunk/src/org/openstreetmap/josm/gui/io/CustomConfigurator.java
r18208 r18801 131 131 */ 132 132 public static void processDownloadOperation(String address, String path, String parentDir, boolean mkdir, boolean unzip) { 133 String dir = parentDir;134 133 if (path.contains("..") || path.startsWith("/") || path.contains(":")) { 135 134 return; // some basic protection 136 135 } 137 File fOut = new File( dir, path);136 File fOut = new File(parentDir, path); 138 137 DownloadFileTask downloadFileTask = new DownloadFileTask(MainApplication.getMainFrame(), address, fOut, mkdir, unzip); 139 138 -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialogModel.java
r18283 r18801 76 76 */ 77 77 String findHashTags(String comment) { 78 String hashtags = String.join(";", 79 Arrays.stream(comment.split("\\s", -1)) 80 .map(s -> Utils.strip(s, ",;")) 81 .filter(s -> s.matches("#[a-zA-Z0-9][-_a-zA-Z0-9]+")) 82 .collect(Collectors.toList())); 78 String hashtags = Arrays.stream(comment.split("\\s", -1)) 79 .map(s -> Utils.strip(s, ",;")) 80 .filter(s -> s.matches("#[a-zA-Z0-9][-_a-zA-Z0-9]+")) 81 .collect(Collectors.joining(";")); 83 82 return hashtags.isEmpty() ? null : hashtags; 84 83 } … … 156 155 public void putAll(Map<String, String> map) { 157 156 commitPendingEdit(); 158 map.forEach( (key, value) -> doPut(key, value));157 map.forEach(this::doPut); 159 158 setDirty(true); 160 159 fireTableDataChanged(); -
trunk/src/org/openstreetmap/josm/gui/io/importexport/GpxExporter.java
r18068 r18801 79 79 @Override 80 80 public boolean acceptFile(File pathname, Layer layer) { 81 return isSupportedLayer(layer) ?super.acceptFile(pathname, layer): false;81 return isSupportedLayer(layer) && super.acceptFile(pathname, layer); 82 82 } 83 83 -
trunk/src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java
r18652 r18801 779 779 Logging.debug("zoomChanged(): {0}", currentZoomLevel); 780 780 if (tileLoader instanceof TMSCachedTileLoader) { 781 ((TMSCachedTileLoader)tileLoader).cancelOutstandingTasks();781 tileLoader.cancelOutstandingTasks(); 782 782 } 783 783 if (invalidate) { … … 1149 1149 StringBuilder ret = new StringBuilder(); 1150 1150 for (String s: text.split(" ", -1)) { 1151 if (g.getFontMetrics().stringWidth(line .toString()+ s) > tileSource.getTileSize()) {1151 if (g.getFontMetrics().stringWidth(line + s) > tileSource.getTileSize()) { 1152 1152 ret.append(line).append('\n'); 1153 1153 line.setLength(0); -
trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java
r18127 r18801 395 395 List<File> result = new ArrayList<>(); 396 396 try { 397 File[] files = autosaveDir.listFiles( (FileFilter)397 File[] files = autosaveDir.listFiles( 398 398 pathname -> OsmImporter.FILE_FILTER.accept(pathname) || NoteImporter.FILE_FILTER.accept(pathname)); 399 399 if (files == null) -
trunk/src/org/openstreetmap/josm/gui/layer/MainLayerManager.java
r18691 r18801 27 27 * The active layer is the layer the user is currently working on. 28 28 * <p> 29 * The edit layer is a ndata layer that we currently work with.29 * The edit layer is a data layer that we currently work with. 30 30 * @author Michael Zangl 31 31 * @since 10279 … … 211 211 212 212 /** 213 * Adds a active/edit layer change listener. Fire a fake active-layer-changed-event right after adding 213 * Adds an active/edit layer change listener. Fire a fake active-layer-changed-event right after adding 214 214 * the listener. The previous layers will be null. The listener is notified in the current thread. 215 215 * @param listener the listener. -
trunk/src/org/openstreetmap/josm/gui/layer/ValidatorLayer.java
r16766 r18801 101 101 .collect(Collectors.joining()); 102 102 103 if (b. length() == 0)103 if (b.isEmpty()) 104 104 return "<html>" + tr("No validation errors") + "</html>"; 105 105 else -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DateFilterPanel.java
r17845 r18801 107 107 108 108 /** 109 * If possible, load date ra gne and "zero timestamp" option from preferences109 * If possible, load date range and "zero timestamp" option from preferences 110 110 * Called by other components when it is needed. 111 111 */ -
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r18211 r18801 10 10 import java.util.ArrayList; 11 11 import java.util.Arrays; 12 import java.util.Collection;13 12 import java.util.Comparator; 13 import java.util.List; 14 14 import java.util.stream.Collectors; 15 15 … … 126 126 boolean hasTracks = !Utils.isEmpty(layer.data.tracks); 127 127 boolean hasWaypoints = !Utils.isEmpty(layer.data.waypoints); 128 Collection<WayPoint> waypoints = new ArrayList<>();128 List<WayPoint> waypoints = new ArrayList<>(); 129 129 boolean timedMarkersOmitted = false; 130 130 boolean untimedMarkersOmitted = false; … … 273 273 274 274 // we must have got at least one waypoint now 275 ((ArrayList<WayPoint>)waypoints).sort(Comparator.naturalOrder());275 waypoints.sort(Comparator.naturalOrder()); 276 276 277 277 firstTime = -1.0; // this time of the first waypoint, not first trackpoint -
trunk/src/org/openstreetmap/josm/gui/layer/imagery/ColorfulFilter.java
r17983 r18801 17 17 18 18 import org.openstreetmap.josm.tools.Logging; 19 import org.openstreetmap.josm.tools.Utils; 19 20 20 21 /** … … 211 212 private int mixInt(int color, double luminosity) { 212 213 int val = (int) (colorfulness * color + (1 - colorfulness) * luminosity); 213 if (val < 0) { 214 return 0; 215 } else if (val > 0xff) { 216 return 0xff; 217 } else { 218 return val; 219 } 214 return Utils.clamp(val, 0, 0xff); 220 215 } 221 216 -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
r18414 r18801 212 212 /** 213 213 * Create a new float operation that compares two float values 214 * @param comparatorResult A function to map tthe result of the comparison214 * @param comparatorResult A function to map the result of the comparison 215 215 */ 216 216 Op(IntFunction<Boolean> comparatorResult) { … … 830 830 */ 831 831 static boolean unclosed_multipolygon(Environment e) { 832 return e.osm instanceof Relation && ((Relation) e.osm).isMultipolygon() &&832 return e.osm instanceof Relation && e.osm.isMultipolygon() && 833 833 !e.osm.isIncomplete() && !((Relation) e.osm).hasIncompleteMembers() && 834 834 !MultipolygonCache.getInstance().get((Relation) e.osm).getOpenEnds().isEmpty(); -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSParser.jj
r18757 r18801 712 712 { 713 713 boolean not = false; 714 KeyMatchType matchType = null; ;714 KeyMatchType matchType = null; 715 715 String key; 716 716 } … … 733 733 float f; 734 734 int i; 735 KeyMatchType matchType = null; ;735 KeyMatchType matchType = null; 736 736 Op op; 737 737 boolean considerValAsKey = false; -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/MapCSSStyleIndex.java
r16784 r18801 149 149 } 150 150 } else if (p instanceof IRelation) { 151 if ( ((IRelation<?>) p).isMultipolygon()) {151 if (p.isMultipolygon()) { 152 152 return multipolygonRules; 153 153 } else if (p.hasKey("#canvas")) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/styleelement/NodeElement.java
r18502 r18801 380 380 StringBuilder s = new StringBuilder(64).append("NodeElement{").append(super.toString()); 381 381 if (mapImage != null) { 382 s.append(" icon=[" +mapImage+']');382 s.append(" icon=[").append(mapImage).append(']'); 383 383 } 384 384 if (mapImage != null && mapImageAngle != null) { 385 s.append(" mapImageAngle=[" +mapImageAngle+']');385 s.append(" mapImageAngle=[").append(mapImageAngle).append(']'); 386 386 } 387 387 if (symbol != null) { 388 s.append(" symbol=[" + symbol +']');388 s.append(" symbol=[").append(symbol).append(']'); 389 389 } 390 390 s.append('}'); -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r17972 r18801 199 199 for (String setCookie: setCookies) { 200 200 String[] kvPairs = setCookie.split(";", -1); 201 if (kvPairs.length == 0) {202 continue;203 }204 201 for (String kvPair : kvPairs) { 205 202 kvPair = kvPair.trim(); -
trunk/src/org/openstreetmap/josm/gui/preferences/ToolbarPreferences.java
r18471 r18801 1250 1250 if (sc.getAssignedKey() == KeyEvent.CHAR_UNDEFINED) { 1251 1251 sc = null; 1252 } 1252 } 1253 1253 } 1254 1254 -
trunk/src/org/openstreetmap/josm/gui/preferences/advanced/AbstractTableListEditor.java
r16960 r18801 108 108 TableCellEditor editor = table.getCellEditor(); 109 109 if (editor != null) { 110 ((DefaultCellEditor) editor).stopCellEditing();110 editor.stopCellEditing(); 111 111 } 112 112 if (entryList.getSelectedIndices().length != 1) { -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreference.java
r17865 r18801 223 223 JOptionPane.showMessageDialog(gui, tr("Please select the row to delete.")); 224 224 } else { 225 Integeri;225 int i; 226 226 while ((i = list.getSelectedRow()) != -1) { 227 227 model.removeRow(i); -
trunk/src/org/openstreetmap/josm/gui/preferences/imagery/ImageryProvidersPanel.java
r18367 r18801 515 515 @Override 516 516 public void actionPerformed(ActionEvent e) { 517 Integeri;517 int i; 518 518 while ((i = activeTable.getSelectedRow()) != -1) { 519 519 activeModel.removeRow(i); -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginPreferencesModel.java
r18213 r18801 145 145 146 146 /** 147 * Replies the list of selected plugin information objects148 * 149 * @return the list of selected plugin information objects147 * Replies the set of selected plugin information objects 148 * 149 * @return the set of selected plugin information objects 150 150 */ 151 151 public Set<String> getSelectedPluginNames() { … … 264 264 265 265 /** 266 * Replies the set of plugins which have been added by the user to266 * Replies the list of plugins which have been added by the user to 267 267 * the set of activated plugins. 268 268 * 269 * @return the set of newly activated plugins269 * @return the list of newly activated plugins 270 270 */ 271 271 public List<PluginInformation> getNewlyActivatedPlugins() { … … 282 282 283 283 /** 284 * Replies the set of plugins which have been removed by the user from284 * Replies the list of plugins which have been removed by the user from 285 285 * the set of deactivated plugins. 286 286 * 287 * @return the set of newly deactivated plugins287 * @return the list of newly deactivated plugins 288 288 */ 289 289 public List<PluginInformation> getNewlyDeactivatedPlugins() { … … 295 295 296 296 /** 297 * Replies the set of all available plugins.298 * 299 * @return the set of all available plugins297 * Replies the list of all available plugins. 298 * 299 * @return the list of all available plugins 300 300 */ 301 301 public List<PluginInformation> getAvailablePlugins() { -
trunk/src/org/openstreetmap/josm/gui/preferences/plugin/PluginUpdatePolicyPanel.java
r16438 r18801 187 187 188 188 /** 189 * Remebers the update policy preference settings on the JOSM preferences 189 * Remembers the update policy preference settings on the JOSM preferences 190 190 */ 191 191 public void rememberInPreferences() { -
trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java
r18436 r18801 97 97 int i = field.getInt(null); 98 98 String s = KeyEvent.getKeyText(i); 99 if (s != null && s.length() > 0&& !s.contains(unknown)) {99 if (s != null && !s.isEmpty() && !s.contains(unknown)) { 100 100 list.put(Integer.valueOf(i), s); 101 101 } -
trunk/src/org/openstreetmap/josm/gui/progress/ProgressMonitor.java
r12369 r18801 76 76 77 77 /** 78 * Can be used if method receive ProgressMonitor but it's not interested progress monitoring. 78 * Can be used if method receives ProgressMonitor, but it's not interested progress monitoring. 79 79 * Basically replaces {@link #beginTask(String)} and {@link #finishTask()} 80 80 * 81 * This method can be also used in finally section if method expects that some exception 81 * This method can be also used in finally section if method expects that some exceptions 82 82 * might prevent it from passing progressMonitor away. If {@link #beginTask(String)} was 83 83 * already called then this method does nothing. -
trunk/src/org/openstreetmap/josm/gui/progress/swing/PleaseWaitProgressMonitor.java
r17333 r18801 107 107 108 108 private void doInEDT(Runnable runnable) { 109 // This must be invoke later even if current thread is EDT because inside there is dialog.setVisible 109 // This must be invoked later even if current thread is EDT because inside there is dialog.setVisible 110 110 // which freeze current code flow until modal dialog is closed 111 111 SwingUtilities.invokeLater(() -> { -
trunk/src/org/openstreetmap/josm/gui/tagging/TagEditorModel.java
r18283 r18801 531 531 public List<String> getKeys() { 532 532 return tags.stream() 533 .filter(tag -> !Utils.isStripEmpty(tag.getName()))534 533 .map(TagModel::getName) 534 .filter(name -> !Utils.isStripEmpty(name)) 535 535 .collect(Collectors.toList()); 536 536 } -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompEvent.java
r18221 r18801 5 5 6 6 /** 7 * This event is generated by an AutoCompTextField when an autocomplete occured. 7 * This event is generated by an AutoCompTextField when an autocomplete occurred. 8 8 * 9 9 * @see AutoCompTextField -
trunk/src/org/openstreetmap/josm/gui/tagging/ac/AutoCompletionManager.java
r18305 r18801 15 15 import java.util.Objects; 16 16 import java.util.Set; 17 import java.util.function.Function;18 17 import java.util.stream.Collectors; 19 18 … … 42 41 import org.openstreetmap.josm.gui.tagging.presets.TaggingPreset; 43 42 import org.openstreetmap.josm.gui.tagging.presets.TaggingPresets; 44 import org.openstreetmap.josm.gui.tagging.presets.items.Roles.Role;45 43 import org.openstreetmap.josm.tools.CheckParameterUtil; 46 44 import org.openstreetmap.josm.tools.MultiMap; … … 294 292 for (TaggingPreset tp : presets) { 295 293 if (tp.roles != null) { 296 list.add(Utils.transform(tp.roles.roles, (Function<Role, String>)x -> x.key), AutoCompletionPriority.IS_IN_STANDARD);294 list.add(Utils.transform(tp.roles.roles, x -> x.key), AutoCompletionPriority.IS_IN_STANDARD); 297 295 } 298 296 } … … 427 425 * @param keys the tag keys 428 426 * @param comparator the custom comparator used to sort the list 429 * @return a set of tag values427 * @return a list of tag values 430 428 * @since 12859 431 429 */ -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetItemGuiSupport.java
r18260 r18801 25 25 26 26 private final Collection<OsmPrimitive> selected; 27 /** True if all selected primitives matched this preset at the moment it was opene nd. */27 /** True if all selected primitives matched this preset at the moment it was opened. */ 28 28 private final boolean presetInitiallyMatches; 29 29 private final Supplier<Collection<Tag>> changedTagsSupplier; -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/ComboMultiSelect.java
r18260 r18801 11 11 import java.util.Arrays; 12 12 import java.util.Collection; 13 import java.util.Collections;14 13 import java.util.List; 15 14 import java.util.Map; … … 154 153 * must be escaped within one entry 155 154 * @param s the string 156 * @return split teditems155 * @return split items 157 156 */ 158 157 public static List<String> splitEscaped(char delimiter, String s) { … … 312 311 313 312 if (values_sort && TaggingPresets.SORT_MENU.get()) { 314 Collections.sort(presetListEntries,(a, b) -> AlphanumComparator.getInstance().compare(a.getDisplayValue(), b.getDisplayValue()));313 presetListEntries.sort((a, b) -> AlphanumComparator.getInstance().compare(a.getDisplayValue(), b.getDisplayValue())); 315 314 } 316 315 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetLink.java
r18221 r18801 46 46 47 47 /** 48 * Creates a label to be inserted abo ive this link48 * Creates a label to be inserted above this link 49 49 * @return a label 50 50 */ -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/PresetListEntry.java
r18648 r18801 76 76 * 77 77 * This is the contents that would be displayed in the current view plus a short description to 78 * aid the user. sis wrapped to {@code width}.78 * aid the user. The whole content is wrapped to {@code width}. 79 79 * 80 80 * @param width the width in px … … 83 83 public String getListDisplay(int width) { 84 84 String displayValue = getDisplayValue(); 85 Integercount = getCount();85 int count = getCount(); 86 86 87 87 if (count > 0 && cms.usage.getSelectedCount() > 1) { -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/items/Text.java
r18313 r18801 79 79 keys.add(key); 80 80 if (alternative_autocomplete_keys != null) { 81 for (String k : alternative_autocomplete_keys.split(",", -1)) { 82 keys.add(k); 83 } 81 Collections.addAll(keys, alternative_autocomplete_keys.split(",", -1)); 84 82 } 85 83 getAllForKeys(keys).forEach(model::addElement); … … 270 268 * Set the value template. 271 269 * @param pattern The value_template pattern. 272 * @throws SAXException If an error occured while parsing. 270 * @throws SAXException If an error occurred while parsing. 273 271 */ 274 272 public void setValue_template(String pattern) throws SAXException { // NOPMD -
trunk/src/org/openstreetmap/josm/gui/util/imagery/Vector3D.java
r18255 r18801 138 138 139 139 /** 140 * Get the polar angle cos sine (inclination)140 * Get the polar angle cosine (inclination) 141 141 * 142 142 * @return The polar angle cosine -
trunk/src/org/openstreetmap/josm/gui/widgets/AbstractFileChooser.java
r18113 r18801 81 81 * Returns a list of selected files if the file chooser is 82 82 * set to allow multiple selection. 83 * @return a listof selected files if the file chooser is83 * @return an array of selected files if the file chooser is 84 84 * set to allow multiple selection, or an empty array otherwise. 85 85 */ … … 98 98 * If false, the <code>AcceptAll</code> file filter is removed from 99 99 * the list of available file filters. 100 * If true, the <code>AcceptAll</code> file filter will become the100 * If true, the <code>AcceptAll</code> file filter will become 101 101 * the actively used file filter. 102 102 * @param b whether the <code>AcceptAll FileFilter</code> is used -
trunk/src/org/openstreetmap/josm/gui/widgets/MultiSplitLayout.java
r16630 r18801 119 119 120 120 /** 121 * Replies listof property change listeners.122 * @return listof property change listeners121 * Replies array of property change listeners. 122 * @return array of property change listeners 123 123 */ 124 124 public PropertyChangeListener[] getPropertyChangeListeners() { … … 1065 1065 StringBuilder sb = new StringBuilder("MultiSplitLayout.Split"); 1066 1066 sb.append(isRowLayout() ? " ROW [" : " COLUMN [") 1067 .append(nChildren + ((nChildren == 1) ? " child" : " children")) 1067 .append(nChildren) 1068 .append((nChildren == 1) ? " child" : " children") 1068 1069 .append("] ") 1069 1070 .append(getBounds()); -
trunk/src/org/openstreetmap/josm/io/ChangesetQuery.java
r18208 r18801 265 265 * <code>d</code> d is a date relative to the current time zone. 266 266 * 267 * @param d the date 267 * @param d the date. Must not be null. 268 268 * @return the restricted changeset query 269 269 * @throws IllegalArgumentException if d is null … … 570 570 * see <a href="http://wiki.openstreetmap.org/wiki/API_v0.6#Query:_GET_.2Fapi.2F0.6.2Fchangesets">OSM API</a>. 571 571 * 572 * Example for a nquery string:<br>572 * Example for a query string:<br> 573 573 * <pre> 574 574 * uid=1234&open=true -
trunk/src/org/openstreetmap/josm/io/DefaultProxySelector.java
r18663 r18801 60 60 * is defined <strong>at startup</strong>. It has no effect if the property is set 61 61 * later by the application. 62 * 63 * We therefore read the property at class loading time and remember it 's value.62 * <p> 63 * We therefore read the property at class loading time and remember its value. 64 64 */ 65 65 private static boolean jvmWillUseSystemProxies; -
trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java
r18623 r18801 105 105 /** 106 106 * Postprocesses the diff result read and parsed from the server. 107 * 107 * <p> 108 108 * Uploaded objects are assigned their new id (if they got assigned a new 109 109 * id by the server), their new version (if the version was incremented), -
trunk/src/org/openstreetmap/josm/io/IGpxReader.java
r18179 r18801 33 33 34 34 /** 35 * Returns the number of coordinates that have been successfuly read. 36 * @return the number of coordinates that have been successfuly read 35 * Returns the number of coordinates that have been successfully read. 36 * @return the number of coordinates that have been successfully read 37 37 * @since 18179 38 38 */ -
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r18779 r18801 809 809 errorHeader = response.getHeaderField("Error"); 810 810 Logging.error("Error header: " + errorHeader); 811 } else if (retCode != HttpURLConnection.HTTP_OK && responseBody. length() > 0) {811 } else if (retCode != HttpURLConnection.HTTP_OK && !responseBody.isEmpty()) { 812 812 Logging.error("Error body: " + responseBody); 813 813 } … … 815 815 816 816 errorHeader = errorHeader == null ? null : errorHeader.trim(); 817 String errorBody = responseBody. length() == 0? null : responseBody.trim();817 String errorBody = responseBody.isEmpty() ? null : responseBody.trim(); 818 818 switch(retCode) { 819 819 case HttpURLConnection.HTTP_OK: -
trunk/src/org/openstreetmap/josm/io/OsmReader.java
r18695 r18801 487 487 488 488 /** 489 * Exception thrown after user cancelation. 489 * Exception thrown after user cancellation. 490 490 */ 491 491 private static final class OsmParsingCanceledException extends XmlStreamParsingException implements ImportCancelException { -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r18780 r18801 509 509 } 510 510 // TODO should we handle also POST? 511 if ("GET".equalsIgnoreCase(mode) && getMapUrl != null && ! "".equals(getMapUrl)) {511 if ("GET".equalsIgnoreCase(mode) && getMapUrl != null && !getMapUrl.isEmpty()) { 512 512 try { 513 513 String query = new URL(getMapUrl).getQuery(); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/RequestHandler.java
r18211 r18801 160 160 161 161 /** 162 * Returns usage examples for the given command. To be overriden only my handlers that define several commands. 162 * Returns usage examples for the given command. To be overridden only my handlers that define several commands. 163 163 * @param cmd The command asked 164 164 * @return Usage examples for the given command … … 203 203 if (GLOBAL_CONFIRMATION.get()) { 204 204 // Ensure dialog box does not exceed main window size 205 IntegermaxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth()*0.6);205 int maxWidth = (int) Math.max(200, MainApplication.getMainFrame().getWidth() * 0.6); 206 206 String message = "<html><div>" + getPermissionMessage() + 207 207 "<br/>" + tr("Do you want to allow this?") + "</div></html>"; … … 357 357 DownloadParams result = new DownloadParams(); 358 358 if (args != null) { 359 result = result 360 .withNewLayer(isLoadInNewLayer()) 361 .withLayerName(args.get("layer_name")) 362 .withLocked(get("layer_locked")) 363 .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL)) 364 .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL)); 359 result.withNewLayer(isLoadInNewLayer()) 360 .withLayerName(args.get("layer_name")) 361 .withLocked(get("layer_locked")) 362 .withDownloadPolicy(get("download_policy", DownloadPolicy::of, () -> DownloadPolicy.NORMAL)) 363 .withUploadPolicy(get("upload_policy", UploadPolicy::of, () -> UploadPolicy.NORMAL)); 365 364 } 366 365 return result; … … 498 497 499 498 /** 500 * Handler that takes a n URL asparameter.499 * Handler that takes a URL as a parameter. 501 500 */ 502 501 public abstract static class RawURLParseRequestHandler extends RequestHandler { -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r18792 r18801 14 14 import java.awt.event.ActionEvent; 15 15 import java.io.File; 16 import java.io.FilenameFilter;17 16 import java.io.IOException; 18 17 import java.net.MalformedURLException; … … 468 467 long tim = System.currentTimeMillis(); 469 468 long last = Config.getPref().getLong("pluginmanager.lastupdate", 0); 470 IntegermaxTime = Config.getPref().getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL);469 int maxTime = Config.getPref().getInt("pluginmanager.time-based-update.interval", DEFAULT_TIME_BASED_UPDATE_INTERVAL); 471 470 long d = TimeUnit.MILLISECONDS.toDays(tim - last); 472 471 if ((last <= 0) || (maxTime <= 0)) { … … 977 976 * 978 977 * @param monitor the progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null. 979 * @return the listof locally available plugin information, null in case of errors978 * @return the map of locally available plugin information, null in case of errors 980 979 * 981 980 */ … … 1028 1027 1029 1028 /** 1030 * Builds the set of plugins to load. Deprecated and unmaintained plugins are filtered1029 * Builds the list of plugins to load. Deprecated and unmaintained plugins are filtered 1031 1030 * out. This involves user interaction. This method displays alert and confirmation 1032 1031 * messages. … … 1034 1033 * @param parent The parent component to be used for the displayed dialog 1035 1034 * @param monitor the progress monitor. Defaults to {@link NullProgressMonitor#INSTANCE} if null. 1036 * @return the set of plugins to load (as set of plugin names)1035 * @return the list of plugins to load (as set of plugin names) 1037 1036 */ 1038 1037 public static List<PluginInformation> buildListOfPluginsToLoad(Component parent, ProgressMonitor monitor) { … … 1349 1348 return; 1350 1349 1351 final File[] files = pluginDir.listFiles(( FilenameFilter) (dir, name) -> name.endsWith(".jar.new"));1350 final File[] files = pluginDir.listFiles((dir, name) -> name.endsWith(".jar.new")); 1352 1351 if (files == null) 1353 1352 return; -
trunk/src/org/openstreetmap/josm/tools/ColorScale.java
r18738 r18801 249 249 fh = fm.getHeight()/2; 250 250 if (colorBarTitles != null && colorBarTitles.length > 0) { 251 fw = Arrays. asList(colorBarTitles).stream().mapToInt(title -> fm.stringWidth(title)).max().orElse(50);251 fw = Arrays.stream(colorBarTitles).mapToInt(fm::stringWidth).max().orElse(50); 252 252 } else { 253 253 fw = fm.stringWidth( -
trunk/src/org/openstreetmap/josm/tools/Destroyable.java
r10600 r18801 4 4 /** 5 5 * Some objects like layers (when they are removed) or the whole map frame (when the last layer has 6 * been removed) have a ndefinite set of actions to execute. This is the "destructor" interface called6 * been removed) have a definite set of actions to execute. This is the "destructor" interface called 7 7 * on those objects. 8 8 * -
trunk/src/org/openstreetmap/josm/tools/Geometry.java
r18675 r18801 97 97 * Will be filled with commands that add intersection nodes to 98 98 * the ways. 99 * @return list of new nodes, if test is true the list might not contain all intersections99 * @return set of new nodes, if test is true the list might not contain all intersections 100 100 */ 101 101 public static Set<Node> addIntersections(List<Way> ways, boolean test, List<Command> cmds) { … … 131 131 List<Node> way2Nodes = newNodes[seg2Way]; 132 132 133 //iterate over primary segme mt133 //iterate over primary segment 134 134 for (int seg1Pos = 0; seg1Pos + 1 < way1Nodes.size(); seg1Pos++) { 135 135 … … 351 351 352 352 /** 353 * Get the segment 353 * Get the segment-segment intersection of two line segments 354 354 * @param x1 The x coordinate of the first point (first segment) 355 355 * @param y1 The y coordinate of the first point (first segment) … … 833 833 if (osm instanceof Way && ((Way) osm).isClosed()) { 834 834 return closedWayArea((Way) osm); 835 } else if (osm instanceof Relation && ((Relation) osm).isMultipolygon() && !((Relation) osm).hasIncompleteMembers()) {835 } else if (osm instanceof Relation && osm.isMultipolygon() && !((Relation) osm).hasIncompleteMembers()) { 836 836 return multipolygonArea((Relation) osm); 837 837 } else { … … 922 922 923 923 /** 924 * Get angles in radians and return it 's value in range [0, 180].924 * Get angles in radians and return its value in range [0, 180]. 925 925 * 926 926 * @param angle the angle in radians … … 993 993 994 994 /** 995 * Compute center of the circle closest to different nodes. 995 * Compute the center of the circle closest to different nodes. 996 996 * 997 997 * Ensure exact center computation in case nodes are already aligned in circle. -
trunk/src/org/openstreetmap/josm/tools/GuiSizesHelper.java
r16486 r18801 11 11 * Support class to handle size information of Gui elements 12 12 * This is needed, because display resolution may vary a lot and a common set 13 * of sizes wont work for all users alike. 13 * of sizes won't work for all users alike. 14 14 * @since 12682 (moved from {@code gui.util} package) 15 15 * @since 10358 … … 22 22 23 23 /** cache value for screen resolution */ 24 private static float screenDPI = -1; 24 private static volatile float screenDPI = -1; 25 25 26 26 /** -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r18656 r18801 36 36 37 37 /** 38 * Provides auniform access for a HTTP/HTTPS server. This class should be used in favour of {@link HttpURLConnection}.38 * Provides uniform access for a HTTP/HTTPS server. This class should be used in favour of {@link HttpURLConnection}. 39 39 * @since 9168 40 40 */ -
trunk/src/org/openstreetmap/josm/tools/OptionParser.java
r16913 r18801 280 280 281 281 /** 282 * Called once if the parameter is encountered, afer basic validation. 282 * Called once if the parameter is encountered, after basic validation. 283 283 * @param parameter The parameter if {@link #requiresParameter()} is true, <code>null</code> otherwise. 284 284 */ -
trunk/src/org/openstreetmap/josm/tools/PlatformHookWindows.java
r18580 r18801 487 487 Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value); 488 488 } 489 w.append(key + '=' + value +'\n');489 w.append(key).append('=').append(value).append('\n'); 490 490 } 491 491 w.append('\n'); … … 500 500 Logging.warn("extended font config - overriding ''{0}={1}'' with ''{2}''", key, prevValue, value); 501 501 } 502 w.append(key + '=' + value +'\n');502 w.append(key).append('=').append(value).append('\n'); 503 503 } 504 504 w.append('\n'); -
trunk/src/org/openstreetmap/josm/tools/Shortcut.java
r18116 r18801 267 267 if (keyStroke == null) return ""; 268 268 String modifText = KeyEvent.getModifiersExText(keyStroke.getModifiers()); 269 if ( "".equals(modifText)) return KeyEvent.getKeyText(keyStroke.getKeyCode());269 if (modifText.isEmpty()) return KeyEvent.getKeyText(keyStroke.getKeyCode()); 270 270 return modifText + '+' + KeyEvent.getKeyText(keyStroke.getKeyCode()); 271 271 } … … 522 522 private static Shortcut registerShortcut(String shortText, String longText, int requestedKey, int requestedGroup, Integer modifier) { 523 523 doInit(); 524 IntegerdefaultModifier = findModifier(requestedGroup, modifier);524 int defaultModifier = findModifier(requestedGroup, modifier); 525 525 final Optional<Shortcut> existing = findShortcutByKeyOrShortText(requestedKey, defaultModifier, shortText); 526 526 if (existing.isPresent() && shortText.equals(existing.get().getShortText())) { -
trunk/src/org/openstreetmap/josm/tools/Territories.java
r18723 r18801 200 200 for (JsonValue feature : json.getObject().getJsonArray("features")) { 201 201 ofNullable(feature.asJsonObject().getJsonObject("properties")).ifPresent(props -> 202 ofNullable(props.getJsonObject("urls")). ifPresent(urls ->203 ofNullable(urls.getString(TAGINFO)).ifPresent(taginfo -> { 202 ofNullable(props.getJsonObject("urls")).flatMap(urls -> 203 ofNullable(urls.getString(TAGINFO))).ifPresent(taginfo -> { 204 204 JsonArray iso1 = props.getJsonArray(ISO3166_1_LC); 205 205 JsonArray iso2 = props.getJsonArray(ISO3166_2_LC); … … 209 209 readExternalTaginfo(taginfoGeofabrikCache, taginfo, iso2, source); 210 210 } 211 })) );211 })); 212 212 } 213 213 } -
trunk/src/org/openstreetmap/josm/tools/TextAnalyzer.java
r13544 r18801 82 82 s.append(c); // just add ", not open 83 83 } else { 84 s.delete(0, s.length()); // forget that empty charact hers and start reading "....84 s.delete(0, s.length()); // forget that empty characters and start reading ".... 85 85 quotesStarted = true; 86 86 } -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r18580 r18801 174 174 175 175 /** 176 * Return the modulus in the range [0, n) 177 * @param a dividend 178 * @param n divisor 179 * @return modulo (remainder of the Euclidian division of a by n) 176 * Returns the modulo in the range [0, n) for the given dividend and divisor. 177 * @param a the dividend 178 * @param n the divisor 179 * @return the modulo, which is the remainder of the Euclidean division of a by n, in the range [0, n) 180 * @throws IllegalArgumentException if n is less than or equal to 0 180 181 */ 181 182 public static int mod(int a, int n) { 182 183 if (n <= 0) 183 throw new IllegalArgumentException("n must be <= 0 but is " +n);184 throw new IllegalArgumentException("n must be <= 0 but is " + n); 184 185 int res = a % n; 185 186 if (res < 0) { … … 290 291 * @param in The source directory 291 292 * @param out The destination directory 292 * @throws IOException if any I/O error o occurs293 * @throws IOException if any I/O error occurs 293 294 * @throws IllegalArgumentException if {@code in} or {@code out} is {@code null} 294 295 * @since 7835 … … 1005 1006 1006 1007 /** 1007 * Cast an object sa vely.1008 * Cast an object safely. 1008 1009 * @param <T> the target type 1009 1010 * @param o the object to cast … … 1088 1089 * @param <T> type of elements 1089 1090 * @param elements collection to shorten 1090 * @param maxElements maximum number of elements to keep (including includingthe {@code overflowIndicator})1091 * @param maxElements maximum number of elements to keep (including the {@code overflowIndicator}) 1091 1092 * @param overflowIndicator the element used to indicate that the collection has been shortened 1092 1093 * @return the shortened collection … … 1762 1763 int pPos = version.indexOf('+'); 1763 1764 try { 1764 return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1 , version.length()));1765 return Integer.parseInt(version.substring(bPos > -1 ? bPos + 1 : pPos + 1)); 1765 1766 } catch (NumberFormatException e) { 1766 1767 Logging.trace(e); … … 1828 1829 /** 1829 1830 * Determines if a class can be found for the given name. 1830 * @param className class n mae to find1831 * @param className class name to find 1831 1832 * @return {@code true} if the class can be found, {@code false} otherwise 1832 1833 * @since 17692 … … 1921 1922 1922 1923 /** 1923 * Convenient method to open an URL stream, using JOSM HTTP client if nee eded.1924 * Convenient method to open an URL stream, using JOSM HTTP client if needed. 1924 1925 * @param url URL for reading from 1925 1926 * @return an input stream for reading from the URL -
trunk/src/org/openstreetmap/josm/tools/WikiReader.java
r16436 r18801 137 137 // add a border="0" attribute to images, otherwise the internal help browser 138 138 // will render a thick border around images inside an <a> element 139 // remove width information to avoid distor ded images (fix #11262)139 // remove width information to avoid distorted images (fix #11262) 140 140 b.append(line.replace("<img ", "<img border=\"0\" ") 141 141 .replaceAll("width=\"(\\d+)\"", "") -
trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java
r13206 r18801 5 5 6 6 import java.util.ArrayList; 7 import java.util.Arrays;8 7 import java.util.Collection; 8 import java.util.Collections; 9 9 import java.util.List; 10 10 … … 21 21 private final Tokenizer tokenizer; 22 22 23 private static final Collection<TokenType> EXPRESSION_END_TOKENS = Arrays.asList(TokenType.EOF);24 private static final Collection<TokenType> CONDITION_WITH_APOSTROPHES_END_TOKENS = Arrays.asList(TokenType.APOSTROPHE);23 private static final Collection<TokenType> EXPRESSION_END_TOKENS = Collections.singletonList(TokenType.EOF); 24 private static final Collection<TokenType> CONDITION_WITH_APOSTROPHES_END_TOKENS = Collections.singletonList(TokenType.APOSTROPHE); 25 25 26 26 /** -
trunk/test/unit/org/openstreetmap/josm/data/protobuf/ProtobufPackedTest.java
r18695 r18801 3 3 4 4 import static org.junit.jupiter.api.Assertions.assertArrayEquals; 5 6 import java.io.ByteArrayOutputStream;7 5 8 6 import org.junit.jupiter.api.Test; … … 14 12 @Test 15 13 void testSingleByteNumbers() { 16 long[] numbers = new ProtobufPacked( new ByteArrayOutputStream(),ProtobufTest.toByteArray(new int[]{0, 0, 1, 1, 2, 2, 3, 3, 4, 4}))14 long[] numbers = new ProtobufPacked(ProtobufTest.toByteArray(new int[]{0, 0, 1, 1, 2, 2, 3, 3, 4, 4})) 17 15 .getArray(); 18 16 assertArrayEquals(new long[] {0, 0, 1, 1, 2, 2, 3, 3, 4, 4}, numbers); … … 22 20 void testMultipleByteNumbers() { 23 21 byte[] bytes = ProtobufTest.toByteArray(new int[] {-128, 64, -18, 49, -70, 3}); 24 long[] numbers = new ProtobufPacked( new ByteArrayOutputStream(),bytes).getArray();22 long[] numbers = new ProtobufPacked(bytes).getArray(); 25 23 assertArrayEquals(new long[] {8192, 6382, 442}, numbers); 26 24 } -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/DirectionNodesTest.java
r18690 r18801 10 10 11 11 /** 12 * JUnit Test of Multipolygonvalidation test.12 * JUnit Test of {@link DirectionNodes} validation test. 13 13 */ 14 14 class DirectionNodesTest { 15 16 15 17 16 /** … … 27 26 */ 28 27 @Test 29 void testDirection sNodesTestFile() throws Exception {28 void testDirectionNodesTestFile() throws Exception { 30 29 final DirectionNodes test = new DirectionNodes(); 31 30 ValidatorTestUtils.testSampleFile("nodist/data/direction-nodes.osm", DataSet::getNodes, null, test); -
trunk/test/unit/org/openstreetmap/josm/data/validation/tests/SelfIntersectingWayTest.java
r18690 r18801 23 23 24 24 /** 25 * JUnit Test of Multipolygonvalidation test.25 * JUnit Test of {@link SelfIntersectingWay} validation test. 26 26 */ 27 27 class SelfIntersectingWayTest { -
trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
r18037 r18801 7 7 8 8 import java.io.ByteArrayInputStream; 9 import java.io.File;10 9 import java.io.FileInputStream; 11 10 import java.io.IOException; … … 39 38 public static GpxData parseGpxData(String filename) throws IOException, SAXException { 40 39 final GpxData result; 41 try (FileInputStream in = new FileInputStream( new File(filename))) {40 try (FileInputStream in = new FileInputStream(filename)) { 42 41 GpxReader reader = new GpxReader(in); 43 42 assertTrue(reader.parse(false)); -
trunk/test/unit/org/openstreetmap/josm/testutils/mockers/EDTAssertionMocker.java
r17090 r18801 17 17 final Throwable cause = t.getCause(); 18 18 if (cause instanceof AssertionError) { 19 throw (AssertionError)cause;19 throw cause; 20 20 } 21 21
Note:
See TracChangeset
for help on using the changeset viewer.