You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andrea Smyth (JIRA)" <ji...@apache.org> on 2006/09/06 17:16:23 UTC

[jira] Created: (CXF-29) Set DatatypeProvider

Set DatatypeProvider
--------------------

                 Key: CXF-29
                 URL: http://issues.apache.org/jira/browse/CXF-29
             Project: CeltiXfire
          Issue Type: Bug
          Components: JAXB Databinding
            Reporter: Andrea Smyth


When you instantiate a class that is mapped from an element which has a base64Binary attribute with a default value, and subsequently call the getter for this attribute, the invocation will fail with a NPE unless somwhere in the code a DatatypeConverter was set via DatatypeConverter.setDatatypeConverter(javax.xml.bind.DatatypeConverterInterface converter):

e.g. generated code:

public class Foo {
...
public byte[] getBase64BinaryAttr() {
       if (base64BinaryAttr == null) {
           return DatatypeConverter.parseBase64Binary("wxyz");
       } else {
           return base64BinaryAttr;
       }
   }
}

application code:

Foo foo = new ObjectFactory().createFoo();
DatatypeConverter.setDatatypeConverter(new DatatypeConverterImpl());
byte[] value = foo.getBase64BinaryAttr()

We should take care that somewhere in the runtime a DatatypeConverter is set, possibly through loading (but not necessarily registering) an extension in the rt-databinding-jaxb module? From the javadoc:
" JAXB Providers are required to call this method at some point before allowing any of the JAXB client marshal or unmarshal operations to occur".
We cannot take the DatatypeConverterImpl provided by sun (in the com.sun.xml.bind jaxb-impl.jar) as this has a protected constructor, but could use the one from jaxme project http://ws.apache.org/jaxme/


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CXF-29) DatatypeProvider not set

Posted by "tli (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/CXF-29?page=comments#action_12461551 ] 
            
tli commented on CXF-29:
------------------------

With JAXB impl  version 2.0.3, for schema as below:

    <xs:complexType name="Base64WithDefaultValueType">
        <xs:sequence>
            <xs:element name="EndPart" type="xs:string" />
        </xs:sequence>
        <xs:attribute name="AttributeWithDefaultValue" type="xs:base64Binary" default="1223" />
    </xs:complexType>

JAXB generated code part:

    public byte[] getAttributeWithDefaultValue() {
        if (attributeWithDefaultValue == null) {
            return DatatypeConverter.parseBase64Binary("1223");
        } else {
            return attributeWithDefaultValue;
        }
    }

Application code below will run correctly without exception.

        Base64WithDefaultValueType testData = (new ObjectFactory()).createBase64WithDefaultValueType();
        byte[] checkValue = testData.getAttributeWithDefaultValue();

The JAXB impl should fixed the bug by set a concrete impl of DatatypeConverter when create JAXB context.


> DatatypeProvider not set
> ------------------------
>
>                 Key: CXF-29
>                 URL: http://issues.apache.org/jira/browse/CXF-29
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0-RC
>            Reporter: Andrea Smyth
>         Assigned To: tli
>             Fix For: 2.0-RC
>
>
> When you instantiate a class that is mapped from an element which has a base64Binary attribute with a default value, and subsequently call the getter for this attribute, the invocation will fail with a NPE unless somwhere in the code a DatatypeConverter was set via DatatypeConverter.setDatatypeConverter(javax.xml.bind.DatatypeConverterInterface converter):
> e.g. generated code:
> public class Foo {
> ...
> public byte[] getBase64BinaryAttr() {
>        if (base64BinaryAttr == null) {
>            return DatatypeConverter.parseBase64Binary("wxyz");
>        } else {
>            return base64BinaryAttr;
>        }
>    }
> }
> application code:
> Foo foo = new ObjectFactory().createFoo();
> DatatypeConverter.setDatatypeConverter(new DatatypeConverterImpl());
> byte[] value = foo.getBase64BinaryAttr()
> We should take care that somewhere in the runtime a DatatypeConverter is set, possibly through loading (but not necessarily registering) an extension in the rt-databinding-jaxb module? From the javadoc:
> " JAXB Providers are required to call this method at some point before allowing any of the JAXB client marshal or unmarshal operations to occur".
> We cannot take the DatatypeConverterImpl provided by sun (in the com.sun.xml.bind jaxb-impl.jar) as this has a protected constructor, but could use the one from jaxme project http://ws.apache.org/jaxme/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (CXF-29) DatatypeProvider not set

Posted by "Bozhong Lin (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CXF-29?page=all ]

Bozhong Lin updated CXF-29:
---------------------------

        Fix Version/s: 2.0-RC
    Affects Version/s: 2.0-RC
             Assignee: tli

