This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Build: NetBeans IDE Dev (Build 200810300201) VM: Java HotSpot(TM) 64-Bit Server VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06 OS: Linux, 2.6.25.18-0.2-default, amd64 Stacktrace: java.lang.NullPointerException at org.netbeans.api.java.source.ModificationResult.commit(ModificationResult.java:187) at org.netbeans.api.java.source.ModificationResult.getResultingSource(ModificationResult.java:342) at org.netbeans.modules.jackpot.ui.QueryResultsView.displayTransformResult(QueryResultsView.java:320) at org.netbeans.modules.jackpot.ui.QueryResultsView.access$800(QueryResultsView.java:91) at org.netbeans.modules.jackpot.ui.QueryResultsView$.mouseClicked(QueryResultsView.java:233) at java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:253)
Created attachment 73623 [details] stacktrace
Hi! Can you please provide steps to reproduce or some additional details about what you were doing when this bug occurred? Also, can you attach file ~/.netbeans/<version>/var/log/messages.log as an attachment here, so that we see if some exceptions were thrown before this one, etc.? Thank you.
I try to reproduce, but I can't. I had some exception before this, and I reported for them. I did "Single Query: Method whose access can be minimized" from dialog "Query and Refactor" of one of my projects. Before this I tried other Single Queried and Query Set.
Created attachment 73657 [details] The message file when exception is thrown.
NPE is from java.source. I can't locate this line in 081030 sources (it's just a closing brace); as of 081114 sources it would be if (sources.size() == 1) // moved from JavaSourceAccessor.revalidate(Java Source) Maybe ultimately a bug in Jackpot but the stack trace does not indicate what the cause would be. java.lang.NullPointerException at eu.easyedu.netbeans.svuid.SerialVersionUidHint.run(SerialVersionUidHint.java:74) in the log file is suspicious. Reporter, please remove this module. java.lang.NullPointerException at org.netbeans.modules.java.source.builder.TreeFactory.QualIdent(TreeFactory.java:548) at org.netbeans.api.java.source.TreeMaker.QualIdent(TreeMaker.java:757) at org.netbeans.modules.jackpot.cmds.AddOverrides.addOverridesAnnotation(AddOverrides.java:118) is also thrown earlier.
Actually, the version which contains the closing bracket was not part of the build at that time - it was on the Parsing API branch. The line from which the exception was thrown is 264 in the current sources ("for (Difference diff : differences) {"). Seems that there are no differences for the file passed into getResultingSource(FileObject). Although it would be trivial to make this method work also for such files, I do not see a real usecase for it (why would the client code need to ask for the content of unmodified file? If there are no changes, there is nothing to show to the user.). I propose to simply add: if (!getModifiedFileObjects().contains(fileObject) { throw new ISE(); } to getResultingSource(). Any objections? Anyway, there seems to be a bug in Jackpot that it tries to show diff for unmodified file. The NPE from QualIdent is IMO caused by passing null Element to the QualIdent method, which is not permitted. The rule probably tries to add @Override annotation even if the java.lang.Override is not on the classpath (e.g. JDK1.4). I do not think this is a random bug - most likely, there are (currently unknown) non-random steps to reproduce.
"there seems to be a bug in Jackpot that it tries to show diff for unmodified file" - if so should go back to jackpot component. The new ISE sounds reasonable. Sounds like the NPE from QualIdent may be the root problem.
Added the exception to getResultingSource: http://hg.netbeans.org/main?cmd=changeset;node=a491ae46bb3c The rest is in Jackpot, IMO.
Integrated into 'main-golden', will be available in build *200812110201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/a491ae46bb3c User: Jan Lahoda <jlahoda@netbeans.org> Log: #152941: only modified files are allowed as arguments to getResultingSource, adding an explicit check.
The old Jackpot module is no longer maintained. There is a rewrite in progress at: http://bitbucket.org/jlahoda/jackpot30/wiki/Home