Bug 36220 - NPEs in gnu.xml.transform.* clone methods
Summary: NPEs in gnu.xml.transform.* clone methods
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.97
: P3 normal
Target Milestone: 0.98
Assignee: Andrew John Hughes
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-12 11:11 UTC by Ian Rogers
Modified: 2008-06-23 19:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-06-15 22:21:24


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Rogers 2008-05-12 11:11:19 UTC
The clone methods in gnu.xml.transform clone fields without checking the child isn't null first. In particular:

gnu.xml.transform.SortKey
gnu.xml.transform.CallTemplateNode
gnu.xml.transform.ParameterNode

Changing these to set the cloned child fields to null fixes problems when running SPEC jvm 2008.
Comment 1 Andrew John Hughes 2008-06-15 22:05:12 UTC
Caused by: java.lang.NullPointerException
at gnu.xml.transform.ParameterNode.clone(ParameterNode.java:75)
at gnu.xml.transform.Template.clone(Template.java:152)
at gnu.xml.transform.Stylesheet.clone(Stylesheet.java:314)
at gnu.xml.transform.TemplatesImpl.newTransformer(TemplatesImpl.java:68)
at spec.benchmarks.xml.transform.Main.setupTransformers(Main.java:180)
at spec.benchmarks.xml.transform.Main.setupBenchmark(Main.java:148)
Comment 2 Andrew John Hughes 2008-06-15 22:21:24 UTC
Fix for 0.98.
Comment 3 Andrew John Hughes 2008-06-23 19:00:29 UTC
2008-06-22  Andrew John Hughes  <gnu_andrew@member.fsf.org>

       PR classpath/36220:
       * gnu/xml/transform/ParameterNode.java:
       (clone()): Only clone select if not null.
       (toString()): Always include value of select.
       * gnu/xml/transform/Stylesheet.java:
       (toString()): Implemented.
       * gnu/xml/transform/Template.java:
       (toString()): Add value of node.
       * gnu/xml/transform/TemplatesImpl.java:
       (toString()): Implemented.
Comment 4 Andrew John Hughes 2008-06-23 19:13:08 UTC
CVSROOT:        /sources/classpath
Module name:    classpath
Changes by:     Andrew John Hughes <gnu_andrew> 08/06/23 18:57:59

Modified files:
       .              : ChangeLog
       gnu/xml/transform: CallTemplateNode.java Stylesheet.java

Log message:
       PR36220: Fix NPE in CallTemplateNode.

       ChangeLog:

       2008-06-23  Andrew John Hughes  <gnu_andrew@member.fsf.org>

               PR classpath/36220:
               * gnu/xml/transform/CallTemplateNode.java:
               (doApply(Stylesheet,QName,Node,int,int,Node,Node)):
               Check for withParams being empty not null.
               (references(QName)): Remove special-casing for null.
               * gnu/xml/transform/Stylesheet.java:
               (parseWithParams(Node)): Just return the list if empty,
               don't return null instead.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9657&r2=1.9658
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/xml/transform/CallTemplateNode.java?cvsroot=classpath&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/classpath/gnu/xml/transform/Stylesheet.java?cvsroot=classpath&r1=1.13&r2=1.14
Comment 5 Andrew John Hughes 2008-06-23 19:13:32 UTC
Bug fixed. Closing.