Index: modules/beans/make/common/build.xml
===================================================================
--- modules/beans/make/common/build.xml.orig 2006-03-22 08:20:47.000000000 +0000
+++ modules/beans/make/common/build.xml 2006-03-22 08:55:28.000000000 +0000
@@ -97,8 +97,6 @@
-
-
Index: modules/beans/src/main/java/java/beans/XMLDecoder.java
===================================================================
--- modules/beans/src/main/java/java/beans/XMLDecoder.java.orig 2006-03-21 07:48:18.000000000 +0000
+++ modules/beans/src/main/java/java/beans/XMLDecoder.java 2006-03-22 08:50:22.000000000 +0000
@@ -52,6 +52,8 @@
*/
public XMLDecoder(
InputStream is, Object owner, ExceptionListener exceptionListener) {
+ if(is == null)
+ throw new IllegalArgumentException("InputStream cannot be null");
this.is = is;
this.owner = owner;
this.exceptionListener = exceptionListener;
@@ -61,6 +63,8 @@
* @com.intel.drl.spec_ref
*/
public XMLDecoder(InputStream is, Object owner) {
+ if(is == null)
+ throw new IllegalArgumentException("InputStream cannot be null");
this.is = is;
this.owner = owner;
}
@@ -68,7 +72,11 @@
/**
* @com.intel.drl.spec_ref
*/
- public XMLDecoder(InputStream is) { this.is = is; }
+ public XMLDecoder(InputStream is) {
+ if(is == null)
+ throw new IllegalArgumentException("InputStream cannot be null");
+ this.is = is;
+ }
/**
* @com.intel.drl.spec_ref
Index: modules/beans/src/test/java/org/apache/harmony/tests/beans/XMLDecoderTest.java
===================================================================
--- modules/beans/src/test/java/org/apache/harmony/tests/beans/XMLDecoderTest.java.orig 2006-03-21 07:48:16.000000000 +0000
+++ modules/beans/src/test/java/org/apache/harmony/tests/beans/XMLDecoderTest.java 2006-03-22 08:50:04.000000000 +0000
@@ -56,59 +56,80 @@
* The test checks the code generation for XML from Test1.xml
*/
public void testDecodeLinkedList() {
- decode("/java/beans/xml/Test1.xml");
+ decode("../../src/test/resources/xml/Test1.xml");
}
/**
* The test checks the code generation for XML from Test2.xml
*/
public void testDecodePrimitiveArrayByLength() {
- decode("/java/beans/xml/Test2.xml");
+ decode("../../src/test/resources/xml/Test2.xml");
}
/**
* The test checks the code generation for XML from Test3.xml
*/
public void testDecodePrimitiveArrayByElements() {
- decode("/java/beans/xml/Test3.xml");
+ decode("../../src/test/resources/xml/Test3.xml");
}
/**
* The test checks the code generation for XML from Test4.xml
*/
public void testDecodeObjectArrayByLength() {
- decode("/java/beans/xml/Test4.xml");
+ decode("../../src/test/resources/xml/Test4.xml");
}
/**
* The test checks the code generation for XML from Test5.xml
*/
public void testDecodeObjectArrayByElements() {
- decode("/java/beans/xml/Test5.xml");
+ decode("../../src/test/resources/xml/Test5.xml");
}
/**
* The test checks the code generation for XML from Test6.xml
*/
public void testDecodeReference() {
- decode("/java/beans/xml/Test6.xml");
+ decode("../../src/test/resources/xml/Test6.xml");
}
/**
* The test checks the code generation for XML from Test7.xml
*/
public void testDecodeStringArray() {
- decode("/java/beans/xml/Test7.xml");
+ decode("../../src/test/resources/xml/Test7.xml");
}
/*
* The test checks the code generation for XML from MainTest.xml
*
public void testMain() {
- decode("/java/beans/xml/MainTest.xml");
+ decode("../../src/test/resources/xml/MainTest.xml");
}
*/
+ public void testIllegalArgumentExpections() {
+ try {
+ XMLDecoder bd = new XMLDecoder(null);
+ fail("Constructor XMLDecoder(null) should "+
+ "throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ }
+ try {
+ XMLDecoder bd = new XMLDecoder(null,null);
+ fail("Constructor XMLDecoder(null) should "+
+ "throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ }
+ try {
+ XMLDecoder bd = new XMLDecoder(null,null,null);
+ fail("Constructor XMLDecoder(null) should "+
+ "throw IllegalArgumentException");
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
/**
*
*/
@@ -131,7 +152,7 @@
try {
Introspector.setBeanInfoSearchPath(new String[] {});
d = new XMLDecoder(new BufferedInputStream(
- FileInputStream.class.getResourceAsStream(resourceName)));
+ ClassLoader.getSystemClassLoader().getResourceAsStream(resourceName)));
while(true) {
Object obj = d.readObject();
}
Index: modules/beans/src/test/resources/xml/Test6.xml
===================================================================
--- modules/beans/src/test/resources/xml/Test6.xml.orig 2006-03-21 07:48:16.000000000 +0000
+++ modules/beans/src/test/resources/xml/Test6.xml 2006-03-22 08:48:41.000000000 +0000
@@ -20,11 +20,11 @@
Version: $Revision: 1.1.6.3 $
-->
-
\ No newline at end of file
+