ConvertToArray(byte.class, String[]) gives ClassCastException
-------------------------------------------------------------

                 Key: AXIS2-1467
                 URL: http://issues.apache.org/jira/browse/AXIS2-1467
             Project: Apache Axis 2.0 (Axis2)
          Issue Type: Bug
          Components: databinding
    Affects Versions: 1.0
         Environment: Windows 2000, J2SDK: 1.4.2_08
            Reporter: Mariska Hoogenboom


I have generated webservice client code with the Axis2 plugin for 
Eclipse based on a wsdl file. One of the elements is a byte array.

The generated client tries to convert the string array to a byte[] by 
means of the ConvertToArray. Here I receive a ClassCastException.
If I change byte into short or String, it works ok. 

Example:

        import org.apache.axis2.databinding.utils.ConverterUtil;

      byte[] a ;
      short[] a2;
      String[] c = new String[2];
      c[0]="0";
      c[1]="1";
                
      a = (byte[])ConverterUtil.convertToArray(byte.class, c);

=> java.lang.ClassCastException
        at 
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(ConverterUtil.java:696)
        at 
org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(ConverterUtil.java:654)
        at 
wsdl.simpapp2.TuxedoWebServiceTest.testStartOphalenMelding(TuxedoWebServiceTest.java:154)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at junit.framework.TestCase.runTest(TestCase.java:154)
        at junit.framework.TestCase.runBare(TestCase.java:127)
        at junit.framework.TestResult$1.protect(TestResult.java:106)
        at junit.framework.TestResult.runProtected(TestResult.java:124)
        at junit.framework.TestResult.run(TestResult.java:109)
        at junit.framework.TestCase.run(TestCase.java:118)
        at junit.framework.TestSuite.runTest(TestSuite.java:208)
        at junit.framework.TestSuite.run(TestSuite.java:203)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


      a2 = (short[])ConverterUtil.convertToArray(short.class, c);

=> Ok.


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

        

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

Reply via email to