Bug 29362 - NullPointerException in gnu.xml.transform.TransformerImpl.strip(libgcj.so.7rh)
Summary: NullPointerException in gnu.xml.transform.TransformerImpl.strip(libgcj.so.7rh)
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: xml (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: 0.93
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-05 20:47 UTC by Jeff Johnston
Modified: 2006-10-10 19:39 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-10-05 22:01:37


Attachments
Testcase that exhibits problem (1.27 KB, text/plain)
2006-10-05 20:48 UTC, Jeff Johnston
Details
sample cdtproject file that is used by test case (190 bytes, text/plain)
2006-10-05 21:12 UTC, Jeff Johnston
Details
proposed patch (401 bytes, patch)
2006-10-06 19:21 UTC, Tom Tromey
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Johnston 2006-10-05 20:47:08 UTC
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)
Comment 1 Jeff Johnston 2006-10-05 20:48:47 UTC
Created attachment 12386 [details]
Testcase that exhibits problem
Comment 2 Jeff Johnston 2006-10-05 21:12:55 UTC
Created attachment 12387 [details]
sample cdtproject file that is used by test case
Comment 3 Mark Wielaard 2006-10-05 22:01:37 UTC
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)
Comment 4 Tom Tromey 2006-10-05 22:03:23 UTC
Also happens with gcc svn head.
I was also going to CC dog :)
Comment 5 Tom Tromey 2006-10-06 19:21:29 UTC
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.
Comment 6 Tom Tromey 2006-10-10 19:32:15 UTC
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

Comment 7 Jeff Johnston 2006-10-10 19:35:44 UTC
I am confirming that the patch does fix the problem.  With patch, the original Eclipse CDT problems have gone away.
Comment 8 Tom Tromey 2006-10-10 19:38:06 UTC
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

Comment 9 Tom Tromey 2006-10-10 19:39:07 UTC
I checked this in.
I'd still appreciate a review from Chris though.