apache / netbeans

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

Seemlingly random state of previously opened files/tabs loaded on start of NetBeans #3680

Closed flx777 closed 2 years ago

flx777 commented 2 years ago

Apache NetBeans version

Apache NetBeans 12.6

What happened

(I originally reported this in jira and now moved it here)

Upon launching NetBeans, it opens a myriad of files and tabs from various open projects in my workspace that were closed before the last shutdown of the application.

NetBeans seems to recreate an older state of opened files and tabs or even combine several former states, as sometimes the opened files contain certain sets of files as they were opened by me days ago, together with other files from more recent sessions.

If I close all files, shut down the application, upon the next start I have a sometimes varying number of files/tabs opened again that weren't there before.

I have deleted all project groups (As I thought it was connected to them at first) and closed/reopened all of my projects as well as clearing the NB-cache, none of these actions solved the issue.

Currently on 12.6, but I recall a similar - yet, not reported because far less frequent - issue in 12.5 as well, but my old 12.5 installation currently does not show the same behavior.

Upon launching the application there is only one Exception caught repeatedly, which might possibly be related to the issue:

java.lang.NullPointerException at org.netbeans.core.windows.model.DefaultModeModel.compareFullFilePath(DefaultModeModel.java:235) at org.netbeans.core.windows.model.DefaultModeModel.access$000(DefaultModeModel.java:51) at org.netbeans.core.windows.model.DefaultModeModel$2.compare(DefaultModeModel.java:220) at org.netbeans.core.windows.model.DefaultModeModel$2.compare(DefaultModeModel.java:206) at java.base/java.util.TimSort.countRunAndMakeAscending(TimSort.java:355) at java.base/java.util.TimSort.sort(TimSort.java:234) at java.base/java.util.Arrays.sort(Arrays.java:1515) at java.base/java.util.ArrayList.sort(ArrayList.java:1749) at java.base/java.util.Collections.sort(Collections.java:177) at org.netbeans.core.windows.model.DefaultModeModel.sortByFile(DefaultModeModel.java:206) at org.netbeans.core.windows.model.DefaultModeModel.sortOpenedTopComponents(DefaultModeModel.java:150) at org.netbeans.core.windows.model.DefaultModeModel.insertOpenedTopComponent(DefaultModeModel.java:144) at org.netbeans.core.windows.model.DefaultModel.insertModeOpenedTopComponent(DefaultModel.java:681) at org.netbeans.core.windows.Central.insertModeOpenedTopComponent(Central.java:806) at org.netbeans.core.windows.ModeImpl.addOpenedTopComponent(ModeImpl.java:341) at org.netbeans.core.windows.LazyLoader.loadNow(LazyLoader.java:139) at org.netbeans.core.windows.LazyLoader.access$400(LazyLoader.java:39) at org.netbeans.core.windows.LazyLoader$2.run(LazyLoader.java:106) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:136) [catch] at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) {{ at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)}} {{ at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)}} {{ at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)}}

How to reproduce

No response

Did this work correctly in an earlier version?

Apache NetBeans 12.4

Operating System

Apache NetBeans IDE 12.6, Windows 10 version 10.0 running on amd64

JDK

11; OpenJDK 64-Bit Server VM 11+28; Oracle Corporation

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No response

Code of Conduct

Yes

lkishalmi commented 2 years ago

Hmm. This could be hard to recreate. Do you have roaming user dir setup with at least two computers? Or onedrive sync on the user folder. I'd bet some background backup/sync process is messing with you. I haven't worked with Windows in the last 17 years though...

flx777 commented 2 years ago

@lkishalmi Hello, thanks for the reply. No, none of the above. It's a straight-forward installation of NB on a single client. Recently updated to NB13 and the issue does not persist with the newer version, at least for now, I can always return to the previously opened state of files without gaining ones that should not be there as described.

I have migrated all settings from 12.6 though, as I have done before, switching from 12.4 to 12.5 and later to 12.6, the issue only persisted from 12.5 to 12.6. After first encountering the issue, I cleared my 12.6 installation and reinstalled without migrating, which did not solve the issue, although I have not checked in detail for any remaining files from the previous installation besides the usual user-dir stuff, which should be sufficient to clear previously opened states of files, I assume. (Needless to say, I did not get opened tabs when first opening the new 12.6 installation, but the issue returned shortly after)

Sorry I cannot really supply any way to recreate the issue, as it just appeared with nothing more but plain usage after a while, I am pretty certain that there was no related change to any settings (nb or system-side) prior to it appearing.

Chris2011 commented 2 years ago

If the issue is not present anymore than it was fixed, maybe. If you can reproduce, please add exact steps how we can reproduce it in our environment.