Opened 5 years ago
Closed 5 years ago
#17525 closed defect (fixed)
NPE just causes a log message
Reported by: | GerdP | Owned by: | team |
---|---|---|---|
Priority: | critical | Milestone: | |
Component: | Plugin reverter | Version: | |
Keywords: | Cc: | Don-vip |
Description
While working on a patch for the reverter plugin I noticed this log message
2019-03-26 08:54:08.204 SEVERE: Thread main-worker-0 raised java.lang.NullPointerException
There is no hint in the dialog and no traceback in the log explaining what went wrong. With this small hack I can reproduce the problem easily.
-
src/reverter/DataSetCommandMerger.java
106 106 107 107 List<Node> newNodes = new ArrayList<>(source.getNodesCount()); 108 108 for (Node sourceNode : source.getNodes()) { 109 if (true) sourceNode = null; 109 110 Node targetNode = (Node) getMergeTarget(sourceNode); 110 111 // Target node is not deleted or it will be undeleted when running existing commands 111 112 if (!targetNode.isDeleted() || nominalRevertedPrimitives.contains(targetNode)) {
Attachments (1)
Change History (7)
comment:1 by , 5 years ago
Owner: | removed |
---|---|
Priority: | normal → critical |
Summary: | NPE in DataSetCommandMerger just causes a log message → NPE just causes a log message |
comment:2 by , 5 years ago
Sorry, I confused realRun()
in reverter with doRealRun()
in class PleaseWaitRunnable
:
} catch (final JosmRuntimeException | IllegalArgumentException | IllegalStateException | UnsupportedOperationException | OsmTransferException | IOException | SAXException | InvocationTargetException | InterruptedException e) {
So, we already have code to catch a lot of possible exceptions, but NullPointerException is not yet handled.
Not sure if it makes sense to catch all RunTimeExceptions or if NPE should be added to the above list?
comment:3 by , 5 years ago
Owner: | set to |
---|
comment:5 by , 5 years ago
likely. Maybe this commit wasn't a good idea after all. I'm OK to catch RuntimeException. Maybe PMD config must be tuned.
If I got that right this is a potential problem in all routines which override PleaseWaitRunnable.realRun() without a proper try/catch block using