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 "Tim Buss (JIRA)" <ji...@apache.org> on 2007/03/30 18:57:25 UTC

[jira] Created: (AXIS2-2446) Schema constraints generate incorrect code

Schema constraints generate incorrect code
------------------------------------------

                 Key: AXIS2-2446
                 URL: https://issues.apache.org/jira/browse/AXIS2-2446
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: adb
    Affects Versions: 1.1.1
         Environment: Java 1.5, Tomcat 5.5, Axis2 1.1.1 and more recent  Axis and Axiom SNAPSHOTs, Axis2 Eclipse codegen plugin 1.1.1, Eclipse 3.2, WTP 1.5.1, Windows 2003 server

            Reporter: Tim Buss


This problem was originally found in Axis 1.1.1 but is stil present in AXIS SNAPSHOT 3/21 and Axiom SNAPSHOT 3/23

A schema constraint that attempts to limit a string to a particular "maxLength"  generates code that instead eforces the given size as a "minLength".  eg:

The schema type

			<xsd:simpleType name="ConstrainedSimpleType">
				<xsd:restriction base="xsd:string">
					<xsd:maxLength value="36"/>
				</xsd:restriction>
			</xsd:simpleType>

generates

                             /**
                               * Auto generated setter method
                               * @param param ConstrainedSimpleType
                               */
                               public void setConstrainedSimpleType(java.lang.String param){
                            
                                            if (  (java.lang.String.valueOf(param).length() >= 36)  ) {
                                                this.localConstrainedSimpleType=param;
                                            }
                                            else {
                                                throw new java.lang.RuntimeException();
                                            }
                                        

                               }

As you can see the ">" is reversed.  It should be "<".   I have only tested this case so far so I don't know if the bug is isolated to this case.

I am having some other issues with minOccurs=0 (or its omission) where the generated code does not behave as expected but I am still trying th characterize that.

-- 
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] Updated: (AXIS2-2446) Schema constraints generate incorrect code

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

Tim Buss updated AXIS2-2446:
----------------------------

    Attachment: Axis2RPCLiteralTest.wsdl

various rpc-literal tests.  Teh onces with minOccurs=0 don't work with adb

> Schema constraints generate incorrect code
> ------------------------------------------
>
>                 Key: AXIS2-2446
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2446
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.1.1
>         Environment: Java 1.5, Tomcat 5.5, Axis2 1.1.1 and more recent  Axis and Axiom SNAPSHOTs, Axis2 Eclipse codegen plugin 1.1.1, Eclipse 3.2, WTP 1.5.1, Windows 2003 server
>            Reporter: Tim Buss
>         Attachments: Axis2RPCLiteralTest.wsdl
>
>
> This problem was originally found in Axis 1.1.1 but is stil present in AXIS SNAPSHOT 3/21 and Axiom SNAPSHOT 3/23
> A schema constraint that attempts to limit a string to a particular "maxLength"  generates code that instead eforces the given size as a "minLength".  eg:
> The schema type
> 			<xsd:simpleType name="ConstrainedSimpleType">
> 				<xsd:restriction base="xsd:string">
> 					<xsd:maxLength value="36"/>
> 				</xsd:restriction>
> 			</xsd:simpleType>
> generates
>                              /**
>                                * Auto generated setter method
>                                * @param param ConstrainedSimpleType
>                                */
>                                public void setConstrainedSimpleType(java.lang.String param){
>                             
>                                             if (  (java.lang.String.valueOf(param).length() >= 36)  ) {
>                                                 this.localConstrainedSimpleType=param;
>                                             }
>                                             else {
>                                                 throw new java.lang.RuntimeException();
>                                             }
>                                         
>                                }
> As you can see the ">" is reversed.  It should be "<".   I have only tested this case so far so I don't know if the bug is isolated to this case.
> I am having some other issues with minOccurs=0 (or its omission) where the generated code does not behave as expected but I am still trying th characterize that.

-- 
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-2446) Schema constraints generate incorrect code

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

Amila Chinthaka Suriarachchi resolved AXIS2-2446.
-------------------------------------------------

    Resolution: Fixed

have already fixed this issue