> DatatypeProvider not set
> ------------------------
>
>                 Key: CXF-29
>                 URL: http://issues.apache.org/jira/browse/CXF-29
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0-RC
>            Reporter: Andrea Smyth
>         Assigned To: tli
>             Fix For: 2.0-RC
>
>
> When you instantiate a class that is mapped from an element which has a base64Binary attribute with a default value, and subsequently call the getter for this attribute, the invocation will fail with a NPE unless somwhere in the code a DatatypeConverter was set via DatatypeConverter.setDatatypeConverter(javax.xml.bind.DatatypeConverterInterface converter):
> e.g. generated code:
> public class Foo {
> ...
> public byte[] getBase64BinaryAttr() {
>        if (base64BinaryAttr == null) {
>            return DatatypeConverter.parseBase64Binary("wxyz");
>        } else {
>            return base64BinaryAttr;
>        }
>    }
> }
> application code:
> Foo foo = new ObjectFactory().createFoo();
> DatatypeConverter.setDatatypeConverter(new DatatypeConverterImpl());
> byte[] value = foo.getBase64BinaryAttr()
> We should take care that somewhere in the runtime a DatatypeConverter is set, possibly through loading (but not necessarily registering) an extension in the rt-databinding-jaxb module? From the javadoc:
> " JAXB Providers are required to call this method at some point before allowing any of the JAXB client marshal or unmarshal operations to occur".
> We cannot take the DatatypeConverterImpl provided by sun (in the com.sun.xml.bind jaxb-impl.jar) as this has a protected constructor, but could use the one from jaxme project http://ws.apache.org/jaxme/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (CXF-29) DatatypeProvider not set

Posted by "tli (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-29?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

tli resolved CXF-29.
--------------------

    Resolution: Fixed

Add a unit test for it

> DatatypeProvider not set
> ------------------------
>
>                 Key: CXF-29
>                 URL: https://issues.apache.org/jira/browse/CXF-29
>             Project: CXF
>          Issue Type: Bug
>          Components: JAXB Databinding
>    Affects Versions: 2.0-RC
>            Reporter: Andrea Smyth
>         Assigned To: tli
>             Fix For: 2.0-RC
>
>
> When you instantiate a class that is mapped from an element which has a base64Binary attribute with a default value, and subsequently call the getter for this attribute, the invocation will fail with a NPE unless somwhere in the code a DatatypeConverter was set via DatatypeConverter.setDatatypeConverter(javax.xml.bind.DatatypeConverterInterface converter):
> e.g. generated code:
> public class Foo {
> ...
> public byte[] getBase64BinaryAttr() {
>        if (base64BinaryAttr == null) {
>            return DatatypeConverter.parseBase64Binary("wxyz");
>        } else {
>            return base64BinaryAttr;
>        }
>    }
> }
> application code:
> Foo foo = new ObjectFactory().createFoo();
> DatatypeConverter.setDatatypeConverter(new DatatypeConverterImpl());
> byte[] value = foo.getBase64BinaryAttr()
> We should take care that somewhere in the runtime a DatatypeConverter is set, possibly through loading (but not necessarily registering) an extension in the rt-databinding-jaxb module? From the javadoc:
> " JAXB Providers are required to call this method at some point before allowing any of the JAXB client marshal or unmarshal operations to occur".
> We cannot take the DatatypeConverterImpl provided by sun (in the com.sun.xml.bind jaxb-impl.jar) as this has a protected constructor, but could use the one from jaxme project http://ws.apache.org/jaxme/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (CXF-29) DatatypeProvider not set

Posted by "Andrea Smyth (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/CXF-29?page=all ]

Andrea Smyth updated CXF-29:
----------------------------

    Summary: DatatypeProvider not set  (was: Set DatatypeProvider)

> DatatypeProvider not set
> ------------------------
>
>                 Key: CXF-29
>                 URL: http://issues.apache.org/jira/browse/CXF-29
>             Project: CeltiXfire
>          Issue Type: Bug
>          Components: JAXB Databinding
>            Reporter: Andrea Smyth
>
> When you instantiate a class that is mapped from an element which has a base64Binary attribute with a default value, and subsequently call the getter for this attribute, the invocation will fail with a NPE unless somwhere in the code a DatatypeConverter was set via DatatypeConverter.setDatatypeConverter(javax.xml.bind.DatatypeConverterInterface converter):
> e.g. generated code:
> public class Foo {
> ...
> public byte[] getBase64BinaryAttr() {
>        if (base64BinaryAttr == null) {
>            return DatatypeConverter.parseBase64Binary("wxyz");
>        } else {
>            return base64BinaryAttr;
>        }
>    }
> }
> application code:
> Foo foo = new ObjectFactory().createFoo();
> DatatypeConverter.setDatatypeConverter(new DatatypeConverterImpl());
> byte[] value = foo.getBase64BinaryAttr()
> We should take care that somewhere in the runtime a DatatypeConverter is set, possibly through loading (but not necessarily registering) an extension in the rt-databinding-jaxb module? From the javadoc:
> " JAXB Providers are required to call this method at some point before allowing any of the JAXB client marshal or unmarshal operations to occur".
> We cannot take the DatatypeConverterImpl provided by sun (in the com.sun.xml.bind jaxb-impl.jar) as this has a protected constructor, but could use the one from jaxme project http://ws.apache.org/jaxme/

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira