You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Dmitriy Kiriy (JIRA)" <ji...@apache.org> on 2006/03/31 18:11:29 UTC

[jira] Created: (AXIS2-538) Nulls for fields in generated classes not handled properly

Nulls for fields in generated classes not handled properly
----------------------------------------------------------

         Key: AXIS2-538
         URL: http://issues.apache.org/jira/browse/AXIS2-538
     Project: Apache Axis 2.0 (Axis2)
        Type: Bug
  Components: databinding  
    Versions: 0.95    
    Reporter: Dmitriy Kiriy
    Priority: Blocker


If I have in XML Schema

<xsd:element name="SomeDate" type="xsd:date" />

it mean that minOccurs="0" (from XML Schema specification)

but generated code not handling case that field can be setted up as null:

if (localSomeDateTracker){
                             elementList.add(new javax.xml.namespace.QName("http://mycompany.com/schema/data",
                                                                      "SomeDate"));
                            
                                elementList.add(
                                   org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate));
                                } 

Should be something: 

if (localSomeDateTracker && localSomeDate!= null && notRequired){
                             elementList.add(new javax.xml.namespace.QName("http://mycompany.com/schema/data",
                                                                      "SomeDate"));
                            
                                elementList.add(
                                   org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate));
                                } else {
    throw new Exception("Field SomeDate for entity Someentity required but null");
}

-- 
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: (AXIS2-538) Nulls for fields in generated classes not handled properly

Posted by "Ajith Harshana Ranabahu (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS2-538?page=comments#action_12372757 ] 

Ajith Harshana Ranabahu commented on AXIS2-538:
-----------------------------------------------

Ahumm..
The XML Schema specification  says when omitted minOccurs and maxOccurs should be taken as "1" (not 0) . And a value can be null only if  the nillable attribute is set to true in the schema (and it is false when omitted).
If you want the right behavior, you should put the necessary attributes in the schema and the ADB codegen will handle it properly!


> Nulls for fields in generated classes not handled properly
> ----------------------------------------------------------
>
>          Key: AXIS2-538
>          URL: http://issues.apache.org/jira/browse/AXIS2-538
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug
>   Components: databinding
>     Versions: 0.95
>     Reporter: Dmitriy Kiriy
>     Priority: Blocker

>
> If I have in XML Schema
> <xsd:element name="SomeDate" type="xsd:date" />
> it mean that minOccurs="0" (from XML Schema specification)
> but generated code not handling case that field can be setted up as null:
> if (localSomeDateTracker){
>                              elementList.add(new javax.xml.namespace.QName("http://mycompany.com/schema/data",
>                                                                       "SomeDate"));
>                             
>                                 elementList.add(
>                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate));
>                                 } 
> Should be something: 
> if (localSomeDateTracker && localSomeDate!= null && notRequired){
>                              elementList.add(new javax.xml.namespace.QName("http://mycompany.com/schema/data",
>                                                                       "SomeDate"));
>                             
>                                 elementList.add(
>                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate));
>                                 } else {
>     throw new Exception("Field SomeDate for entity Someentity required but null");
> }

-- 
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: (AXIS2-538) Nulls for fields in generated classes not handled properly

Posted by "Ajith Harshana Ranabahu (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS2-538?page=all ]
     
Ajith Harshana Ranabahu resolved AXIS2-538:
-------------------------------------------

    Resolution: Invalid

I'm marking this invalid and closing the issue since the XMLSchema specification has been interpreted wrongly 

> Nulls for fields in generated classes not handled properly
> ----------------------------------------------------------
>
>          Key: AXIS2-538
>          URL: http://issues.apache.org/jira/browse/AXIS2-538
>      Project: Apache Axis 2.0 (Axis2)
>         Type: Bug
>   Components: databinding
>     Versions: 0.95
>     Reporter: Dmitriy Kiriy
>     Priority: Blocker

>
> If I have in XML Schema
> <xsd:element name="SomeDate" type="xsd:date" />
> it mean that minOccurs="0" (from XML Schema specification)
> but generated code not handling case that field can be setted up as null:
> if (localSomeDateTracker){
>                              elementList.add(new javax.xml.namespace.QName("http://mycompany.com/schema/data",
>                                                                       "SomeDate"));
>                             
>                                 elementList.add(
>                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate));
>                                 } 
> Should be something: 
> if (localSomeDateTracker && localSomeDate!= null && notRequired){
>                              elementList.add(new javax.xml.namespace.QName("http://mycompany.com/schema/data",
>                                                                       "SomeDate"));
>                             
>                                 elementList.add(
>                                    org.apache.axis2.databinding.utils.ConverterUtil.convertToString(localSomeDate));
>                                 } else {
>     throw new Exception("Field SomeDate for entity Someentity required but null");
> }

-- 
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