[ 
http://jira.codehaus.org/browse/JIBX-218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Sosnoski reassigned JIBX-218:
------------------------------------

    Assignee: Dennis Sosnoski

> nillable="true" results in IllegalStateException: Current state not 
> START_ELEMENT
> ---------------------------------------------------------------------------------
>
>                 Key: JIBX-218
>                 URL: http://jira.codehaus.org/browse/JIBX-218
>             Project: JiBX
>          Issue Type: Bug
>    Affects Versions: JiBX 1.1.5
>            Reporter: Michael Bannij
>            Assignee: Dennis Sosnoski
>             Fix For: JiBX 1.1.6
>
>
> I have a problem with jibx databinding in webservises built with Axis2.
> My part built with the mentioned frameworks is contacting remote 
> implementation of webservices. Remote webservises are built with very 
> different frameworks and are working without any problems. They responce on 
> my webservice request with XML like shown below (i've renamed namespaces and 
> stripped lots of unimportant fields):
> ---8<--------------------
> <ns2:AResponse
>  xmlns="http://www.my.com/common";
>  xmlns:ns2="http://www.my.com/request";
>  xmlns:ns6="http://www.my.com/response";
>       <ns6:ResponseState>
>               <ErrorCode>0</ErrorCode>
>               <StrErrorCode 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:nil="true"/>
>               <Message>Success</Message>
>               <NativeError 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:nil="true"/>
>               <LogSequence 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:nil="true"/>
>       </ns6:ResponseState>
> </ns2:AResponse>
> -------------------->8---
> The appropirate part of XSD from appropriate webservice definition should 
> look like:
> ---8<--------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema
>  targetNamespace="http://www.my.com/common";
>   xmlns="http://www.my.com/common";
>   xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>   elementFormDefault="qualified">
>         ...
>   <xsd:complexType name="ResponseStateType">
>     <xsd:sequence>
>       <xsd:element name="ErrorCode" type="xsd:int" minOccurs="1" 
> nillable="false" />
>       <xsd:element name="StrErrorCode" type="xsd:string"  minOccurs="0" 
> nillable="true" />
>       <xsd:element name="Message" type="xsd:string"  minOccurs="1" 
> nillable="false" />
>       <xsd:element name="NativeError" type="xsd:string" minOccurs="0" 
> nillable="true" />
>       <xsd:element name="LogSequence" type="xsd:long"  minOccurs="0" 
> nillable="true" />
>     </xsd:sequence>
>   </xsd:complexType>
>         ...
> </xsd:schema>
> -------------------->8---
> And my binding.xml then looks like (a bit complicated due to original 
> namespaces hierarhy):
> ---8<--------------------
>   <mapping
>  name="AResponse"
>  class="com.my.FileInfoSearchResult"
>  extends="com.my.PageableSearchResult">
>     <namespace uri="http://www.my.com/request"; default="elements" />
>     <structure map-as="com.my.PageableSearchResult" />
>   </mapping>
>   <mapping abstract="true" class="com.my.PageableSearchResult">
>     <namespace prefix="lr" uri="http://www.my.com/response"; 
> default="elements"/>
>     <structure name="ResponseState" field="responseState" usage="required" 
> type="com.my.ResponseStateType"/>
>   </mapping>
>   <mapping abstract="true" class="com.my.ResponseStateType">
>     <namespace prefix="respst" uri="http://www.my.com/common"; 
> default="elements"/>
>     <value name="ErrorCode" field="errorCode" usage="required"/>
>     <value name="StrErrorCode" field="strErrorCode" nillable="true" 
> usage="optional"/>
>     <value name="Message" field="message" usage="required"/>
>     <value name="NativeError" field="nativeError" nillable="true" 
> usage="optional"/>
>     <value name="LogSequence" field="logSequence" nillable="true" 
> usage="optional"/>
>   </mapping>
> -------------------->8---
> The problem is in the fact that unmarshaling of the webservces response on my 
> side fails. The original exception is:
> ---8<--------------------
> "IllegalStateException: Current state not START_ELEMENT"
> -------------------->8---
> Then the exception is wrapped into AxisFault when being thown out.
> The IllegalStateException is thrown from the place shown in this stacktrace 
> (stopped on "IllegalStateException trow" breakpoint):
> ---8<--------------------
> Thread [btpool0-6] (Suspended (exception IllegalStateException))      
>       ValidatingStreamReader(BasicStreamReader).getAttributeValue(String, 
> String) line: 641   
>       OMStAXWrapper.getAttributeValue(String, String) line: 656       
>       StAXReaderWrapper.getAttributeValue(String, String) line: 378   
>       UnmarshallingContext.getAttributeValue(String, String) line: 356        
>       UnmarshallingContext.attributeBoolean(String, String, boolean) line: 
> 1881       
>       ResponseStateType.JiBX_binding_unmarshal_1_0(UnmarshallingContext) 
> line: not available  
>       ResponseStateType.JiBX_binding_unmarshal_1_1(UnmarshallingContext) 
> line: not available  
>       
> FileInfoSearchResult(PageableSearchResult).JiBX_binding_unmarshal_1_1(UnmarshallingContext)
>  line: not available 
>       FileInfoSearchResult.JiBX_binding_unmarshal_2_0(UnmarshallingContext) 
> line: not available       
>       JiBX_bindingFileInfoSearchResult_access2.unmarshal(Object, 
> IUnmarshallingContext) line: not available   
>       UnmarshallingContext.unmarshalElement(Class) line: 2512 
>       FileInfoWServiceStub.fromOM(OMElement, Class, Map) line: 370    
>       FileInfoWServiceStub.getFileInfo(FindFileInfo, HeaderType) line: 221    
>       TransactionsWsClient.getFileInfoList(FindFileInfo) line: 278    
>       FileinfoMBean.doSearch() line: 31       
>       FileinfoMBean.initListener(ActionEvent) line: 35        
>       NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not 
> available [native method]  
>       NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39      
>       DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25  
>       Method.invoke(Object, Object...) line: 585      
>       AstValue.invoke(EvaluationContext, Class[], Object[]) line: 187 
>       MethodExpressionImpl.invoke(ELContext, Object[]) line: 297      
>       TagMethodExpression.invoke(ELContext, Object[]) line: 68        
>       LegacyMethodBinding.invoke(FacesContext, Object[]) line: 69     
>       HtmlCommandLink(UICommand).broadcast(FacesEvent) line: 89       
>       UIViewRoot._broadcastForPhase(PhaseId) line: 97 
>       UIViewRoot.processApplication(FacesContext) line: 171   
>       InvokeApplicationExecutor.execute(FacesContext) line: 32        
>       LifecycleImpl.executePhase(FacesContext, PhaseExecutor, 
> PhaseListenerManager) line: 95  
>       LifecycleImpl.execute(FacesContext) line: 70    
>       FacesServlet.service(ServletRequest, ServletResponse) line: 139 
>       ...
> -------------------->8---
> According to stack variables (reader buffer and pointer) the element being 
> processed (and that is causing this error) is:
> ---8<--------------------
> <StrErrorCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> xsi:nil="true"/>
> -------------------->8---
> Must note that the bug looks like JIBX-198, but is being trown in some other 
> place.
> The exception it thrown from BasicStreamReader.getAttributeValue():
> ---8<--------------------
>     public String getAttributeValue(String nsURI, String localName) {
>         if (mCurrToken != START_ELEMENT) {
>             throw new 
> IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM); // THROWNHERE
>         }
>         return mAttrCollector.getValue(nsURI, localName);
>     }
> -------------------->8---
>  
> An must note that value of mCurrToken is END_ELEMENT. I think that the code 
> looking for value of "nil" is confused by the fact that the element being 
> processed (and containing nil="true") is at the same time both START_ELEMENT 
> and END_ELEMENT).

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to