I have a large legacy application written in Java 15 with Swing and JavaFX using the Netbeans 14 Platform. So when the application starts, it looks like Netbeans IDE and has the IDE menu items, for this question, the File -> Open File...
We are transitioning to files an order of magnitude bigger than in the past (over 1G of text) so it throws an exception (not surprisingly) when loading that file. It looks like the exception happens when Netbeans (openide) tries to load the file into a text pane. I haven't decided how to resolve this, but for now, I would like to just display a statistics panel. Here is the exception:
INFO [org.openide.text.DataEditorSupport]: UIHANDLER_TOO_BIG_FILE_LOADED
SEVERE [org.openide.util.Exceptions]
java.lang.NegativeArraySizeException: -2147483648
at org.netbeans.modules.editor.lib2.document.ReadWriteUtils.read(ReadWriteUtils.java:51)
at org.netbeans.editor.BaseDocument.read(BaseDocument.java:1459)
at org.netbeans.editor.BaseKit.read(BaseKit.java:663)
at org.openide.text.DataEditorSupport.loadFromStreamToKit(DataEditorSupport.java:457)
at org.openide.text.DocumentOpenClose$DocumentLoad.atomicLockedRun(DocumentOpenClose.java:739)
at org.openide.text.DocumentOpenClose$DocumentLoad.run(DocumentOpenClose.java:590)
at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:296)
at org.openide.text.NbDocument.runAtomic(NbDocument.java:411)
at org.openide.text.DocumentOpenClose$DocumentLoad.run(DocumentOpenClose.java:630)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
at org.openide.util.lookup.Lookups.executeWith(Lookups.java:278)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2033)
WARNING [org.netbeans.core.TimableEventQueue]: too much time in AWT thread null
Note that the whole stack trace is netbeans and openide classes, none of our stuff.
The first "at" line is a link, which when clicked, gives the error
Source not found for "ReadWriteUtils"
I have downloaded the source and javadoc jars from https://repository.apache.org/#nexus-search;quick~openide and attempted to tell Netbeans where they are so I can figure out how to interrupt the loading of the file so it doesn't try to display it all. I have placed the jars into a directory and exploded them into the org tree so I can see the sources. I then went to Tools -> Netbeans Platforms to open up the Netbeans Platform Manager. Under the "Development IDE" platform, I select Sources and click on the "Add ZIP/Folder..." button. I won't let me select any of the jars, but when I select the org directory, it add it to the Platform Sources. When I select Javadoc and click the "Add ZIP/Folder..." button, it allows me to select the javadoc jars.
Note that the some jars have RELEASE140 in their name and some don't. I copied one and removed it to see if it may have confused Netbeans.
No dice. I suspect that Netbeans has its own version of the class files jars somewhere and so is ignoring my attempts to tell it where the source code is. Is the openide version the Netbeans is using different than RELEASE140? Here is the the top part of the modules list:
INFO [org.netbeans.core.startup.NbEvents]: Turning on modules:
slf4j.jdk14 [1.7.28 1.7.28]
slf4j.api [1.7.28 1.7.28]
org.openide.util.lookup [8.49 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.util [9.23 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.util.ui [9.24 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.modules [7.63 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.api.annotations.common/1 [1.43 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.filesystems [9.27 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.awt [7.83 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.api.progress/1 [1.63 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.api.progress.nb [1.63 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.dialogs [7.57 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.nodes [7.60 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.windows [6.92 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.libs.batik.read [1.8.0.1 1 Netbeans/netbeans-TLP/netbeans/release130-20-on-20220221]
org.openide.util.ui.svg [1.9 Netbeans/netbeans-TLP/netbeans/release130-20-on-20220221]
org.netbeans.modules.editor.mimelookup/1 [1.55 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.text [6.83 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.api.scripting [1.12 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.swing.tabcontrol [1.71 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.swing.outline [1.49 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.explorer [6.77 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.actions [6.54 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.modules.queries/1 [1.58 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.api.templates [1.23 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.filesystems.nb [9.25 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.loaders [7.85 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.api.intent [1.17 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.api.io [1.18 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.io [1.64 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.filesystems.compat8 [9.24 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.execution [9.18 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.openide.execution.compat8 [9.17 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.swing.plaf [1.57 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
org.netbeans.modules.keyring [1.39 13-00d6d969bf4d9b14e7406c9ee9cc13a61dc39655]
I also added the jars to C:\Program Files\NetBeans-14\netbeans\platform\docs because I found some JUnit jars there. That had no apparent effect.
I would like to be able to bring up the openide source to put in breakpoints and view what it is doing before it hits the exception. So my question is, how do I view the openide source code in Netbeans?
Of course the real goal is to replace the processing of the file by ReadWriteUtils with our own and to that end, I have been working through the tutorials at https://netbeans.apache.org//kb/docs/platform.html. So far, none of them are helping me with this.