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.
In certain error conditions my code opens an output window and writes to it. It may also call reset() first. This reset() often leads to a nNPE: java.lang.NullPointerException at org.netbeans.core.output2.OutWriter.clearListeners(OutWriter.java:300) at org.netbeans.core.output2.OutWriter.dispose(OutWriter.java:269) at org.netbeans.core.output2.NbWriter.reset(NbWriter.java:70) ... (my module code calling reset) It took a brief look and it looks like the getListenerForLine method may return null so there should be some extra checks. Or is there some restriction on reset() I'm not aware of? The client code looks something like this: InputOutput io = IOProvider.getDefault().getIO(NbBundle.getMessage("foo"), false); OutputWriter out = io.getOut(); try { if (clearErrors) { out.reset(); } out.println(message, listener); } catch (IOException ioe) { ... This is from sources that are not completely current, but they are more recent than beta.
are you adding a null listener sometimes when printing to the output? the clearing before writing pattern is quite common AFAIK, so there must be something else.. maybe you call reset on one instance from various threads in a short timeframe (kind of race condition)?
i've "fixed" the problem by checking for the null value and also added some ErrorManager messages hat should help us figure out the sources of the problem. please reopen if it happens to you again.
I got this in a dev build: WARNING [null]: Issue #56826 - Adding a null OutputListener for line:50 WARNING [null]: Issue #56826 - Adding a null OutputListener for line:51 WARNING [null]: Issue #56826 - Adding a null OutputListener for line:52 WARNING [null]: Issue #56826 - Adding a null OutputListener for line:53 WARNING [null]: Issue #56826 - Adding a null OutputListener for line:54 WARNING [null]: Issue #56826 - Adding a null OutputListener for line:55 WARNING [null]: Issue #56826 - Adding a null OutputListener for line:56 WARNING [null]: Issue #56826 - Adding a null OutputListener for line:57 [etc.] I fixed the code to print a stack trace so we will know the culprit next time.