Commits

Anonymous committed be4f01b

XW-592 StackOverflowError
o verify correct behaviour

git-svn-id: http://svn.opensymphony.com/svn/xwork/trunk@1757e221344d-f017-0410-9bd5-d282ab1896d7

Comments (0)

Files changed (1)

src/test/com/opensymphony/xwork2/conversion/impl/XWorkBasicConverterTest.java

         }
     }
 
+    public void testEmptyArrayConversion() throws Exception {
+        XWorkBasicConverter basicConverter = new XWorkBasicConverter();
+        Object convertedObject = basicConverter.convertValue(new HashMap(), null, null, null, new Object[]{}, Object[].class);
+        // we must not get XWorkException as that will caused a conversion error
+        assertEquals(Object[].class, convertedObject.getClass());
+        Object[] obj = (Object[]) convertedObject;
+        assertEquals(0, obj.length);
+    }
+
+    public void testNullArrayConversion() throws Exception {
+        XWorkBasicConverter basicConverter = new XWorkBasicConverter();
+        Object convertedObject = basicConverter.convertValue(new HashMap(), null, null, null, null, Object[].class);
+        // we must not get XWorkException as that will caused a conversion error
+        assertNull(convertedObject);
+    }
+
     /* the code below has been disabled as it causes sideffects in Strtus2 (XW-512)
     public void testXW490ConvertStringToDobule() throws Exception {
         Locale locale = new Locale("DA"); // let's use a not common locale such as Denmark