[ https://issues.apache.org/jira/browse/AXIS2-4108?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Samuel updated AXIS2-4108: -------------------------- Description: When I'm generating Java classes with wsdl2java (using eclipse WTP plugin) from this part of xsd : ----------------------------------------------------------------------------- <xsd:complexType name="Frids_GetFundInType"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="fund_id" type="xsd:int"> </xsd:element> </xsd:sequence> </xsd:complexType> ----------------------------------------------------------------------------- I'm getting an int variable that can not be set to null. In the class "Frids_GetFundInType" (generated by wsdl2java), I see this : ----------------------------------------------------------------------------- /** * Auto generated getter method * * @return int */ public int getId() { return localId; } /** * Auto generated setter method * * @param param * Id */ public void setId(int param) { // setting primitive attribute tracker to true if (param == java.lang.Integer.MIN_VALUE) { localIdTracker = false; } else { localIdTracker = true; } this.localId = param; } ----------------------------------------------------------------------------- So, if I correctly understand the code : - If a client set a value equal to "Integer.MIN_VALUE", my server will think that he didn't set this field. - I can not check if this field is null or not : ----------------------------------------------------------------------------- I can not write if (myVariable.fund_id == null){ then... } ----------------------------------------------------------------------------- as an int can not be null, and the xxxTracker variable is protected... I seen a similar bug marked as fixed but I've download the last release 2 days ago and this samples are from this version... If it's really fixed, can you tell me how can I have the good version (and its number) and what do I have to do (is it automatically corrected ?) Thanks was: When I'm generating Java classes with wsdl2java (using eclipse WTP plugin) from this part of xsd : <xsd:complexType name="Frids_GetFundInType"> <xsd:sequence> <xsd:element maxOccurs="1" minOccurs="0" name="fund_id" type="xsd:int"> </xsd:element> </xsd:sequence> </xsd:complexType> I'm getting an int variable that can not be set to null. In the class "Frids_GetFundInType" (generated by wsdl2java), I see this : /** * Auto generated getter method * * @return int */ public int getId() { return localId; } /** * Auto generated setter method * * @param param * Id */ public void setId(int param) { // setting primitive attribute tracker to true if (param == java.lang.Integer.MIN_VALUE) { localIdTracker = false; } else { localIdTracker = true; } this.localId = param; } So, if I correctly understand, if a client set a value equal to "Integer.MIN_VALUE", my server will think that he didn't set this field. Furthermore, in my server code, how can I check if this field is null or not ? I can not write if myVariable.fund_id == null (an int can not be null) and the xxxTracker variable is protected... I seen a similar bug marked as fixed but I've download the last release 2 days ago and this samples are from this version... If it's really fixed, can you tell me how can I have the good version (and its number) and what do I have to do (is it automatically corrected ?) Thanks > WSDL2Java: minOccurs="0" on primitive types doesn't work properly > ----------------------------------------------------------------- > > Key: AXIS2-4108 > URL: https://issues.apache.org/jira/browse/AXIS2-4108 > Project: Axis 2.0 (Axis2) > Issue Type: Bug > Components: adb > Affects Versions: 1.4.1 > Environment: Windows XP > Eclipse Version: 3.3.2 Build id: M20080221-1800 > Apache Axis2 1.4.1 build (13-08-2008) > Reporter: Samuel > Priority: Critical > > When I'm generating Java classes with wsdl2java (using eclipse WTP plugin) > from this part of xsd : > ----------------------------------------------------------------------------- > <xsd:complexType name="Frids_GetFundInType"> > <xsd:sequence> > <xsd:element maxOccurs="1" minOccurs="0" > name="fund_id" > type="xsd:int"> > </xsd:element> > </xsd:sequence> > </xsd:complexType> > ----------------------------------------------------------------------------- > I'm getting an int variable that can not be set to null. > In the class "Frids_GetFundInType" (generated by wsdl2java), I see this : > ----------------------------------------------------------------------------- > /** > * Auto generated getter method > * > * @return int > */ > public int getId() { > return localId; > } > /** > * Auto generated setter method > * > * @param param > * Id > */ > public void setId(int param) { > // setting primitive attribute tracker to true > if (param == java.lang.Integer.MIN_VALUE) { > localIdTracker = false; > } else { > localIdTracker = true; > } > this.localId = param; > } > ----------------------------------------------------------------------------- > So, if I correctly understand the code : > - If a client set a value equal to "Integer.MIN_VALUE", my server will think > that he didn't set this field. > - I can not check if this field is null or not : > ----------------------------------------------------------------------------- > I can not write if (myVariable.fund_id == null){ > then... > } > ----------------------------------------------------------------------------- > as an int can not be null, and the xxxTracker variable is protected... > I seen a similar bug marked as fixed but I've download the last release 2 > days ago and this samples are from this version... > If it's really fixed, can you tell me how can I have the good version (and > its number) and what do I have to do (is it automatically corrected ?) > Thanks -- 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]