Changeset 19535 in josm
- Timestamp:
- 2026-02-20T11:51:47+01:00 (10 hours ago)
- Location:
- trunk
- Files:
-
- 38 edited
-
src/org/openstreetmap/josm/data/UndoRedoHandler.java (modified) (1 diff)
-
src/org/openstreetmap/josm/data/cache/JCSCacheManager.java (modified) (1 diff)
-
src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/Layer.java (modified) (1 diff)
-
src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java (modified) (1 diff)
-
src/org/openstreetmap/josm/data/osm/OsmPrimitive.java (modified) (1 diff)
-
src/org/openstreetmap/josm/data/validation/OsmValidator.java (modified) (1 diff)
-
src/org/openstreetmap/josm/data/vector/VectorPrimitive.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/datatransfer/ClipboardUtils.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandler.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/io/importexport/FileImporter.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/layer/AutosaveTask.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java (modified) (2 diffs)
-
src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java (modified) (2 diffs)
-
src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/progress/swing/PleaseWaitProgressMonitor.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/util/GuiHelper.java (modified) (1 diff)
-
src/org/openstreetmap/josm/gui/widgets/JosmPasswordField.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/Compression.java (modified) (4 diffs)
-
src/org/openstreetmap/josm/io/GeoJSONServerReader.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/GpxParser.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/GpxReader.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/NameFinder.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/OsmJsonReader.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/OsmServerLocationReader.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/imagery/WMSImagery.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java (modified) (2 diffs)
-
src/org/openstreetmap/josm/io/session/GpxTracksSessionExporter.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java (modified) (1 diff)
-
src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java (modified) (1 diff)
-
src/org/openstreetmap/josm/plugins/PluginClassLoader.java (modified) (2 diffs)
-
src/org/openstreetmap/josm/plugins/PluginHandler.java (modified) (4 diffs)
-
src/org/openstreetmap/josm/tools/HttpClient.java (modified) (1 diff)
-
src/org/openstreetmap/josm/tools/ImageProvider.java (modified) (1 diff)
-
src/org/openstreetmap/josm/tools/bugreport/BugReport.java (modified) (1 diff)
-
src/org/openstreetmap/josm/tools/bugreport/ReportedException.java (modified) (2 diffs)
-
tools/pmd/josm-ruleset.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/UndoRedoHandler.java
r19050 r19535 380 380 try { 381 381 c.undoCommand(); 382 } catch (Exception e) { // NOPMD382 } catch (Exception e) { 383 383 // fix #20098: restore command stack as we will not fire an event 384 384 commands.add(c); -
trunk/src/org/openstreetmap/josm/data/cache/JCSCacheManager.java
r19462 r19535 200 200 diskAttributes, null, null, new StandardSerializer()))); 201 201 } 202 } catch (Exception e) { // NOPMD202 } catch (Exception e) { 203 203 // in case any error in setting auxiliary cache, do not use disk cache at all - only memory 204 204 cc.setAuxCaches(Collections.emptyList()); -
trunk/src/org/openstreetmap/josm/data/imagery/vectortile/mapbox/Layer.java
r19519 r19535 99 99 * @throws IOException - if an IO error occurs 100 100 */ 101 @SuppressWarnings("PMD.CloseResource") // The resources _are_ closed after use; it just isn't detect with PMD 7.2.x.102 101 public Layer(Collection<ProtobufRecord> records) throws IOException { 103 102 // Do the unique required fields first -
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r19331 r19535 794 794 795 795 @Override 796 @SuppressWarnings("PMD.UseArraysAsList") // See https://github.com/pmd/pmd/issues/5071797 796 public final Collection<String> keySet() { 798 797 String[] tKeys = this.keys; -
trunk/src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
r19528 r19535 658 658 return Stream.empty(); 659 659 } 660 final Stream<OsmPrimitive> stream = referrers instanceof OsmPrimitive // NOPMD660 final Stream<OsmPrimitive> stream = referrers instanceof OsmPrimitive 661 661 ? Stream.of((OsmPrimitive) referrers) 662 662 : Arrays.stream((OsmPrimitive[]) referrers); -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r19062 r19535 672 672 test.initialize(); 673 673 } 674 } catch (Exception e) { // NOPMD674 } catch (Exception e) { 675 675 String message = tr("Error initializing test {0}:\n {1}", test.getClass().getSimpleName(), e); 676 676 Logging.error(message); -
trunk/src/org/openstreetmap/josm/data/vector/VectorPrimitive.java
r19528 r19535 189 189 return Stream.empty(); 190 190 } 191 final Stream<IPrimitive> stream = referrers instanceof IPrimitive // NOPMD191 final Stream<IPrimitive> stream = referrers instanceof IPrimitive 192 192 ? Stream.of((IPrimitive) referrers) 193 193 : Arrays.stream((IPrimitive[]) referrers); -
trunk/src/org/openstreetmap/josm/gui/datatransfer/ClipboardUtils.java
r19531 r19535 117 117 Thread.currentThread().interrupt(); 118 118 } 119 } catch (NullPointerException | NoClassDefFoundError e) { // NOPMD119 } catch (NullPointerException | NoClassDefFoundError e) { 120 120 // JDK-6322854: On Linux/X11, NPE can happen for unknown reasons, on all versions of Java 121 121 // See #24642: Access can fail due to issues in ImageIO when an image is in clipboard -
trunk/src/org/openstreetmap/josm/gui/datatransfer/OsmTransferHandler.java
r19519 r19535 95 95 } catch (IllegalStateException e) { 96 96 Logging.debug(e); 97 } catch (NullPointerException e) { // NOPMD97 } catch (NullPointerException e) { 98 98 // JDK-6322854: On Linux/X11, NPE can happen for unknown reasons, on all versions of Java 99 99 Logging.error(e); -
trunk/src/org/openstreetmap/josm/gui/io/importexport/FileImporter.java
r19112 r19535 115 115 displayError(f, e); 116 116 return false; 117 } catch (RuntimeException | LinkageError e) { // NOPMD117 } catch (RuntimeException | LinkageError e) { 118 118 BugReportExceptionHandler.handleException(e); 119 119 return false; -
trunk/src/org/openstreetmap/josm/gui/layer/AutosaveTask.java
r19122 r19535 264 264 GuiHelper.runInEDT(this::displayNotification); 265 265 } 266 } catch (RuntimeException t) { // NOPMD266 } catch (RuntimeException t) { 267 267 // Don't let exception stop time thread 268 268 Logging.error("Autosave failed:"); -
trunk/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java
r19519 r19535 274 274 try { 275 275 argBounds = new Bounds(arg, ",", Bounds.ParseMethod.LEFT_BOTTOM_RIGHT_TOP, false); 276 } catch (IllegalArgumentException iae) { // NOPMD276 } catch (IllegalArgumentException iae) { 277 277 throw new OptionParseException( 278 278 tr("Unable to parse {0} parameter: {1}", "--bounds", iae.getMessage()), iae); … … 309 309 double lat = LatLonParser.parseCoordinate(parts[1]); 310 310 argAnchor = new LatLon(lat, lon); 311 } catch (IllegalArgumentException iae) { // NOPMD311 } catch (IllegalArgumentException iae) { 312 312 throw new OptionParseException(tr("In option {0}: {1}", "--anchor", iae.getMessage()), iae); 313 313 } -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r19335 r19535 675 675 } catch (SecurityException ex) { 676 676 Logging.error(ex); 677 } catch (RuntimeException ex) { // NOPMD677 } catch (RuntimeException ex) { 678 678 // allow to change most settings even if e.g. a plugin fails 679 679 BugReportExceptionHandler.handleException(ex); … … 696 696 } catch (SecurityException ex) { 697 697 Logging.error(ex); 698 } catch (RuntimeException ex) { // NOPMD698 } catch (RuntimeException ex) { 699 699 BugReportExceptionHandler.handleException(ex); 700 700 } finally { -
trunk/src/org/openstreetmap/josm/gui/preferences/map/MapPaintPreference.java
r18417 r19535 173 173 return css.title; 174 174 } 175 } catch (RuntimeException ignore) { // NOPMD175 } catch (RuntimeException ignore) { 176 176 Logging.debug(ignore); 177 177 } -
trunk/src/org/openstreetmap/josm/gui/progress/swing/PleaseWaitProgressMonitor.java
r18801 r19535 112 112 try { 113 113 runnable.run(); 114 } catch (RuntimeException e) { // NOPMD114 } catch (RuntimeException e) { 115 115 throw BugReport.intercept(e).put("monitor", this); 116 116 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java
r19374 r19535 128 128 * @return the last inserted element 129 129 */ 130 @SuppressWarnings("PMD.MissingOverride") // For Java >= 21 we can drop the whole class 130 131 public E getLast() { 131 132 return last; -
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r19112 r19535 268 268 try { 269 269 return callable.call(); 270 } catch (Exception e) { // NOPMD270 } catch (Exception e) { 271 271 handleEDTException(e); 272 272 return null; -
trunk/src/org/openstreetmap/josm/gui/widgets/JosmPasswordField.java
r14273 r19535 129 129 try { 130 130 pasteAction.actionPerformed(e); 131 } catch (NullPointerException npe) { // NOPMD131 } catch (NullPointerException npe) { 132 132 Logging.log(Logging.LEVEL_ERROR, "NullPointerException occurred because of JDK bug 6322854. " 133 133 +"Copy/Paste operation has not been performed. Please complain to Oracle: "+ -
trunk/src/org/openstreetmap/josm/io/Compression.java
r19500 r19535 178 178 public static InputStream getUncompressedFileInputStream(File file) throws IOException { 179 179 try { 180 return getUncompressedFileInputStream(file.toPath()); // NOPMD180 return getUncompressedFileInputStream(file.toPath()); 181 181 } catch (InvalidPathException e) { 182 182 throw new IOException(e); … … 192 192 */ 193 193 public static InputStream getUncompressedFileInputStream(Path path) throws IOException { 194 InputStream in = Files.newInputStream(path); // NOPMD194 InputStream in = Files.newInputStream(path); 195 195 try { 196 196 return byExtension(path.getFileName().toString()).getUncompressedInputStream(in); … … 233 233 */ 234 234 public static OutputStream getCompressedFileOutputStream(File file) throws IOException { 235 return getCompressedFileOutputStream(file.toPath()); // NOPMD235 return getCompressedFileOutputStream(file.toPath()); 236 236 } 237 237 … … 246 246 */ 247 247 public static OutputStream getCompressedFileOutputStream(Path path) throws IOException { 248 OutputStream out = Files.newOutputStream(path); // NOPMD248 OutputStream out = Files.newOutputStream(path); 249 249 try { 250 250 return byExtension(path.getFileName().toString()).getCompressedOutputStream(out); -
trunk/src/org/openstreetmap/josm/io/GeoJSONServerReader.java
r15784 r19535 37 37 return null; 38 38 progressMonitor.subTask(tr("Downloading OSM data...")); 39 InputStream uncompressedInputStream = compression.getUncompressedInputStream(in); // NOPMD39 InputStream uncompressedInputStream = compression.getUncompressedInputStream(in); 40 40 ProgressMonitor subTaskMonitor = progressMonitor.createSubTaskMonitor(1, false); 41 41 return GeoJSONReader.parseDataSet(uncompressedInputStream, subTaskMonitor); -
trunk/src/org/openstreetmap/josm/io/GpxParser.java
r19519 r19535 593 593 } else if (currentState != State.LINK) { 594 594 getAttr().ifPresent(attr -> 595 ((Collection<GpxLink>) attr.computeIfAbsent(META_LINKS, e -> new LinkedList< GpxLink>())).add(currentLink));595 ((Collection<GpxLink>) attr.computeIfAbsent(META_LINKS, e -> new LinkedList<>())).add(currentLink)); 596 596 } 597 597 } -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r19080 r19535 41 41 */ 42 42 public GpxReader(InputStream source) throws IOException { 43 Reader utf8stream = UTFInputStreamReader.create(source); // NOPMD43 Reader utf8stream = UTFInputStreamReader.create(source); 44 44 Reader filtered = new InvalidXmlCharacterFilter(utf8stream); // NOPMD 45 45 this.inputSource = new InputSource(filtered); -
trunk/src/org/openstreetmap/josm/io/NameFinder.java
r19519 r19535 300 300 Logging.error(ex); // SAXException does not chain correctly 301 301 throw new SAXException(ex.getMessage(), ex); 302 } catch (NullPointerException ex) { // NOPMD302 } catch (NullPointerException ex) { 303 303 Logging.error(ex); // SAXException does not chain correctly 304 304 throw new SAXException(tr("Null pointer exception, possibly some missing tags."), ex); -
trunk/src/org/openstreetmap/josm/io/OsmJsonReader.java
r18816 r19535 193 193 IOException soe = (IOException) exception.getCause(); 194 194 soe.addSuppressed(exception); // Add the caught exception as a suppressed exception 195 throw new IllegalDataException(soe); // NOPMD -- PreserveStackTrace should be fixed with PMD 7195 throw new IllegalDataException(soe); 196 196 } 197 197 throw exception; -
trunk/src/org/openstreetmap/josm/io/OsmServerLocationReader.java
r18611 r19535 124 124 return null; 125 125 progressMonitor.subTask(tr("Downloading OSM data...")); 126 InputStream uncompressedInputStream = compression.getUncompressedInputStream(in); // NOPMD126 InputStream uncompressedInputStream = compression.getUncompressedInputStream(in); 127 127 ProgressMonitor subTaskMonitor = progressMonitor.createSubTaskMonitor(1, false); 128 128 if ("application/json".equals(contentType)) { -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r18918 r19535 214 214 try { 215 215 capabilitiesUrl = new File(workingAddress).toURI().toURL(); 216 } catch (MalformedURLException e1) { // NOPMD216 } catch (MalformedURLException e1) { 217 217 // do nothing, raise original exception 218 218 Logging.trace(e1); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImportHandler.java
r18211 r19535 50 50 } 51 51 LoadAndZoomHandler.parseChangesetTags(args); 52 } catch (RuntimeException ex) { // NOPMD52 } catch (RuntimeException ex) { 53 53 Logging.warn("RemoteControl: Error parsing import remote control request:"); 54 54 Logging.error(ex); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandler.java
r19200 r19535 179 179 } 180 180 } 181 } catch (RuntimeException ex) { // NOPMD181 } catch (RuntimeException ex) { 182 182 Logging.warn("RemoteControl: Error parsing load_and_zoom remote control request:"); 183 183 Logging.error(ex); … … 247 247 ExceptionDialogUtil.explainException(ex); 248 248 } catch (ExecutionException | TimeoutException | 249 OsmTransferException | RuntimeException ex) { // NOPMD249 OsmTransferException | RuntimeException ex) { 250 250 ExceptionDialogUtil.explainException(ex); 251 251 } -
trunk/src/org/openstreetmap/josm/io/session/GpxTracksSessionExporter.java
r19106 r19535 80 80 @Override 81 81 // The new closable resources in this method will close the input OutputStream 82 @SuppressWarnings( {"squid:S2095", "PMD.CloseResource"})82 @SuppressWarnings("squid:S2095") 83 83 protected void addDataFile(OutputStream out) { 84 84 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); -
trunk/src/org/openstreetmap/josm/io/session/MarkerSessionExporter.java
r19106 r19535 96 96 97 97 // The new closable resources in this method will close the input OutputStream 98 @SuppressWarnings( {"squid:S2095", "PMD.CloseResource"})98 @SuppressWarnings("squid:S2095") 99 99 protected void addDataFile(OutputStream out) { 100 100 Writer writer = new OutputStreamWriter(out, StandardCharsets.UTF_8); -
trunk/src/org/openstreetmap/josm/io/session/OsmDataSessionExporter.java
r19104 r19535 39 39 * avoid potential future issues) 40 40 */ 41 @SuppressWarnings( {"squid:S2095", "PMD.CloseResource"}) // All the closeables in this method will close the input OutputStream.41 @SuppressWarnings("squid:S2095") // All the closeables in this method will close the input OutputStream. 42 42 public static void exportData(DataSet data, OutputStream out) { 43 43 // This writer will close out when it is closed -
trunk/src/org/openstreetmap/josm/plugins/PluginClassLoader.java
r19106 r19535 89 89 * @return the class, if found, otherwise {@code null} 90 90 */ 91 @SuppressWarnings("PMD.CloseResource") // NOSONAR We do *not* want to close class loaders in this method...92 91 private Class<?> findClassInDependencies(String name, boolean resolve) { 93 92 for (PluginClassLoader dep : dependencies) { … … 106 105 107 106 @Override 108 @SuppressWarnings("PMD.CloseResource") // NOSONAR We do *not* want to close class loaders in this method...109 107 public URL findResource(String name) { 110 108 URL resource = super.findResource(name); -
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r19168 r19535 831 831 * @param plugins the plugins to add 832 832 */ 833 @SuppressWarnings("PMD.CloseResource") // NOSONAR We do *not* want to close class loaders in this method...834 833 private static void extendJoinedPluginResourceCL(Collection<PluginInformation> plugins) { 835 834 // iterate all plugins and collect all libraries of all plugins: … … 877 876 + "Delete from preferences?</html>", "'"+Utils.escapeReservedCharactersHTML(plugin.name)+"'", plugin.className); 878 877 } 879 } catch (RuntimeException e) { // NOPMD878 } catch (RuntimeException e) { 880 879 pluginLoadingExceptions.put(plugin.name, e); 881 880 Logging.error(e); … … 937 936 * @param toLoad The plugins to generate the classloaders for 938 937 */ 939 @SuppressWarnings( {"squid:S2095", "PMD.CloseResource"}) // NOSONAR the classloaders and put in a map which we want to keep.938 @SuppressWarnings("squid:S2095") // NOSONAR the classloaders and put in a map which we want to keep. 940 939 private static void generateClassloaders(List<PluginInformation> toLoad) { 941 940 for (PluginInformation info : toLoad) { … … 953 952 * @param toLoad The plugins to resolve dependencies for 954 953 */ 955 @SuppressWarnings( {"squid:S2095", "PMD.CloseResource"}) // NOSONAR the classloaders are from a persistent map954 @SuppressWarnings("squid:S2095") // NOSONAR the classloaders are from a persistent map 956 955 private static void resolveDependencies(List<PluginInformation> toLoad) { 957 956 for (PluginInformation info : toLoad) { -
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r19519 r19535 402 402 * @see HttpURLConnection#getErrorStream() 403 403 */ 404 @SuppressWarnings({"resource",405 /* All 4 `InputStream in` reassignments would close the original when the returned stream is closed */406 "PMD.CloseResource"})407 404 public final InputStream getContent() throws IOException { 408 405 InputStream in = new ProgressInputStream(getInputStream(), getContentLength(), monitor); -
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r19307 r19535 1582 1582 CheckParameterUtil.ensureParameterNotNull(input, "input"); 1583 1583 1584 ImageInputStream stream = createImageInputStream(input); // NOPMD1584 ImageInputStream stream = createImageInputStream(input); 1585 1585 BufferedImage bi = read(stream, readMetadata, enforceTransparency); 1586 1586 if (bi == null) { -
trunk/src/org/openstreetmap/josm/tools/bugreport/BugReport.java
r19246 r19535 154 154 try { 155 155 out.println(header); 156 } catch (RuntimeException e) { // NOPMD156 } catch (RuntimeException e) { 157 157 out.println("Could not generate status report: " + e.getMessage()); 158 158 } -
trunk/src/org/openstreetmap/josm/tools/bugreport/ReportedException.java
r19101 r19535 82 82 try { 83 83 BugReportQueue.getInstance().submit(this); 84 } catch (RuntimeException e) { // NOPMD84 } catch (RuntimeException e) { 85 85 Logging.error(e); 86 86 } … … 227 227 string = value.toString(); 228 228 } 229 } catch (RuntimeException t) { // NOPMD229 } catch (RuntimeException t) { 230 230 Logging.warn(t); 231 231 string = "<Error calling toString()>"; -
trunk/tools/pmd/josm-ruleset.xml
r19520 r19535 108 108 <rule ref="category/java/design.xml"> 109 109 <exclude name="PublicMemberInNonPublicType" reason="Fixing these issues does not improve the code quality, rather the opposite"/> 110 <exclude name="AvoidCatchingGenericException"/>111 110 <exclude name="AvoidDeeplyNestedIfStmts"/> 112 111 <exclude name="AvoidRethrowingException"/> … … 147 146 </rule> 148 147 <rule ref="category/java/errorprone.xml"> 148 <exclude name="AvoidCatchingGenericException"/> 149 149 <exclude name="AssignmentInOperand"/> 150 150 <exclude name="AssignmentToNonFinalStatic"/>
Note:
See TracChangeset
for help on using the changeset viewer.
