The new FC6 eclipse cdt generates a java.lang.NullPointerException everytime it tries to save the .cdtproject project file. This occurs when changes are made to a CDT project. For example, adding a new source folder causes the error. I have isolated the problem to a stand-alone testcase which reads in a current .cdtproject file to prime the information, then goes about the actions taken by the save call. -bash-3.1$ java CDescription Exception in thread "main" java.lang.NullPointerException at gnu.xml.transform.TransformerImpl.strip(libgcj.so.7rh) at gnu.xml.transform.TransformerImpl.strip(libgcj.so.7rh) at gnu.xml.transform.TransformerImpl.strip(libgcj.so.7rh) at gnu.xml.transform.TransformerImpl.strip(libgcj.so.7rh) at gnu.xml.transform.TransformerImpl.transform(libgcj.so.7rh) at CDescription.getAsXml(CDescription.java:93) at CDescription.run(CDescription.java:99) at CDescription.main(CDescription.java:113)
Created attachment 12386 [details] Testcase that exhibits problem
Created attachment 12387 [details] sample cdtproject file that is used by test case
Confirmed with classpath CVS: $ /usr/local/jamvm/bin/jamvm CDescription java.lang.NullPointerException at gnu.xml.transform.TransformerImpl.strip(TransformerImpl.java:452) at gnu.xml.transform.TransformerImpl.strip(TransformerImpl.java:459) at gnu.xml.transform.TransformerImpl.strip(TransformerImpl.java:459) at gnu.xml.transform.TransformerImpl.strip(TransformerImpl.java:459) at gnu.xml.transform.TransformerImpl.transform(TransformerImpl.java:330) at CDescription.getAsXml(CDescription.java:93) at CDescription.run(CDescription.java:99) at CDescription.main(CDescription.java:113)
Also happens with gcc svn head. I was also going to CC dog :)
Created attachment 12391 [details] proposed patch This patch makes the crash go away. The bug is that strip() unconditionally uses 'stylesheet', but in our case this is null. I have no idea if this patch is correct. Another plausible approach would be to check stylesheet!=null before using it in strip(). I'd appreciate it if someone could look at this rather quickly. It breaks Eclipse in FC6.
Subject: Bug 29362 Author: tromey Date: Tue Oct 10 19:31:56 2006 New Revision: 117612 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117612 Log: PR classpath/29362: * gnu/xml/transform/TransformerImpl.java (transform): Only strip if there is a stylesheet. Modified: trunk/libjava/classpath/ChangeLog.gcj trunk/libjava/classpath/gnu/xml/transform/TransformerImpl.java
I am confirming that the patch does fix the problem. With patch, the original Eclipse CDT problems have gone away.
Subject: Bug 29362 Author: tromey Date: Tue Oct 10 19:37:52 2006 New Revision: 117613 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117613 Log: PR classpath/29362: * gnu/xml/transform/TransformerImpl.java (transform): Only strip if there is a stylesheet. Modified: branches/redhat/gcc-4_1-branch/libjava/classpath/ChangeLog.gcj branches/redhat/gcc-4_1-branch/libjava/classpath/gnu/xml/transform/TransformerImpl.java
I checked this in. I'd still appreciate a review from Chris though.