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 "Lars Kruse Pedersen (JIRA)" <ji...@apache.org> on 2007/11/08 14:49:50 UTC

[jira] Created: (AXIS2-3329) Problem parsing integer with leading zeros...

Problem parsing integer with leading zeros...
---------------------------------------------

                 Key: AXIS2-3329
                 URL: https://issues.apache.org/jira/browse/AXIS2-3329
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb
    Affects Versions: 1.3
         Environment: Windows XP
            Reporter: Lars Kruse Pedersen


I have the following xsd,

<xs:simpleType name="UnderkontoArtKodeType">            
      <xs:annotation>                 
         <xs:documentation>Angiver typen af afregning</xs:documentation>            
      </xs:annotation>
            
      <xs:restriction base="xs:integer">
         <xs:pattern value="[0-9]{3}"/>
         <xs:totalDigits value="3"/>
      </xs:restriction>
   
</xs:simpleType>

When I receive XML with leading zeros, as in "001", ADB throws an exception....

Looking at the generated ADB kode:

public void setUnderkontoArtKodeType(java.math.BigInteger param) {
        if (java.lang.String.valueOf(param).matches("[0-9]{3}")) {
            this.localUnderkontoArtKodeType = param;
        } else {
            throw new java.lang.RuntimeException();
        }
    }

It is clear why it fails, the "001" has already been converted to an integer, and when the set method is called it takes the 1 and converts it to a string "1", and then tries to validate for containing 3 digits...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3329) Problem parsing integer with leading zeros...

Posted by "Lars Kruse Pedersen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542142 ] 

Lars Kruse Pedersen commented on AXIS2-3329:
--------------------------------------------

Each digit maps to a code that has a special mening, so there must be 3 digits.
Internally it will offcause be represented as an int, but any presentation must show 3 digits.
Yes it probably would be possible to use a string, but the problem is that the XSD is supplied by the customer, so I can't just change it...
I know it sucks...

> Problem parsing integer with leading zeros...
> ---------------------------------------------
>
>                 Key: AXIS2-3329
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3329
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.3
>         Environment: Windows XP
>            Reporter: Lars Kruse Pedersen
>            Assignee: Amila Chinthaka Suriarachchi
>
> I have the following xsd,
> <xs:simpleType name="UnderkontoArtKodeType">            
>       <xs:annotation>                 
>          <xs:documentation>Angiver typen af afregning</xs:documentation>            
>       </xs:annotation>
>             
>       <xs:restriction base="xs:integer">
>          <xs:pattern value="[0-9]{3}"/>
>          <xs:totalDigits value="3"/>
>       </xs:restriction>
>    
> </xs:simpleType>
> When I receive XML with leading zeros, as in "001", ADB throws an exception....
> Looking at the generated ADB kode:
> public void setUnderkontoArtKodeType(java.math.BigInteger param) {
>         if (java.lang.String.valueOf(param).matches("[0-9]{3}")) {
>             this.localUnderkontoArtKodeType = param;
>         } else {
>             throw new java.lang.RuntimeException();
>         }
>     }
> It is clear why it fails, the "001" has already been converted to an integer, and when the set method is called it takes the 1 and converts it to a string "1", and then tries to validate for containing 3 digits...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Assigned: (AXIS2-3329) Problem parsing integer with leading zeros...

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

Deepal Jayasinghe reassigned AXIS2-3329:
----------------------------------------

    Assignee: Amila Chinthaka Suriarachchi

> Problem parsing integer with leading zeros...
> ---------------------------------------------
>
>                 Key: AXIS2-3329
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3329
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.3
>         Environment: Windows XP
>            Reporter: Lars Kruse Pedersen
>            Assignee: Amila Chinthaka Suriarachchi
>
> I have the following xsd,
> <xs:simpleType name="UnderkontoArtKodeType">            
>       <xs:annotation>                 
>          <xs:documentation>Angiver typen af afregning</xs:documentation>            
>       </xs:annotation>
>             
>       <xs:restriction base="xs:integer">
>          <xs:pattern value="[0-9]{3}"/>
>          <xs:totalDigits value="3"/>
>       </xs:restriction>
>    
> </xs:simpleType>
> When I receive XML with leading zeros, as in "001", ADB throws an exception....
> Looking at the generated ADB kode:
> public void setUnderkontoArtKodeType(java.math.BigInteger param) {
>         if (java.lang.String.valueOf(param).matches("[0-9]{3}")) {
>             this.localUnderkontoArtKodeType = param;
>         } else {
>             throw new java.lang.RuntimeException();
>         }
>     }
> It is clear why it fails, the "001" has already been converted to an integer, and when the set method is called it takes the 1 and converts it to a string "1", and then tries to validate for containing 3 digits...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Commented: (AXIS2-3329) Problem parsing integer with leading zeros...

