[jboss-dev-forums] [Design the new POJO MicroContainer] - ClassCastException for char[] MetaValue creation

scott.stark@jboss.org do-not-reply at jboss.com
Tue Aug 7 02:33:37 EDT 2007


This org.jboss.test.metatype.values.factory.test.ArrayValueFactoryUnitTestCase.testCharArray test is failing with the shown CCE. Should simple type arrays be handled by the DefaultMetaValueFactory.createArrayValue?


  |    public void testCharArray()
  |       throws Exception
  |    {
  |       char[] array = "Hello".toCharArray();
  |       ArrayMetaType arrayType = assertInstanceOf(resolve(array.getClass()), ArrayMetaType.class);
  |       MetaValue[] metaArray = { SimpleValueSupport.wrap('H'),
  |             SimpleValueSupport.wrap('e'),
  |             SimpleValueSupport.wrap('l'),
  |             SimpleValueSupport.wrap('l'),
  |             SimpleValueSupport.wrap('o')
  |       };
  |       ArrayValueSupport expected = new ArrayValueSupport(arrayType, metaArray);
  |       
  |       MetaValue result = createMetaValue(array);
  |       ArrayValue actual = assertInstanceOf(result, ArrayValue.class);
  |       getLog().debug("Array Value: " + actual);
  |       assertEquals(expected, actual);      
  |    }
  | 


  | java.lang.ClassCastException: [C
  | 	at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.createArrayValue(DefaultMetaValueFactory.java:201)
  | 	at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.internalCreate(DefaultMetaValueFactory.java:411)
  | 	at org.jboss.metatype.plugins.values.DefaultMetaValueFactory.create(DefaultMetaValueFactory.java:344)
  | 	at org.jboss.test.metatype.values.factory.test.AbstractMetaValueFactoryTest.createMetaValue(AbstractMetaValueFactoryTest.java:89)
  | 	at org.jboss.test.metatype.values.factory.test.ArrayValueFactoryUnitTestCase.testCharArray(ArrayValueFactoryUnitTestCase.java:95)
  | ...
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4071441#4071441

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4071441



More information about the jboss-dev-forums mailing list