You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by toadie D <to...@gmail.com> on 2006/04/26 22:37:50 UTC

Re: Getting NullPointerException when upgrading from 2.5.1 to 2.7.0 during setParameter call

>
>  We are upgrading from 2.5.1 to 2.7.0 and am seeing NPE being thrown when
> 2.5.1 used to throw a TransformerException.
>
> The use case is
>
> we are using entity parameter in the XSLT .  In 2.5.1, if a parameter is
> NOT defined but referenced, a TransformerException is thrown.  But in
> 2.7.0, we are getting a NPE instead .  Any idea if this is a confirmed
> change of behavior in 2.7.0 ?
>
> sample XSL snippet
>
> <!DOCTYPE xsl:stylesheet [
>       <!ENTITY MY_ROOT_VALUE      '5'>
> ]>
>
>          SAXTransformerFactory tf =
> (SAXTransformerFactory)SAXTransformerFactory.newInstance();
>
>         Templates  tmp = getTemplates();
>         if (tmp == null)
>         {
>             String msg  = "XSL transformer source is null.";
>             ParserConfigurationException pce = new
> ParserConfigurationException(msg);
>             if (m_log != null) m_log.error(msg, pce);
>             throw pce;
>         }
>
>         TransformerHandler th = tf.newTransformerHandler(tmp);
>         Transformer t = th.getTransformer();
>
>        //Add any optional parameters
>         if (m_parameters != null)
>         {
>             Iterator i = m_parameters.keySet().iterator();
>             while (i.hasNext())
>             {
>                 String name = (String)i.next();
>                 Object value = m_parameters.get(name);
>                 t.setParameter(name, value);   --->>> NPE Thrown here.
>             }
>         }
>    org.apache.xalan.transformer.TransformerImpl.setParameter(
> TransformerImpl.java:1558)
> at org.apache.xalan.transformer.TransformerImpl.setParameter(
> TransformerImpl.java:1606)
> at com.amx.translationstep.translate (translationstep.java :226)
> at ...
>
>

Re: Getting NullPointerException when upgrading from 2.5.1 to 2.7.0 during setParameter call

Posted by Henry Zongaro <zo...@ca.ibm.com>.
"toadie D" <to...@gmail.com> wrote on 2006-04-26 04:37:50 PM:
> We are upgrading from 2.5.1 to 2.7.0 and am seeing NPE being thrown 
> when 2.5.1 used to throw a TransformerException.
> 
> The use case is
> 
> we are using entity parameter in the XSLT .  In 2.5.1, if a 
> parameter is NOT defined but referenced, a TransformerException is 
> thrown.  But in 2.7.0, we are getting a NPE instead .  Any idea if 
> this is a confirmed
> change of behavior in 2.7.0 ? 
> 
> sample XSL snippet
> 
> <!DOCTYPE xsl:stylesheet [
>       <!ENTITY MY_ROOT_VALUE      '5'>
> ]>

I'm a bit confused by your description of the problem.  XML parameter 
entities and XSLT stylsheet parameters are not the same thing.  Could I 
ask you to provide a complete, standalone test case that we can use to 
reproduce the problem?  Please include a complete stylesheet and complete 
Java program.

Thanks,

Henry
------------------------------------------------------------------
Henry Zongaro      Xalan development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com