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.
I was testing a fix for IZ 83830 (IAE when using a Function Breakpoint) and noticed another problem. If my project is located in directory with spaces, there is NPE in EditorContextBridge.annotate(): java.lang.NullPointerException at org.netbeans.modules.cnd.debugger.gdb.EditorContextBridge.annotate(EditorContextBridge.java:129) at org.netbeans.modules.cnd.debugger.gdb.CurrentThreadAnnotationListener$3.run(CurrentThreadAnnotationListener.java:230) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:493) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:926) public static Object annotate(CallStackFrame csf, String annotationType) { String fullname = csf.getFullname(); if (fullname != null) { File file = new File(csf.getFullname()); FileObject fo = FileUtil.toFileObject(file); String url; try { 129 url = fo.getURL().toExternalForm(); } catch (FileStateInvalidException ex) { /* Best guesses */ if (Utilities.isWindows()) { url = "file:/" + fo.getPath().replace(" ", "%20"); // NOI18N } else { url = "file:" + fo.getPath(); // NOI18N } } The root of the problem is that "fullname" is not correct: fullname = (java.lang.String)G:/Documents and Settings/nik/MP1//usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/iostream As a result "file" is also not correct: file = (java.io.File)G:\Documents and Settings\nik\MP1\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\iostream And obviously "fo" becomes "null": fo = null I don't know how fullname got this strange value. This is a sample MP1 project. I set several "toggle" breakpoints inside main() and "function" breakpoint on main(); then I start debugging and press "Continue" 1 or 2 times, and NPE happens.
A related fix I've been working on (IZ82103) should also fix this.
According to the FCS quality criteria, NPE is a P1 bug.
There were 2 problems here. First off, the project rundir was being prepended to unix-like paths sent back from gdb. Hence the paths like "G:\Documents and Settings\nik\MP1\usr\lib\gcc\i686-pc-cygwin\3.4.4\include\c++\iostream". Besides that, we were assuming the file existed and tried to get information only available when it did exist. So in cases where it didn't, we got an NPE. The fix is to not prepend the rundir to unix-like absolute paths and to check for file existance before trying to annotate.
Verified in nightly build 20070915