Posted by "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-3329?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12542104 ] 

Amila Chinthaka Suriarachchi commented on AXIS2-3329:
-----------------------------------------------------

here the problem is you try to use an int as a string.
isn't it possible to change your pattern something like this to allow 1 digit and two digit values
"[0-9]{3}|[0-9]{2}|[0-9]{1}"
here since you convert it to int 001 and 01 and 1 is maped to one and I can not understand why you do not want to accept 01 and 1.

if we do not do this we can not validate it at serialization time and 1 is always serialized to 1. (since it is an int). 

other option is to use a string in the schema and convert it to an int inside your program.

> Problem parsing integer with leading zeros...
> ---------------------------------------------
>
>                 Key: AXIS2-3329
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3329
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.3
>         Environment: Windows XP
>            Reporter: Lars Kruse Pedersen
>            Assignee: Amila Chinthaka Suriarachchi
>
> I have the following xsd,
> <xs:simpleType name="UnderkontoArtKodeType">            
>       <xs:annotation>                 
>          <xs:documentation>Angiver typen af afregning</xs:documentation>            
>       </xs:annotation>
>             
>       <xs:restriction base="xs:integer">
>          <xs:pattern value="[0-9]{3}"/>
>          <xs:totalDigits value="3"/>
>       </xs:restriction>
>    
> </xs:simpleType>
> When I receive XML with leading zeros, as in "001", ADB throws an exception....
> Looking at the generated ADB kode:
> public void setUnderkontoArtKodeType(java.math.BigInteger param) {
>         if (java.lang.String.valueOf(param).matches("[0-9]{3}")) {
>             this.localUnderkontoArtKodeType = param;
>         } else {
>             throw new java.lang.RuntimeException();
>         }
>     }
> It is clear why it fails, the "001" has already been converted to an integer, and when the set method is called it takes the 1 and converts it to a string "1", and then tries to validate for containing 3 digits...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-3329) Problem parsing integer with leading zeros...

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

Amila Chinthaka Suriarachchi resolved AXIS2-3329.
-------------------------------------------------

    Resolution: Won't Fix

the only thing you can do is to manually delete the validation code and write an own validation to check the number is between 0 and 999

> Problem parsing integer with leading zeros...
> ---------------------------------------------
>
>                 Key: AXIS2-3329
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3329
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.3
>         Environment: Windows XP
>            Reporter: Lars Kruse Pedersen
>            Assignee: Amila Chinthaka Suriarachchi
>
> I have the following xsd,
> <xs:simpleType name="UnderkontoArtKodeType">            
>       <xs:annotation>                 
>          <xs:documentation>Angiver typen af afregning</xs:documentation>            
>       </xs:annotation>
>             
>       <xs:restriction base="xs:integer">
>          <xs:pattern value="[0-9]{3}"/>
>          <xs:totalDigits value="3"/>
>       </xs:restriction>
>    
> </xs:simpleType>
> When I receive XML with leading zeros, as in "001", ADB throws an exception....
> Looking at the generated ADB kode:
> public void setUnderkontoArtKodeType(java.math.BigInteger param) {
>         if (java.lang.String.valueOf(param).matches("[0-9]{3}")) {
>             this.localUnderkontoArtKodeType = param;
>         } else {
>             throw new java.lang.RuntimeException();
>         }
>     }
> It is clear why it fails, the "001" has already been converted to an integer, and when the set method is called it takes the 1 and converts it to a string "1", and then tries to validate for containing 3 digits...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org