> Schema constraints generate incorrect code
> ------------------------------------------
>
>                 Key: AXIS2-2446
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2446
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.1.1
>         Environment: Java 1.5, Tomcat 5.5, Axis2 1.1.1 and more recent  Axis and Axiom SNAPSHOTs, Axis2 Eclipse codegen plugin 1.1.1, Eclipse 3.2, WTP 1.5.1, Windows 2003 server
>            Reporter: Tim Buss
>         Attachments: Axis2RPCLiteralTest.wsdl
>
>
> This problem was originally found in Axis 1.1.1 but is stil present in AXIS SNAPSHOT 3/21 and Axiom SNAPSHOT 3/23
> A schema constraint that attempts to limit a string to a particular "maxLength"  generates code that instead eforces the given size as a "minLength".  eg:
> The schema type
> 			<xsd:simpleType name="ConstrainedSimpleType">
> 				<xsd:restriction base="xsd:string">
> 					<xsd:maxLength value="36"/>
> 				</xsd:restriction>
> 			</xsd:simpleType>
> generates
>                              /**
>                                * Auto generated setter method
>                                * @param param ConstrainedSimpleType
>                                */
>                                public void setConstrainedSimpleType(java.lang.String param){
>                             
>                                             if (  (java.lang.String.valueOf(param).length() >= 36)  ) {
>                                                 this.localConstrainedSimpleType=param;
>                                             }
>                                             else {
>                                                 throw new java.lang.RuntimeException();
>                                             }
>                                         
>                                }
> As you can see the ">" is reversed.  It should be "<".   I have only tested this case so far so I don't know if the bug is isolated to this case.
> I am having some other issues with minOccurs=0 (or its omission) where the generated code does not behave as expected but I am still trying th characterize that.

-- 
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-2446) Schema constraints generate incorrect code

Posted by "Tim Buss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12485683 ] 

Tim Buss commented on AXIS2-2446:
---------------------------------

Note that these tests are "rpc-Literal"

It seemt aht adding minOccurs="0" to any element - simple or complex results in a bad message whether or not the element is present. For example

			<xsd:complexType name="MinOccursSimpleType">
				<xsd:sequence>
					<xsd:element minOccurs="0" name="AString" type="xsd:string"/>
				</xsd:sequence>
			</xsd:complexType>

set as follows in the generated test client


           minOccursSimpleOperation124.setMinOccursSimpleOperationRequest(new MinOccursSimpleType());
           minOccursSimpleOperation124.getMinOccursSimpleOperationRequest().setAString("hello");

results in the following message


POST /axis2/services/Axis2RPCLiteralTest HTTP/1.1
Content-Type: text/xml; charset=UTF-8
SOAPAction: ""
User-Agent: Axis2
Host: 127.0.0.1:8082
Transfer-Encoding: chunked

with the following reply


HTTP/1.1 500 Internal Server Error
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 30 Mar 2007 19:21:07 GMT
Connection: close

1a4
<?xml version='1.0' encoding='UTF-8'?>
   <soapenv:Envelope xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
      <soapenv:Header>
         <wsa:Action>http://www.w3.org/2005/08/addressing/soap/fault</wsa:Action>
      </soapenv:Header>
      <soapenv:Body>
         <soapenv:Fault>
            <faultcode></faultcode>
            <faultstring>Invalid chunk</faultstring>
            <detail />
         </soapenv:Fault>
      </soapenv:Body>
   </soapenv:Envelope>0

It seems there is code that expects to handle minOccurs="0" (ie the "setting tracker").  The same test without minOccurs="0" works with not problmes.

I have attached the test WSDL I am using.



> Schema constraints generate incorrect code
> ------------------------------------------
>
>                 Key: AXIS2-2446
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2446
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.1.1
>         Environment: Java 1.5, Tomcat 5.5, Axis2 1.1.1 and more recent  Axis and Axiom SNAPSHOTs, Axis2 Eclipse codegen plugin 1.1.1, Eclipse 3.2, WTP 1.5.1, Windows 2003 server
>            Reporter: Tim Buss
>
> This problem was originally found in Axis 1.1.1 but is stil present in AXIS SNAPSHOT 3/21 and Axiom SNAPSHOT 3/23
> A schema constraint that attempts to limit a string to a particular "maxLength"  generates code that instead eforces the given size as a "minLength".  eg:
> The schema type
> 			<xsd:simpleType name="ConstrainedSimpleType">
> 				<xsd:restriction base="xsd:string">
> 					<xsd:maxLength value="36"/>
> 				</xsd:restriction>
> 			</xsd:simpleType>
> generates
>                              /**
>                                * Auto generated setter method
>                                * @param param ConstrainedSimpleType
>                                */
>                                public void setConstrainedSimpleType(java.lang.String param){
>                             
>                                             if (  (java.lang.String.valueOf(param).length() >= 36)  ) {
>                                                 this.localConstrainedSimpleType=param;
>                                             }
>                                             else {
>                                                 throw new java.lang.RuntimeException();
>                                             }
>                                         
>                                }
> As you can see the ">" is reversed.  It should be "<".   I have only tested this case so far so I don't know if the bug is isolated to this case.
> I am having some other issues with minOccurs=0 (or its omission) where the generated code does not behave as expected but I am still trying th characterize that.

-- 
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-2446) Schema constraints generate incorrect code

Posted by "Tim Buss (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/AXIS2-2446?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12486193 ] 

Tim Buss commented on AXIS2-2446:
---------------------------------

