fixed HTTP invoker to support resolution of multi-level primitive array classes again

This commit is contained in:
Juergen Hoeller
2009-02-17 17:50:14 +00:00
parent 57874a6050
commit 35c36dda4b
4 changed files with 103 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,6 +47,22 @@ public interface ITestBean {
void setStringArray(String[] stringArray);
Integer[][] getNestedIntegerArray();
Integer[] getSomeIntegerArray();
void setSomeIntegerArray(Integer[] someIntegerArray);
void setNestedIntegerArray(Integer[][] nestedIntegerArray);
int[] getSomeIntArray();
void setSomeIntArray(int[] someIntArray);
int[][] getNestedIntArray();
void setNestedIntArray(int[][] someNestedArray);
/**
* Throws a given (non-null) exception.
*/

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2008 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,6 +66,12 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
private Integer[] someIntegerArray;
private Integer[][] nestedIntegerArray;
private int[] someIntArray;
private int[][] nestedIntArray;
private Date date = new Date();
private Float myFloat = new Float(0.0);
@@ -98,7 +104,6 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
private List pets;
public TestBean() {
}
@@ -246,6 +251,30 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someIntegerArray = someIntegerArray;
}
public Integer[][] getNestedIntegerArray() {
return nestedIntegerArray;
}
public void setNestedIntegerArray(Integer[][] nestedIntegerArray) {
this.nestedIntegerArray = nestedIntegerArray;
}
public int[] getSomeIntArray() {
return someIntArray;
}
public void setSomeIntArray(int[] someIntArray) {
this.someIntArray = someIntArray;
}
public int[][] getNestedIntArray() {
return nestedIntArray;
}
public void setNestedIntArray(int[][] nestedIntArray) {
this.nestedIntArray = nestedIntArray;
}
public Date getDate() {
return date;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -97,6 +96,18 @@ public class HttpInvokerTests extends TestCase {
assertEquals(50, proxy.getAge());
proxy.setStringArray(new String[] {"str1", "str2"});
assertTrue(Arrays.equals(new String[] {"str1", "str2"}, proxy.getStringArray()));
proxy.setSomeIntegerArray(new Integer[] {1, 2, 3});
assertTrue(Arrays.equals(new Integer[] {1, 2, 3}, proxy.getSomeIntegerArray()));
proxy.setNestedIntegerArray(new Integer[][] {{1, 2, 3}, {4, 5, 6}});
Integer[][] integerArray = proxy.getNestedIntegerArray();
assertTrue(Arrays.equals(new Integer[] {1, 2, 3}, integerArray[0]));
assertTrue(Arrays.equals(new Integer[] {4, 5, 6}, integerArray[1]));
proxy.setSomeIntArray(new int[] {1, 2, 3});
assertTrue(Arrays.equals(new int[] {1, 2, 3}, proxy.getSomeIntArray()));
proxy.setNestedIntArray(new int[][] {{1, 2, 3}, {4, 5, 6}});
int[][] intArray = proxy.getNestedIntArray();
assertTrue(Arrays.equals(new int[] {1, 2, 3}, intArray[0]));
assertTrue(Arrays.equals(new int[] {4, 5, 6}, intArray[1]));
try {
proxy.exceptional(new IllegalStateException());