apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.64k stars 846 forks source link

Unexpected exception #6454

Open MaciejNiemczyk opened 1 year ago

MaciejNiemczyk commented 1 year ago

Apache NetBeans version

Apache NetBeans 19

What happened

Very often in notifications I can see Unexpexted exception error, when I click details there is such stack trace:

java.lang.NullPointerException: SFBQ.Result: org.netbeans.modules.java.source.classpath.SourceNextToBinaryQueryImpl$1 returned null in roots.
    at org.netbeans.modules.java.queries.SFBQImpl2Result.preferSources(SFBQImpl2Result.java:47)
    at org.netbeans.api.java.queries.SourceForBinaryQuery$Result2.preferSources(SourceForBinaryQuery.java:203)
    at org.netbeans.modules.parsing.impl.indexing.PathRegistry.getSources(PathRegistry.java:783)
    at org.netbeans.modules.parsing.impl.indexing.PathRegistry.createResources(PathRegistry.java:742)
    at org.netbeans.modules.parsing.impl.indexing.PathRegistry.getSources(PathRegistry.java:277)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$RootsWork.getDone(RepositoryUpdater.java:4925)
[catch] at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Work.doTheWork(RepositoryUpdater.java:3452)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task._run(RepositoryUpdater.java:6197)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.access$3400(RepositoryUpdater.java:5855)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.lambda$call$0(RepositoryUpdater.java:6116)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:288)
    at org.netbeans.modules.parsing.impl.RunWhenScanFinishedSupport.performScan(RunWhenScanFinishedSupport.java:83)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6116)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task$2.call(RepositoryUpdater.java:6112)
    at org.netbeans.modules.masterfs.filebasedfs.utils.FileChangedManager.priorityIO(FileChangedManager.java:153)
    at org.netbeans.modules.masterfs.providers.ProvidedExtensions.priorityIO(ProvidedExtensions.java:335)
    at org.netbeans.modules.parsing.nb.DataObjectEnvFactory.runPriorityIO(DataObjectEnvFactory.java:118)
    at org.netbeans.modules.parsing.impl.Utilities.runPriorityIO(Utilities.java:67)
    at org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater$Task.run(RepositoryUpdater.java:6112)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1419)
    at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
    at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2034)

How to reproduce

I don't know, it happens on different situations while using Netbeans

Did this work correctly in an earlier version?

Apache NetBeans 15

Operating System

Windows 10 version 10.0 running on amd64; UTF-8; pl_PL (nb)

JDK

17.0.8; Java HotSpot(TM) 64-Bit Server VM 17.0.8+9-LTS-211

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

MaciejNiemczyk commented 1 year ago

In messages.log before this stack trace always is (of course times are different):

INFO [org.netbeans.ui.indexing]: Indexing started, time from last indexing 5 187 ms. INFO [org.netbeans.ui.indexing]: Indexing finished, indexing took 33 ms. WARNING [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]

MaciejNiemczyk commented 9 months ago

Finally I have some time to check it more specific. Most of projects are working without problems, but I found project which causing this problem and started to delete files from it. At finish I got only pom.xml and error still occurs.

At start I'm testing on installation of Apache Netbeans 20, next I delete its folders from AppData/Local/Netbeans/20 and AppData/Roaming/Netbeans/20, downloaded zipped binaries and installed newest JDK21. After these steps I started fresh unzipped Netbeans, opened attached project and get error. netbeans-test.zip

MaciejNiemczyk commented 7 months ago

It turns out that I had corrupted sources jars in maven repository folder. After deleting corrupted jars everything works properly. The only thing to improve is to catch exception.

PredatorVI commented 5 months ago

Seeing this Exception with Netbeans 21: messages.log

PredatorVI commented 3 months ago

Also seeing consistently in Netbeans 22. I have been unsuccessful creating a simple project that exhibits the issue. My current project is a multi-module maven project with about 24 modules. In the log it references a .dump file, but it has the source of a file that caused an issue this time. It's not always the same file though. Is there a way to send that securely somehow?

it seems the side effect of this issue includes the inability to get context-sensitive help for variables/classes as well as the inability to debug specific methods or set breakpoints. It doesn't think the class/method is a valid test nor does it think the breakpoint is in a valid location. The 'Navigate' context menu functionality such as "Go to Source..." or "Go to Implementation..." also does not function in this state. If I manage to get the debugger running and it stops on a breakpoint, it shows the value of all variables as 'null'. This is maddening. Going to upgrade to Netbeans 23 shortly and try it.

messages.log