harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r589692 [1/7] - in /harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common: org/apache/harmony/luni/tests/java/lang/ org/apache/harmony/luni/tests/java/net/ tests/api/java/io/ tests/api/java/lang/ tests/api/java/lang/ref/ tests/ap...
Date Mon, 29 Oct 2007 15:45:46 GMT
Author: odeakin
Date: Mon Oct 29 08:45:41 2007
New Revision: 589692

URL: http://svn.apache.org/viewvc?rev=589692&view=rev
Log:
Let JUnit deal with unexpected Exceptions rather than catching them ourselves - luni module.

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CompilerTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/DoubleTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ObjectTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/SystemTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadLocalTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet6AddressTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/InetAddressTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/BufferedInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/BufferedReaderTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/BufferedWriterTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/ByteArrayInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/DataInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/DataOutputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/EOFExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/FileDescriptorTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/FileInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/FileReaderTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/FileTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/FileWriterTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/FilterInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/InterruptedIOExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/OutputStreamWriterTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/PipedOutputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/PushbackInputStreamTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SerializationStressTest4.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StreamCorruptedExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/StringReaderTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/SyncFailedExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/io/UnsupportedEncodingExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/Process2Test.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/ref/PhantomReferenceTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/ref/ReferenceQueueTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/ref/ReferenceTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/ref/SoftReferenceTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/ref/WeakReferenceTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/reflect/AccessibleObjectTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/reflect/ArrayTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/reflect/ConstructorTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/reflect/FieldTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/reflect/InvocationTargetExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/reflect/MethodTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/lang/reflect/ProxyTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/DatagramPacketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/DatagramSocketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/MalformedURLExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/MulticastSocketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/NetworkInterfaceTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/ServerSocketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/SocketTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/URITest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/URLConnectionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/URLEncoderTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/URLTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/UnknownHostExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/net/UnknownServiceExceptionTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/ArrayListTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/LocaleTest.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/tests/api/java/util/ObservableTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CharacterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CharacterTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CharacterTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CharacterTest.java Mon Oct 29 08:45:41 2007
@@ -609,8 +609,6 @@
             fail("Expected IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
-        } catch (Exception e) {
-            fail("Expected IndexOutOfBoundsException");
         }
 
         try {           
@@ -618,8 +616,6 @@
             fail("Expected NullPointerException");
         } catch (NullPointerException e) {
             // expected
-        } catch (Exception e) {
-            fail("Expected NullPointerException");
         }
 
         try {           
@@ -627,8 +623,6 @@
             fail("Expected IndexOutOfBoundsException");
         } catch (IndexOutOfBoundsException e) {
             // expected
-        } catch (Exception e) {
-            fail("Expected IndexOutOfBoundsException");
         }
     }
     

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CompilerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CompilerTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CompilerTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/CompilerTest.java Mon Oct 29 08:45:41 2007
@@ -25,61 +25,41 @@
      * @tests java.lang.Compiler#command(java.lang.Object)
      */
     public void test_commandLjava_lang_Object() {
-        try {
-            assertNull("Incorrect behavior.", Compiler.command(new Object()));
-        } catch (Exception e) {
-            fail("Exception during test : " + e.getMessage());
-        }
+        assertNull("Incorrect behavior.", Compiler.command(new Object()));
     }
 
     /**
      * @tests java.lang.Compiler#compileClass(java.lang.Class)
      */
     public void test_compileClassLjava_lang_Class() {
-        try {
-            // Do not test return value, may return true or false depending on
-            // if the jit is enabled. Make the call to ensure it doesn't crash.
-            Compiler.compileClass(Compiler.class);
-        } catch (Exception e) {
-            fail("Exception during test.");
-        }
+        // Do not test return value, may return true or false depending on
+        // if the jit is enabled. Make the call to ensure it doesn't crash.
+        Compiler.compileClass(Compiler.class);
     }
 
     /**
      * @tests java.lang.Compiler#compileClasses(java.lang.String)
      */
     public void test_compileClassesLjava_lang_String() {
-        try {
-            // Do not test return value, may return true or false depending on
-            // if the jit is enabled. Make the call to ensure it doesn't crash.
+        // Do not test return value, may return true or false depending on
+        // if the jit is enabled. Make the call to ensure it doesn't crash.
             Compiler.compileClasses("Compiler");
-        } catch (Exception e) {
-            fail("Exception during test.");
-        }
     }
 
     /**
      * @tests java.lang.Compiler#disable()
      */
     public void test_disable() {
-        try {
-            Compiler.disable();
-            Compiler.compileClass(Compiler.class);
-        } catch (Exception e) {
-            fail("Exception during test : " + e.getMessage());
-        }
+        Compiler.disable();
+        Compiler.compileClass(Compiler.class);
     }
 
     /**
      * @tests java.lang.Compiler#enable()
      */
     public void test_enable() {
-        try {
-            Compiler.disable();
-            Compiler.enable();
-            Compiler.compileClass(Compiler.class);
-        } catch (Exception e) {
-            fail("Exception during test : " + e.getMessage());
-        }
+        Compiler.disable();
+        Compiler.enable();
+        Compiler.compileClass(Compiler.class);
     }
 }

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/DoubleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/DoubleTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/DoubleTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/DoubleTest.java Mon Oct 29 08:45:41 2007
@@ -1250,9 +1250,7 @@
             fail("Expected Double.valueOf(null) to throw NPE.");
         } catch (NullPointerException ex) {
             // expected
-        } catch (Throwable ex) {
-            fail("Expected Double.valueOf(null) to throw NPE not " + ex.getClass().getName());
-        }
+        } 
 
         try {
             Double.valueOf("");

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/FloatTest.java Mon Oct 29 08:45:41 2007
@@ -851,8 +851,6 @@
             fail("Expected Float.valueOf(null) to throw NPE.");
         } catch (NullPointerException ex) {
             // expected
-        } catch (Exception ex) {
-            fail("Expected Float.valueOf(null) to throw NPE not " + ex.getClass().getName());
         }
 
         try {

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ObjectTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ObjectTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ObjectTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ObjectTest.java Mon Oct 29 08:45:41 2007
@@ -52,7 +52,7 @@
 	/**
 	 * @tests java.lang.Object#getClass()
 	 */
-	public void test_getClass() {
+	public void test_getClass() throws Exception {
 		// Test for method java.lang.Class java.lang.Object.getClass()
 		String classNames[] = { "java.lang.Object", "java.lang.Throwable",
 				"java.lang.StringBuffer" };
@@ -61,17 +61,13 @@
 
 		status = 0;
 		for (int i = 0; i < classNames.length; ++i) {
-			try {
-				classToTest = Class.forName(classNames[i]);
-				instanceToTest = classToTest.newInstance();
-				assertTrue("Instance didn't match creator class.",
-						instanceToTest.getClass() == classToTest);
-				assertTrue("Instance didn't match class with matching name.",
-						instanceToTest.getClass() == Class
-								.forName(classNames[i]));
-			} catch (Exception ex) {
-				fail("Unexpected exception : " + ex.getMessage());
-			}
+                    classToTest = Class.forName(classNames[i]);
+                    instanceToTest = classToTest.newInstance();
+                    assertTrue("Instance didn't match creator class.",
+                                    instanceToTest.getClass() == classToTest);
+                    assertTrue("Instance didn't match class with matching name.",
+                                    instanceToTest.getClass() == Class
+                                                    .forName(classNames[i]));
 		}
 	}
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/RuntimeTest.java Mon Oct 29 08:45:41 2007
@@ -108,7 +108,7 @@
 			assertTrue("object memory did not grow", secondRead > firstRead);
 			assertTrue("space was not reclaimed", (r.totalMemory() - r
 					.freeMemory()) < secondRead);
-		} catch (Throwable t) {
+		} catch (OutOfMemoryError oome ) {
 			System.out.println("Out of memory during freeMemory test");
 			r.gc();
 			r.gc();

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/String2Test.java Mon Oct 29 08:45:41 2007
@@ -106,11 +106,7 @@
     public void test_Constructor$BIILjava_lang_String() throws Exception {
         // Test for method java.lang.String(byte [], int, int, java.lang.String)
         String s = null;
-        try {
-            s = new String(new byte[] { 65, 66, 67, 68, 69 }, 0, 5, "8859_1");
-        } catch (Exception e) {
-            fail("Threw exception : " + e.getMessage());
-        }
+        s = new String(new byte[] { 65, 66, 67, 68, 69 }, 0, 5, "8859_1");
         assertTrue("Incorrect string returned: " + s, s.equals("ABCDE"));
         // Regression for HARMONY-1111
         assertNotNull(new String(new byte[] { (byte) 0xC0 }, 0, 1, "UTF-8"));
@@ -119,14 +115,10 @@
     /**
      * @tests java.lang.String#String(byte[], java.lang.String)
      */
-    public void test_Constructor$BLjava_lang_String() {
+    public void test_Constructor$BLjava_lang_String() throws Exception {
         // Test for method java.lang.String(byte [], java.lang.String)
         String s = null;
-        try {
-            s = new String(new byte[] { 65, 66, 67, 68, 69 }, "8859_1");
-        } catch (Exception e) {
-            fail("Threw exception : " + e.getMessage());
-        }
+        s = new String(new byte[] { 65, 66, 67, 68, 69 }, "8859_1");
         assertTrue("Incorrect string returned: " + s, s.equals("ABCDE"));
     }
 

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/StringTest.java Mon Oct 29 08:45:41 2007
@@ -37,17 +37,13 @@
         UNSAFE_CONSTRUCTOR = uc;
     }
 
-    private static String newString(int start, int len, char[] data) {
+    private static String newString(int start, int len, char[] data) throws Exception {
         if (UNSAFE_CONSTRUCTOR == null) {
             return new String(data, start, len);
         }
 
-        try {
-            return UNSAFE_CONSTRUCTOR.newInstance(Integer.valueOf(start), Integer.valueOf(len),
+        return UNSAFE_CONSTRUCTOR.newInstance(Integer.valueOf(start), Integer.valueOf(len),
                     data);
-        } catch (Exception e) {
-            throw new AssertionError(e);
-        }
     }
     
     /**
@@ -231,7 +227,7 @@
     /**
      * @tests java.lang.String#contentEquals(CharSequence)
      */
-    public void test_contentEqualsLjava_lang_CharSequence() {
+    public void test_contentEqualsLjava_lang_CharSequence() throws Exception {
         String s = "abc";
         assertTrue(s.contentEquals((CharSequence) new StringBuffer("abc")));
         assertFalse(s.contentEquals((CharSequence) new StringBuffer("def")));
@@ -253,7 +249,7 @@
      * @tests java.lang.String#contentEquals(StringBuffer)
      */
     @SuppressWarnings("nls")
-    public void test_boolean_contentEquals_StringBuffer() {
+    public void test_boolean_contentEquals_StringBuffer() throws Exception {
         String s = "abc";
         assertTrue(s.contentEquals(new StringBuffer("abc")));
         assertFalse(s.contentEquals(new StringBuffer("def")));
@@ -276,7 +272,7 @@
      * @tests java.lang.String#contains(CharSequence)
      */
     @SuppressWarnings("cast")
-    public void test_containsLjava_lang_CharSequence() {
+    public void test_containsLjava_lang_CharSequence() throws Exception {
         String s = "abcdefghijklmnopqrstuvwxyz";
         assertTrue(s.contains((CharSequence) new StringBuffer("abc")));
         assertTrue(s.contains((CharSequence) new StringBuffer("def")));
@@ -297,7 +293,7 @@
     /**
      * @tests java.lang.String.offsetByCodePoints(int, int)'
      */
-    public void test_offsetByCodePointsII() {
+    public void test_offsetByCodePointsII() throws Exception {
         int result = new String("a\uD800\uDC00b").offsetByCodePoints(0, 2);
         assertEquals(3, result);
 
@@ -420,7 +416,7 @@
     /**
      * @tests java.lang.StringBuilder.codePointAt(int)
      */
-    public void test_codePointAtI() {
+    public void test_codePointAtI() throws Exception {
         String s = "abc";
         assertEquals('a', s.codePointAt(0));
         assertEquals('b', s.codePointAt(1));
@@ -481,7 +477,7 @@
     /**
      * @tests java.lang.StringBuilder.codePointBefore(int)
      */
-    public void test_codePointBeforeI() {
+    public void test_codePointBeforeI() throws Exception {
         String s = "abc";
         assertEquals('a', s.codePointBefore(1));
         assertEquals('b', s.codePointBefore(2));
@@ -542,7 +538,7 @@
     /**
      * @tests java.lang.StringBuilder.codePointCount(int, int)
      */
-    public void test_codePointCountII() {
+    public void test_codePointCountII() throws Exception {
         assertEquals(1, "\uD800\uDC00".codePointCount(0, 2));
         assertEquals(1, "\uD800\uDC01".codePointCount(0, 2));
         assertEquals(1, "\uD801\uDC01".codePointCount(0, 2));

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/SystemTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/SystemTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/SystemTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/SystemTest.java Mon Oct 29 08:45:41 2007
@@ -101,18 +101,14 @@
 	 */
 	public void test_currentTimeMillis() {
 		// Test for method long java.lang.System.currentTimeMillis()
-		try {
-			long firstRead = System.currentTimeMillis();
-			try {
-				Thread.sleep(150);
-			} catch (InterruptedException e) {
-			}
-			long secondRead = System.currentTimeMillis();
-			assertTrue("Incorrect times returned: " + firstRead + ", "
-					+ secondRead, firstRead < secondRead);
-		} catch (Exception e) {
-			System.out.println("Exception during test: " + e.toString());
-		}
+                long firstRead = System.currentTimeMillis();
+                try {
+                        Thread.sleep(150);
+                } catch (InterruptedException e) {
+                }
+                long secondRead = System.currentTimeMillis();
+                assertTrue("Incorrect times returned: " + firstRead + ", "
+                                + secondRead, firstRead < secondRead);
 	}
 
 	/**
@@ -292,11 +288,7 @@
 	@SuppressWarnings("deprecation")
     public void test_runFinalizersOnExitZ() {
 		// Can we call the method at least?
-		try {
-			System.runFinalizersOnExit(false);
-		} catch (Throwable t) {
-			fail("Failed to set runFinalizersOnExit");
-		}
+		System.runFinalizersOnExit(false);
 	}
 
 	/**

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadLocalTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadLocalTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadLocalTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadLocalTest.java Mon Oct 29 08:45:41 2007
@@ -25,11 +25,7 @@
      * @tests java.lang.ThreadLocal#ThreadLocal()
      */
     public void test_Constructor() {
-        try {
-            new ThreadLocal<Object>();
-        } catch (Exception e) {
-            fail("unexpected exception: " + e.toString());
-        }
+        new ThreadLocal<Object>();
     }
     
     /**

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/lang/ThreadTest.java Mon Oct 29 08:45:41 2007
@@ -161,13 +161,9 @@
 	 * @tests java.lang.Thread#Thread(java.lang.Runnable)
 	 */
 	public void test_ConstructorLjava_lang_Runnable() {
-		// Test for method java.lang.Thread(java.lang.Runnable)
-		try {
-			ct = new Thread(new SimpleThread(10));
-			ct.start();
-		} catch (Exception e) {
-			fail("Failed to create subthread : " + e.getMessage());
-		}
+            // Test for method java.lang.Thread(java.lang.Runnable)
+            ct = new Thread(new SimpleThread(10));
+            ct.start();
 	}
 
 	/**
@@ -305,11 +301,7 @@
          * Thread.countStackFrames() is unpredictable, so we just test that it
          * doesn't throw an exception.
          */
-        try {
-            Thread.currentThread().countStackFrames();
-        } catch (Throwable t) {
-            fail("unexpected throwable: " + t.toString());
-        }
+        Thread.currentThread().countStackFrames();
     }
 
 	/**
@@ -736,28 +728,24 @@
 	/**
 	 * @tests java.lang.Thread#join(long, int)
 	 */
-	public void test_joinJI() {
+	public void test_joinJI() throws Exception {
 		// Test for method void java.lang.Thread.join(long, int)
 		SimpleThread simple;
-		try {
-			st = new Thread(simple = new SimpleThread(1000), "Squawk1");
-			assertTrue("Thread is alive", !st.isAlive());
-			synchronized (simple) {
-				st.start();
-				simple.wait();
-			}
-			
-			long firstRead = System.currentTimeMillis();
-			st.join(100, 999999);
-			long secondRead = System.currentTimeMillis();
-			assertTrue("Did not join by appropriate time: " + secondRead + "-"
-					+ firstRead + "=" + (secondRead - firstRead), secondRead
-					- firstRead <= 300);
-			assertTrue("Joined thread is not alive", st.isAlive());
-			st.interrupt();  
-		} catch (Exception e) {
-			fail("Exception during test : " + e.getMessage());
-		}
+                st = new Thread(simple = new SimpleThread(1000), "Squawk1");
+                assertTrue("Thread is alive", !st.isAlive());
+                synchronized (simple) {
+                        st.start();
+                        simple.wait();
+                }
+                
+                long firstRead = System.currentTimeMillis();
+                st.join(100, 999999);
+                long secondRead = System.currentTimeMillis();
+                assertTrue("Did not join by appropriate time: " + secondRead + "-"
+                                + firstRead + "=" + (secondRead - firstRead), secondRead
+                                - firstRead <= 300);
+                assertTrue("Joined thread is not alive", st.isAlive());
+                st.interrupt();  
 
 		final Object lock = new Object();
 		final Thread main = Thread.currentThread();

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java?rev=589692&r1=589691&r2=589692&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/net/Inet4AddressTest.java Mon Oct 29 08:45:41 2007
@@ -29,338 +29,292 @@
 	/**
 	 * @tests java.net.Inet4Address#isMulticastAddress()
 	 */
-	public void test_isMulticastAddress() {
+	public void test_isMulticastAddress() throws Exception {
 
 		// Create 2 IP v4 addresses and call "isMulticastAddress()"
 		// result should return true if the first 4 bits of the
 		// address are: 1110, false otherwise
 		// Make 1 address with 1110, and 1 without
 		String addrName = "";
-		try {
-			addrName = "224.0.0.0"; // a multicast addr 1110 = 224-239
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue("Multicast address " + addrName + " not detected.", addr
-					.isMulticastAddress());
-
-			addrName = "239.255.255.255"; // a multicast addr 1110 = 224-239
-			addr = InetAddress.getByName(addrName);
-			assertTrue("Multicast address " + addrName + " not detected.", addr
-					.isMulticastAddress());
-
-			addrName = "42.42.42.42"; // a non-multicast address
-			addr = InetAddress.getByName(addrName);
-			assertTrue("Non multicast address " + addrName
-					+ " reporting as a multicast address.", !addr
-					.isMulticastAddress());
-		} catch (Exception e) {
-			fail("Unknown address : " + addrName);
-		}
+                addrName = "224.0.0.0"; // a multicast addr 1110 = 224-239
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue("Multicast address " + addrName + " not detected.", addr
+                                .isMulticastAddress());
+
+                addrName = "239.255.255.255"; // a multicast addr 1110 = 224-239
+                addr = InetAddress.getByName(addrName);
+                assertTrue("Multicast address " + addrName + " not detected.", addr
+                                .isMulticastAddress());
+
+                addrName = "42.42.42.42"; // a non-multicast address
+                addr = InetAddress.getByName(addrName);
+                assertTrue("Non multicast address " + addrName
+                                + " reporting as a multicast address.", !addr
+                                .isMulticastAddress());
 
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isAnyLocalAddress()
 	 */
-	public void test_isAnyLocalAddress() {
+	public void test_isAnyLocalAddress() throws Exception {
 		String addrName = "";
-		try {
-			addrName = "0.0.0.0";
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue("ANY address " + addrName + " not detected.", addr
-					.isAnyLocalAddress());
-		} catch (Exception e) {
-			fail("Unknown address : " + addrName);
-		}
+                addrName = "0.0.0.0";
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue("ANY address " + addrName + " not detected.", addr
+                                .isAnyLocalAddress());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isLoopbackAddress()
 	 */
-	public void test_isLoopbackAddress() {
+	public void test_isLoopbackAddress() throws Exception {
 		// Create some IP V4 addresses and test if they are local...
 
 		String addrName = "";
-		try {
-			addrName = "127.0.0.0"; // a loopback address should be 127.d.d.d
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue("Loopback address " + addrName + " not detected.", addr
-					.isLoopbackAddress());
-
-			addrName = "127.42.42.42"; // a loopback address should be
-			// 127.d.d.d
-			addr = InetAddress.getByName(addrName);
-			assertTrue("Loopback address " + addrName + " not detected.", addr
-					.isLoopbackAddress());
-
-			addrName = "42.42.42.42"; // a loopback address should be
-			// 127.d.d.d
-			addr = InetAddress.getByName(addrName);
-			assertTrue("Address incorrectly " + addrName
-					+ " detected as a loopback address.", !addr
-					.isLoopbackAddress());
-
-		} catch (Exception e) {
-			fail("Unknown address : " + addrName);
-		}
 
+                addrName = "127.0.0.0"; // a loopback address should be 127.d.d.d
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue("Loopback address " + addrName + " not detected.", addr
+                                .isLoopbackAddress());
+
+                addrName = "127.42.42.42"; // a loopback address should be
+                // 127.d.d.d
+                addr = InetAddress.getByName(addrName);
+                assertTrue("Loopback address " + addrName + " not detected.", addr
+                                .isLoopbackAddress());
+
+                addrName = "42.42.42.42"; // a loopback address should be
+                // 127.d.d.d
+                addr = InetAddress.getByName(addrName);
+                assertTrue("Address incorrectly " + addrName
+                                + " detected as a loopback address.", !addr
+                                .isLoopbackAddress());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isLinkLocalAddress()
 	 */
-	public void test_isLinkLocalAddress() {
+	public void test_isLinkLocalAddress() throws Exception {
 
 		String addrName = "";
-		try {
-			// There are no link local addresses for IPv4
-			// We'll test one to ensure we get "false"
-
-			addrName = "42.42.42.42";
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 address " + addrName
-					+ " incorrectly reporting as a link local address.", !addr
-					.isLinkLocalAddress());
-		} catch (Exception e) {
-			fail("Unknown address : " + e.getMessage());
-		}
+                // There are no link local addresses for IPv4
+                // We'll test one to ensure we get "false"
+
+                addrName = "42.42.42.42";
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 address " + addrName
+                                + " incorrectly reporting as a link local address.", !addr
+                                .isLinkLocalAddress());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isSiteLocalAddress()
 	 */
-	public void test_isSiteLocalAddress() {
+	public void test_isSiteLocalAddress() throws Exception {
 		String addrName = "";
-		try {
-			// There are no site local addresses for IPv4
-			// We'll test one to ensure we get "false"
-
-			addrName = "42.42.42.42";
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 address " + addrName
-					+ " incorrectly reporting as a site local address.", !addr
-					.isSiteLocalAddress());
-		} catch (Exception e) {
-			fail("Unknown address : " + e.getMessage());
-		}
+                // There are no site local addresses for IPv4
+                // We'll test one to ensure we get "false"
+
+                addrName = "42.42.42.42";
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 address " + addrName
+                                + " incorrectly reporting as a site local address.", !addr
+                                .isSiteLocalAddress());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isMCGlobal()
 	 */
-	public void test_isMCGlobal() {
+	public void test_isMCGlobal() throws Exception {
 
 		// Create an IPv4 mulitcast address. It should return
 		// false for globabl mutlicast. There are no valid IPv4
 		// global multicast addresses
 
 		String addrName = "";
-		try {
-			addrName = "224.0.0.0"; // a multicast addr 1110
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 link-local multicast address " + addrName
-					+ " incorrectly identified as a global multicast address.",
-					!addr.isMCGlobal());
-
-			addrName = "224.0.0.255"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 link-local multicast address " + addrName
-					+ " incorrectly identified as a global multicast address.",
-					!addr.isMCGlobal());
-
-			addrName = "224.0.1.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 global multicast address " + addrName
-					+ " not identified as a global multicast address.", addr
-					.isMCGlobal());
-
-			addrName = "238.255.255.255"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 global multicast address " + addrName
-					+ " not identified as a global multicast address.", addr
-					.isMCGlobal());
-
-			addrName = "239.0.0.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 reserved multicast address " + addrName
-					+ " incorrectly identified as a global multicast address.",
-					!addr.isMCGlobal());
-
-			addrName = "239.191.255.255"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 reserved multicast address " + addrName
-					+ " incorrectly identified as a global multicast address.",
-					!addr.isMCGlobal());
-
-		} catch (Exception e) {
-			fail("Unknown address : " + e.getMessage());
-		}
+                addrName = "224.0.0.0"; // a multicast addr 1110
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 link-local multicast address " + addrName
+                                + " incorrectly identified as a global multicast address.",
+                                !addr.isMCGlobal());
+
+                addrName = "224.0.0.255"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 link-local multicast address " + addrName
+                                + " incorrectly identified as a global multicast address.",
+                                !addr.isMCGlobal());
+
+                addrName = "224.0.1.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 global multicast address " + addrName
+                                + " not identified as a global multicast address.", addr
+                                .isMCGlobal());
+
+                addrName = "238.255.255.255"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 global multicast address " + addrName
+                                + " not identified as a global multicast address.", addr
+                                .isMCGlobal());
+
+                addrName = "239.0.0.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 reserved multicast address " + addrName
+                                + " incorrectly identified as a global multicast address.",
+                                !addr.isMCGlobal());
+
+                addrName = "239.191.255.255"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 reserved multicast address " + addrName
+                                + " incorrectly identified as a global multicast address.",
+                                !addr.isMCGlobal());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isMCNodeLocal()
 	 */
-	public void test_isMCNodeLocal() {
+	public void test_isMCNodeLocal() throws Exception {
 		// Create an IPv4 mulitcast address. It should return
 		// false for node-local mutlicast. There are no valid IPv4
 		// node-local multicast addresses
 
 		String addrName = "";
-		try {
-			addrName = "224.42.42.42"; // a multicast addr 1110 = 224
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 multicast address "
-							+ addrName
-							+ " incorrectly identified as a node-local multicast address.",
-					!addr.isMCNodeLocal());
-
-			addrName = "239.0.0.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 reserved multicast address "
-							+ addrName
-							+ " incorrectly identified as a node-local multicast address.",
-					!addr.isMCNodeLocal());
-
-		} catch (Exception e) {
-			fail("Unknown address : " + e.getMessage());
-		}
+                addrName = "224.42.42.42"; // a multicast addr 1110 = 224
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a node-local multicast address.",
+                                !addr.isMCNodeLocal());
+
+                addrName = "239.0.0.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 reserved multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a node-local multicast address.",
+                                !addr.isMCNodeLocal());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isMCLinkLocal()
 	 */
-	public void test_isMCLinkLocal() {
+	public void test_isMCLinkLocal() throws Exception {
 		// Create an IPv4 mulitcast address. It should return
 		// false for link-local mutlicast. There are no valid IPv4
 		// link-local multicast addresses
 
 		String addrName = "";
-		try {
-			addrName = "224.0.0.0"; // a multicast addr 1110
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 link-local multicast address " + addrName
-					+ " not identified as a link-local multicast address.",
-					addr.isMCLinkLocal());
-
-			addrName = "224.0.0.255"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 link-local multicast address " + addrName
-					+ " not identified as a link-local multicast address.",
-					addr.isMCLinkLocal());
-
-			addrName = "224.0.1.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 global multicast address "
-							+ addrName
-							+ " incorrectly identified as a link-local multicast address.",
-					!addr.isMCLinkLocal());
-
-			addrName = "239.0.0.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 reserved multicast address "
-							+ addrName
-							+ " incorrectly identified as a link-local multicast address.",
-					!addr.isMCLinkLocal());
-
-		} catch (Exception e) {
-			fail("Unknown address : " + addrName);
-		}
+                addrName = "224.0.0.0"; // a multicast addr 1110
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 link-local multicast address " + addrName
+                                + " not identified as a link-local multicast address.",
+                                addr.isMCLinkLocal());
+
+                addrName = "224.0.0.255"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 link-local multicast address " + addrName
+                                + " not identified as a link-local multicast address.",
+                                addr.isMCLinkLocal());
+
+                addrName = "224.0.1.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 global multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a link-local multicast address.",
+                                !addr.isMCLinkLocal());
+
+                addrName = "239.0.0.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 reserved multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a link-local multicast address.",
+                                !addr.isMCLinkLocal());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isMCSiteLocal()
 	 */
-	public void test_isMCSiteLocal() {
+	public void test_isMCSiteLocal() throws Exception {
 		// Create an IPv4 mulitcast address. It should return
 		// false for site-local mutlicast. There are no valid IPv4
 		// site-local multicast addresses
 
 		String addrName = "";
-		try {
-			addrName = "240.0.0.0"; // a multicast addr 1110 = 224
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 multicast address "
-							+ addrName
-							+ " incorrectly identified as a site-local multicast address.",
-					!addr.isMCSiteLocal());
-
-			addrName = "239.0.0.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 reserved multicast address "
-							+ addrName
-							+ " incorrectly identified as a site-local multicast address.",
-					!addr.isMCSiteLocal());
-
-			addrName = "239.255.0.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 site-local multicast address " + addrName
-					+ " not identified as a site-local multicast address.",
-					addr.isMCSiteLocal());
-
-			addrName = "239.255.255.255"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 site-local multicast address " + addrName
-					+ " not identified as a site-local multicast address.",
-					addr.isMCSiteLocal());
-
-			addrName = "239.255.2.2"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 site-local multicast address " + addrName
-					+ " not identified as a site-local multicast address.",
-					addr.isMCSiteLocal());
-
-		} catch (Exception e) {
-			fail("Unknown address : " + addrName);
-		}
+                addrName = "240.0.0.0"; // a multicast addr 1110 = 224
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a site-local multicast address.",
+                                !addr.isMCSiteLocal());
+
+                addrName = "239.0.0.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 reserved multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a site-local multicast address.",
+                                !addr.isMCSiteLocal());
+
+                addrName = "239.255.0.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 site-local multicast address " + addrName
+                                + " not identified as a site-local multicast address.",
+                                addr.isMCSiteLocal());
+
+                addrName = "239.255.255.255"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 site-local multicast address " + addrName
+                                + " not identified as a site-local multicast address.",
+                                addr.isMCSiteLocal());
+
+                addrName = "239.255.2.2"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 site-local multicast address " + addrName
+                                + " not identified as a site-local multicast address.",
+                                addr.isMCSiteLocal());
 	}
 
 	/**
 	 * @tests java.net.Inet4Address#isMCOrgLocal()
 	 */