I am no longer able to reproduce the  "minOccurs" problem described above so I suspect it was caused by an odd condition on my machine.  Nothing really changed as far as I am aware except that I downloaded the 3.0.1 commons-http client so I could debug. The tests as so far descibed involving minOccurs now work with the exception of the "any" test which I am still working on. 

The string length issue is reproducible.

There is another "minOccurs" problem I am trying to characterize where "minOccurs="0"" seems to be required when it shouldn't be.

> Schema constraints generate incorrect code
> ------------------------------------------
>
>                 Key: AXIS2-2446
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2446
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.1.1
>         Environment: Java 1.5, Tomcat 5.5, Axis2 1.1.1 and more recent  Axis and Axiom SNAPSHOTs, Axis2 Eclipse codegen plugin 1.1.1, Eclipse 3.2, WTP 1.5.1, Windows 2003 server
>            Reporter: Tim Buss
>         Attachments: Axis2RPCLiteralTest.wsdl
>
>
> This problem was originally found in Axis 1.1.1 but is stil present in AXIS SNAPSHOT 3/21 and Axiom SNAPSHOT 3/23
> A schema constraint that attempts to limit a string to a particular "maxLength"  generates code that instead eforces the given size as a "minLength".  eg:
> The schema type
> 			<xsd:simpleType name="ConstrainedSimpleType">
> 				<xsd:restriction base="xsd:string">
> 					<xsd:maxLength value="36"/>
> 				</xsd:restriction>
> 			</xsd:simpleType>
> generates
>                              /**
>                                * Auto generated setter method
>                                * @param param ConstrainedSimpleType
>                                */
>                                public void setConstrainedSimpleType(java.lang.String param){
>                             
>                                             if (  (java.lang.String.valueOf(param).length() >= 36)  ) {
>                                                 this.localConstrainedSimpleType=param;
>                                             }
>                                             else {
>                                                 throw new java.lang.RuntimeException();
>                                             }
>                                         
>                                }
> As you can see the ">" is reversed.  It should be "<".   I have only tested this case so far so I don't know if the bug is isolated to this case.
> I am having some other issues with minOccurs=0 (or its omission) where the generated code does not behave as expected but I am still trying th characterize that.

-- 
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-2446) Schema constraints generate incorrect code

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

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

your first issue is already fixed with a later build. So please have a look at with the RC1 or the RC2 which is due to release soon.
For minOccurs='0' problem I think you have to check the request rather than response.

try to use the following code to do and adb testing with the element you want to test.

NewOperation newOperation = new NewOperation();
        newOperation.setNewOperationRequest("test");

        OMElement omElement = newOperation.getOMElement(NewOperation.MY_QNAME, OMAbstractFactory.getOMFactory());
        try {
            String omElementString = omElement.toStringWithConsume();
            System.out.println("OM String ==> " + omElementString);
            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
            NewOperation result = NewOperation.Factory.parse(xmlReader);
        } catch (Exception e) {
        }

here you can see first it gets the xmlString from the object structure and then get the Object structure from the xml string. In this way you can properly test the generated adb code easily and correctly.
I have done a lot of testing with the minOccures='0'. So I belive it should work with any case.


> Schema constraints generate incorrect code
> ------------------------------------------
>
>                 Key: AXIS2-2446
>                 URL: https://issues.apache.org/jira/browse/AXIS2-2446
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: adb
>    Affects Versions: 1.1.1
>         Environment: Java 1.5, Tomcat 5.5, Axis2 1.1.1 and more recent  Axis and Axiom SNAPSHOTs, Axis2 Eclipse codegen plugin 1.1.1, Eclipse 3.2, WTP 1.5.1, Windows 2003 server
>            Reporter: Tim Buss
>         Attachments: Axis2RPCLiteralTest.wsdl
>
>
> This problem was originally found in Axis 1.1.1 but is stil present in AXIS SNAPSHOT 3/21 and Axiom SNAPSHOT 3/23
> A schema constraint that attempts to limit a string to a particular "maxLength"  generates code that instead eforces the given size as a "minLength".  eg:
> The schema type
> 			<xsd:simpleType name="ConstrainedSimpleType">
> 				<xsd:restriction base="xsd:string">
> 					<xsd:maxLength value="36"/>
> 				</xsd:restriction>
> 			</xsd:simpleType>
> generates
>                              /**
>                                * Auto generated setter method
>                                * @param param ConstrainedSimpleType
>                                */
>                                public void setConstrainedSimpleType(java.lang.String param){
>                             
>                                             if (  (java.lang.String.valueOf(param).length() >= 36)  ) {
>                                                 this.localConstrainedSimpleType=param;
>                                             }
>                                             else {
>                                                 throw new java.lang.RuntimeException();
>                                             }
>                                         
>                                }
> As you can see the ">" is reversed.  It should be "<".   I have only tested this case so far so I don't know if the bug is isolated to this case.
> I am having some other issues with minOccurs=0 (or its omission) where the generated code does not behave as expected but I am still trying th characterize that.

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