Bug #5707

NPE from GENodeQueryManager

Added by Tuukka Lehtonen about 2 years ago. Updated about 2 years ago.

Status:ClosedStart date:2015-03-08
Priority:4Due date:2015-03-08
Assignee:Tuukka Lehtonen% Done:

100%

Category:Model browserSpent time:-
Target version:1.18.1
Release notes:Fixed NPE from GraphExplorer's GENodeQueryManager.
Tags: browsing, regression
Story points-
Velocity based estimate-
ReleaseSimantics 1.18.1Release relationshipAuto

Description

Got this NPE from GENodeQueryManager once when I deleted an Apros model in the model browser while surfing the model contents in the browser. Just a one off hit but better to fix than be sorry.

Exception in thread "GraphExplorer-Worker-1" java.lang.NullPointerException
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager.clearResult(GENodeQueryManager.java:192)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager.propagate(GENodeQueryManager.java:206)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager.clearResult(GENodeQueryManager.java:185)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager.propagate(GENodeQueryManager.java:206)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager.clearResult(GENodeQueryManager.java:185)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager.propagate(GENodeQueryManager.java:206)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager.replaceResult(GENodeQueryManager.java:153)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager$1.run(GENodeQueryManager.java:463)
    at org.simantics.browsing.ui.common.internal.GENodeQueryManager$1PropagateRunner.run(GENodeQueryManager.java:437)
    at org.simantics.browsing.ui.swt.GraphExplorerImpl$GraphExplorerContext$1.run(GraphExplorerImpl.java:474)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

The problem is clearly that the functions continuously reference the field ge but only check for isDisposed at the beginning of each function once. In between invocations ge may be changed to null by other threads. The solution is to read ge into a method-local variable before checking for isDisposed() and using the variable-cached value of ge in each function from there on.

Associated revisions

Revision 31054
Added by Tuukka Lehtonen about 2 years ago

Prevent NPEs from being thrown on ge accesses in GENodeQueryManager.

refs #5707

Revision 31055
Added by Tuukka Lehtonen about 2 years ago

Prevent NPEs from being thrown on ge accesses in GENodeQueryManager.

refs #5707

History

#1 Updated by Tuukka Lehtonen about 2 years ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 100

#2 Updated by Tuukka Lehtonen about 2 years ago

  • Status changed from Feedback to Closed

#3 Updated by Tuukka Lehtonen about 2 years ago

  • Tags changed from browsing to browsing, regression

#4 Updated by Tuukka Lehtonen about 2 years ago

  • Release notes set to Fixed NPE from GraphExplorer's GENodeQueryManager.

Also available in: Atom PDF