cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carl Roberts (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-3358) rg.apache.cxf.attachment.AttachmentUtil.createContentID has a bug in it
Date Thu, 24 Feb 2011 16:36:38 GMT

    [ https://issues.apache.org/jira/browse/CXF-3358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12998926#comment-12998926
] 

Carl Roberts commented on CXF-3358:
-----------------------------------

JBOSS uses 2.3.1.  Is it also fixed in 2.3.1?





> rg.apache.cxf.attachment.AttachmentUtil.createContentID has a bug in it
> -----------------------------------------------------------------------
>
>                 Key: CXF-3358
>                 URL: https://issues.apache.org/jira/browse/CXF-3358
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.3.1
>         Environment: Windows XP and JBOSS 6.0.0.Final
>            Reporter: Carl Roberts
>            Assignee: Daniel Kulp
>             Fix For: 2.3.3
>
>
> When parsing an MTOM attachment the code in createContentID throws this exception:
> Caused by: java.lang.IllegalArgumentException: URI is not absolute
>         at java.net.URI.toURL(Unknown Source) [:1.6.0_16]
>         at org.apache.cxf.attachment.AttachmentUtil.createContentID(AttachmentUtil.java:76)
[:2.3.1]
>         at org.apache.cxf.attachment.AttachmentUtil.createMtomAttachmentFromDH(AttachmentUtil.java:252)
[:2.3.1]
>         at org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller.addMtomAttachment(JAXBAttachmentMarshaller.java:69)
[:2.3.1]
>         at com.sun.xml.bind.v2.runtime.output.MTOMXmlOutput.text(MTOMXmlOutput.java:124)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.XMLSerializer.leafElement(XMLSerializer.java:345)
[:2.2]
>         at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$PcdataImpl.writeLeafElement(RuntimeBuiltinLeafInfoImpl.java:177)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.MimeTypedTransducer.writeLeafElement(MimeTypedTransducer.java:92)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.writeLeafElement(TransducedAccessor.java:250)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.property.SingleElementLeafProperty.serializeBody(SingleElementLeafProperty.java:98)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:152)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:65)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:168)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:155)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.serializeBody(SingleElementNodeProperty.java:152)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:340)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:152)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl$1.serializeBody(ElementBeanInfoImpl.java:189)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeBody(ElementBeanInfoImpl.java:316)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:323)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.ElementBeanInfoImpl.serializeRoot(ElementBeanInfoImpl.java:72)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
[:2.2]
>         at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:172)
[:2.2]
>         at org.apache.cxf.jaxb.JAXBEncoderDecoder.writeObject(JAXBEncoderDecoder.java:534)
[:2.3.1]
>         at org.apache.cxf.jaxb.JAXBEncoderDecoder.marshall(JAXBEncoderDecoder.java:227)
[:2.3.1]
> The problem is createContentID method is trying to convert a namespace URI to a URL and
not all namespace URI's are absolute. For example, the namespace URI that is causing the problem
in this case is:  oracle/documaker/schema/ws/composition.
> This same JAX-WS web service runs fine on Tomcat 7.0.6, WLS 10.3.2 and WAS 7.0.13 so
the only container that has a problem with this is JBOSS and it has a problem with it because
it uses CXF and it the AttachmentUtil class has a bug in it.  This is what I did to resolve
the problem:
> 1 - Modify the createContentID method as follows (the last catch statement resolves the
error - you could try to catch IllegalArgumentException if you wish instead:
> public static String createContentID(String ns) throws UnsupportedEncodingException {
> +        // tend to change
> +        String cid = "cxf.apache.org";
> +        System.out.println("*********ns=<" + ns + ">*********");
> +        String name = ATT_UUID + "-" + String.valueOf(++counter);
> +        if (ns != null && (ns.length() > 0)) {
> +            try {
> +                URI uri = new URI(ns);
> +                String host = uri.toURL().getHost();
> +                cid = host;
> +            } catch (URISyntaxException e) {
> +                cid = ns;
> +            } catch (MalformedURLException e) {
> +                cid = ns;
> +            } catch (Exception e){
> +                cid = ns;
> +            }
> +        }
> 2 - Replace AttachmentUtil.class in cxf-rt-core.jar in common/lib in the JBOSS container
with the one I modified.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message