Is this problem related to out ClassCastException we are seeing with
array of complex types in capability class methods?

Thanks.

--Baseer 

-----Original Message-----
From: Daniel Jemiolo [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 15, 2007 9:04 AM
To: [email protected]
Subject: Re: int-Array as ResourceProperty produces ClassCastException

Hi,

Your methods are right, but there's a bug in
AbstractWsResourceCapability.getPropertyElements():

if (value.getClass().isArray())
{
    values = (Object[])value;
    type = ReflectUtils.getClassFromArrayClass(value.getClass());
}

your value is an int[], not an Object[]. the code should be fixed so
that instead of the current shortcut (casting the value to an array), we
use the java.lang.reflect.Array API to make the array object and copy
the references. I'll make a JIRA issue for this.

Dan



Christian Ewers <[EMAIL PROTECTED]> wrote on 03/14/2007 12:21:34 PM:

> 
> Hi,
> 
> I have a resourceProperty that holds an array of integer-values. I
updated
> my muse-sources from svn today.
> In the wsdl-file it is defined as follows
> 
> ..
> <xsd:element name="RecentValues" type="xsd:int"/>
> 
> <xsd:element name="ResourceProperties">
>     <xsd:complexType>
>         <xsd:sequence>
>         ...
>             <xsd:element  ref="tns:RecentValues" minOccurs="0"
> maxOccurs="unbounded"/>
>         ...
>         </xsd:sequence>
>     </xsd:complexType>
> </xsd:element>
> ..
> 
> wsdl2java produces the correct getter and setter methods
> 
> public int[] getRecentValues();
> public void setRecentValues(int[] param);
> 
> When I implement the getter-method with a test return type
> 
> public int[] getRecentValues()
> {
>  int[] values = new int[]{1};
>  return values;
> }
> 
> I get the following ClassCastException when calling the 
> getResourcePropertyDocument with a client.
> 
> java.lang.ClassCastException: [I
>       at
> org.apache.muse.ws.resource.impl.AbstractWsResourceCapability.
> getPropertyElements(AbstractWsResourceCapability.java:234)
>       at
> org.apache.muse.ws.resource.impl.AbstractWsResourceCapability.
> getProperty(AbstractWsResourceCapability.java:190)
>       at
> 
org.apache.muse.ws.resource.properties.impl.SimpleResourcePropertyCollec
tion.
> getResourceProperty(SimpleResourcePropertyCollection.java:596)
>       at
> 
org.apache.muse.ws.resource.properties.impl.SimpleResourcePropertyCollec
tion.
> validateSchema(SimpleResourcePropertyCollection.java:1175)
>       at
> 
org.apache.muse.ws.resource.impl.SimpleWsResource.initialize(SimpleWsRes
ource.java:223)
>       at
> org.apache.muse.core.routing.RouterFilePersistence.
> reloadResource(RouterFilePersistence.java:139)
>       at
> org.apache.muse.core.AbstractFilePersistence.
> reloadResources(AbstractFilePersistence.java:410)
>       at
> 
org.apache.muse.core.AbstractFilePersistence.reload(AbstractFilePersiste
nce.java:351)
>       at
> org.apache.muse.core.routing.SimpleResourceRouter.
> initialize(SimpleResourceRouter.java:256)
>       at
> org.apache.muse.core.platform.AbstractIsolationLayer.
> initialize(AbstractIsolationLayer.java:176)
>       at
> org.apache.muse.core.platform.axis2.AxisIsolationLayer.
> handleRequest(AxisIsolationLayer.java:72)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
>       at
> 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at
> org.apache.axis2.receivers.RawXMLINOutMessageReceiver.
> invokeBusinessLogic(RawXMLINOutMessageReceiver.java:88)
>       at
> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.
> receive(AbstractInOutSyncMessageReceiver.java:39)
>       at
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:493)
>       at
> org.apache.axis2.transport.http.HTTPTransportUtils.
> processHTTPPostRequest(HTTPTransportUtils.java:319)
>       at
>
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:247)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
>       at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>       at
> org.apache.catalina.core.ApplicationFilterChain.
> internalDoFilter(ApplicationFilterChain.java:252)
>       at
> org.apache.catalina.core.ApplicationFilterChain.
> doFilter(ApplicationFilterChain.java:173)
>       at
> 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:213)
>       at
> 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:178)
>       at
> 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:126)
>       at
> 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:105)
>       at
> 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:107)
>       at
> 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1
48)
>       at
> 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:86
9)
>       at
> org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.
> processConnection(Http11BaseProtocol.java:664)
>       at
> 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint
.java:527)
>       at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.
> runIt(LeaderFollowerWorkerThread.java:80)
>       at
> 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:684)
>       at java.lang.Thread.run(Thread.java:595)
> 
> Is this a bug, o am I doing something wrong?
> Thanks,
> Christian
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to