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 "Amila Chinthaka Suriarachchi (JIRA)" <ji...@apache.org> on 2008/10/31 07:50:44 UTC

[jira] Commented: (AXIS2-4108) WSDL2Java: minOccurs="0" on primitive types doesn't work properly

    [ https://issues.apache.org/jira/browse/AXIS2-4108?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644228#action_12644228 ] 

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

please use -uwc option. this would generate the Integer instead of int.

> 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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org