-	public void test_isMCOrgLocal() {
+	public void test_isMCOrgLocal() throws Exception {
 		// Create an IPv4 mulitcast address. It should return
 		// false for organization-local mutlicast. There are no valid IPv4
 		// organization-local multicast addresses
 
 		String addrName = "";
-		try {
 
-			addrName = "239.191.255.255"; // a multicast addr 1110
-			InetAddress addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 reserved multicast address "
-							+ addrName
-							+ " incorrectly identified as a org-local multicast address.",
-					!addr.isMCOrgLocal());
-
-			addrName = "239.252.0.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue(
-					"IPv4 site-local multicast address "
-							+ addrName
-							+ " incorrectly identified as a org-local multicast address.",
-					!addr.isMCOrgLocal());
-
-			addrName = "239.192.0.0"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 org-local multicast address " + addrName
-					+ " not identified as a org-local multicast address.", addr
-					.isMCOrgLocal());
-
-			addrName = "239.195.255.255"; // a multicast addr 1110
-			addr = InetAddress.getByName(addrName);
-			assertTrue("IPv4 org-local multicast address " + addrName
-					+ " not identified as a org-local multicast address.", addr
-					.isMCOrgLocal());
-
-		} catch (Exception e) {
-			fail("Unknown address : " + addrName);
-		}
+                addrName = "239.191.255.255"; // a multicast addr 1110
+                InetAddress addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 reserved multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a org-local multicast address.",
+                                !addr.isMCOrgLocal());
+
+                addrName = "239.252.0.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue(
+                                "IPv4 site-local multicast address "
+                                                + addrName
+                                                + " incorrectly identified as a org-local multicast address.",
+                                !addr.isMCOrgLocal());
+
+                addrName = "239.192.0.0"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 org-local multicast address " + addrName
+                                + " not identified as a org-local multicast address.", addr
+                                .isMCOrgLocal());
+
+                addrName = "239.195.255.255"; // a multicast addr 1110
+                addr = InetAddress.getByName(addrName);
+                assertTrue("IPv4 org-local multicast address " + addrName
+                                + " not identified as a org-local multicast address.", addr
+                                .isMCOrgLocal());
 	}
     
     // comparator for Inet4Address objects



Mime
View raw message