Possible bug in xsltbuilder?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Possible bug in xsltbuilder?

jpcook01
I am getting the following error when trying to perform a xslt transformation:

java.lang.IllegalArgumentException: The value of param JMSXGroupID must be a valid Java Object
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.setParameter(TransformerImpl.java:1074)
        at org.apache.camel.builder.xml.XsltBuilder.addParameters(XsltBuilder.java:233)
        at org.apache.camel.builder.xml.XsltBuilder.configureTransformer(XsltBuilder.java:222)
        at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:73)
        at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:157)
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
        at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:56)

On further inspection of the xsltbuilder.java class.

The error is in the addParameters() method, which is just a plain Map copy method.

On further inspection of the setParameter method:
public void setParameter(String name, Object value) {
     
        if (value == null) {
            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, name);
            throw new IllegalArgumentException(err.toString());
        }

Maybe the entry.getValue() is null for JSMXGroupId? What I don't understand is why you have to set JSMXGroupId?

Maybe that addParameters() method needs a null check for every value before copying?

This is the code in my route.
URL styleSheet = getClass().getResource("rugby_fixtures.xslt");
from("activemq:ss.service.solrenderservice").process(XsltBuilder.xslt(styleSheet)).to("file://target");

Thanks for your help
Jonathan


Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in xsltbuilder?

Arjan Moraal
jpcook wrote
java.lang.IllegalArgumentException: The value of param JMSXGroupID must be a valid Java Object
        at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.setParameter(TransformerImpl.java:1074)
        at org.apache.camel.builder.xml.XsltBuilder.addParameters(XsltBuilder.java:233)

Maybe that addParameters() method needs a null check for every value before copying?
Adding a null check seems to solve this problem indeed. I had problems with the JMSType parameter being null.

    protected void addParameters(Transformer transformer, Map<String, Object> map) {
        Set<Map.Entry<String, Object>> propertyEntries = map.entrySet();
        for (Map.Entry<String, Object> entry : propertyEntries) {
            if (entry.getValue() != null) {
                transformer.setParameter(entry.getKey(), entry.getValue());
            }
        }
    }
Reply | Threaded
Open this post in threaded view
|

Re: Possible bug in xsltbuilder?

jstrachan
On 19/10/2007, arjanm <[hidden email]> wrote:

> jpcook wrote:
> >
> > java.lang.IllegalArgumentException: The value of param JMSXGroupID must be
> > a valid Java Object
> >       at
> > com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.setParameter(TransformerImpl.java:1074)
> >       at
> > org.apache.camel.builder.xml.XsltBuilder.addParameters(XsltBuilder.java:233)
> >
> > Maybe that addParameters() method needs a null check for every value
> > before copying?
> >
>
> Adding a null check seems to solve this problem indeed. I had problems with
> the JMSType parameter being null.
>
>     protected void addParameters(Transformer transformer, Map<String,
> Object> map) {
>         Set<Map.Entry<String, Object>> propertyEntries = map.entrySet();
>         for (Map.Entry<String, Object> entry : propertyEntries) {
>             if (entry.getValue() != null) {
>                 transformer.setParameter(entry.getKey(), entry.getValue());
>             }
>         }
>     }

Great stuff - patch applied to trunk with thanks!


--
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com