harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smish...@apache.org
Subject svn commit: r434378 - in /incubator/harmony/enhanced/classlib/trunk/modules/prefs: META-INF/ src/main/java/java/util/prefs/ src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/ src/test/resources/serialization/ src/test/resources/serialization...
Date Thu, 24 Aug 2006 12:07:32 GMT
Author: smishura
Date: Thu Aug 24 05:07:29 2006
New Revision: 434378

URL: http://svn.apache.org/viewvc?rev=434378&view=rev
Log:
Fix for InvalidPreferencesFormatException:

-Remove throwing NotSerializableException: the statement that the class is not Serializable
was removed from 1.5 spec

-Fix the test to use new testing framework

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/java/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/java/util/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/java/util/prefs/
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.golden.ser
  (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/META-INF/MANIFEST.MF
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
    incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/prefs/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/prefs/META-INF/MANIFEST.MF?rev=434378&r1=434377&r2=434378&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/prefs/META-INF/MANIFEST.MF (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/prefs/META-INF/MANIFEST.MF Thu Aug 24
05:07:29 2006
@@ -1,24 +1,25 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Harmony Prefs
-Bundle-SymbolicName: org.apache.harmony.prefs
-Bundle-Version: 1.0.0
-Bundle-ClassPath: .
-Eclipse-JREBundle: true
-Import-Package: java.io,
- java.lang,
- java.lang.reflect;resolution:=optional,
- java.net,
- java.nio,
- java.nio.channels,
- java.nio.charset,
- java.security,
- java.util,
- javax.xml.parsers,
- javax.xml.transform,
- org.apache.harmony.luni.util,
- org.apache.xpath,
- org.w3c.dom,
- org.xml.sax,
- tests.util;resolution:=optional;hy_usage=test
-Export-Package: java.util.prefs
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Harmony Prefs
+Bundle-SymbolicName: org.apache.harmony.prefs
+Bundle-Version: 1.0.0
+Bundle-ClassPath: .
+Eclipse-JREBundle: true
+Import-Package: java.io,
+ java.lang,
+ java.lang.reflect;resolution:=optional,
+ java.net,
+ java.nio,
+ java.nio.channels,
+ java.nio.charset,
+ java.security,
+ java.util,
+ javax.xml.parsers,
+ javax.xml.transform,
+ org.apache.harmony.luni.util,
+ org.apache.xpath,
+ org.w3c.dom,
+ org.xml.sax,
+ org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional,
+ tests.util;resolution:=optional;hy_usage=test
+Export-Package: java.util.prefs

Modified: incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java?rev=434378&r1=434377&r2=434378&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
Thu Aug 24 05:07:29 2006
@@ -24,9 +24,6 @@
  * An exception to indicate that the input XML file is not well-formed or 
  * validating to the appropriate document type, which is specified by 
  * <code>Preferences</code>. 
- * <p>
- * Please note that this class cannot be serialized actually, so relevant 
- * serialization methods only throw <code>NotSerializableException</code>.</p>
  * 
  * @see Preferences
  *
@@ -66,22 +63,6 @@
 	public InvalidPreferencesFormatException (Throwable t) {
 		super(t);
 	}
-	
-    /*
-     * This method always throws a <code>NotSerializableException</code>, because

-     * this object cannot be serialized,  
-     */
-	private void writeObject(ObjectOutputStream out) throws NotSerializableException{
-	    throw new NotSerializableException();	    
-	}
-	
-    /*
-     * This method always throws a <code>NotSerializableException</code>, because

-     * this object cannot be serialized,  
-     */
-	private void readObject(ObjectInputStream in) throws NotSerializableException{
-	    throw new NotSerializableException();	    
-	}	
 }
 
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java?rev=434378&r1=434377&r2=434378&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/java/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.java
Thu Aug 24 05:07:29 2006
@@ -1,76 +1,83 @@
-/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
- * 
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.prefs.tests.java.util.prefs;
-
-import java.io.NotSerializableException;
-import java.util.prefs.InvalidPreferencesFormatException;
-
-import tests.util.SerializationTester;
-
-import junit.framework.TestCase;
-
-/**
- * 
- */
-public class InvalidPreferencesFormatExceptionTest extends TestCase {
-
-	/*
-	 * Class under test for void InvalidPreferencesFormatException(String)
-	 */
-	public void testInvalidPreferencesFormatExceptionString() {
-		InvalidPreferencesFormatException e = new InvalidPreferencesFormatException(
-				"msg");
-		assertNull(e.getCause());
-		assertEquals("msg", e.getMessage());
-	}
-
-	/*
-	 * Class under test for void InvalidPreferencesFormatException(String,
-	 * Throwable)
-	 */
-	public void testInvalidPreferencesFormatExceptionStringThrowable() {
-		Throwable t = new Throwable("root");
-		InvalidPreferencesFormatException e = new InvalidPreferencesFormatException(
-				"msg", t);
-		assertSame(t, e.getCause());
-		assertTrue(e.getMessage().indexOf("root") < 0);
-		assertTrue(e.getMessage().indexOf(t.getClass().getName()) < 0);
-		assertTrue(e.getMessage().indexOf("msg") >= 0);
-	}
-
-	/*
-	 * Class under test for void InvalidPreferencesFormatException(Throwable)
-	 */
-	public void testInvalidPreferencesFormatExceptionThrowable() {
-		Throwable t = new Throwable("root");
-		InvalidPreferencesFormatException e = new InvalidPreferencesFormatException(
-				t);
-		assertSame(t, e.getCause());
-		assertTrue(e.getMessage().indexOf("root") >= 0);
-		assertTrue(e.getMessage().indexOf(t.getClass().getName()) >= 0);
-	}
-
-	public void testSerialization() throws Exception {
-		try {
-			SerializationTester.writeObject(
-					new InvalidPreferencesFormatException("msg"), "test.txt");
-			fail();
-		} catch (NotSerializableException e) {
-		}
-	}
-
-}
-
+/* Copyright 2005 The Apache Software Foundation or its licensors, as applicable
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.prefs.tests.java.util.prefs;
+
+import java.util.prefs.InvalidPreferencesFormatException;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+
+/**
+ * 
+ */
+public class InvalidPreferencesFormatExceptionTest extends TestCase {
+
+	/*
+	 * Class under test for void InvalidPreferencesFormatException(String)
+	 */
+	public void testInvalidPreferencesFormatExceptionString() {
+		InvalidPreferencesFormatException e = new InvalidPreferencesFormatException(
+				"msg");
+		assertNull(e.getCause());
+		assertEquals("msg", e.getMessage());
+	}
+
+	/*
+	 * Class under test for void InvalidPreferencesFormatException(String,
+	 * Throwable)
+	 */
+	public void testInvalidPreferencesFormatExceptionStringThrowable() {
+		Throwable t = new Throwable("root");
+		InvalidPreferencesFormatException e = new InvalidPreferencesFormatException(
+				"msg", t);
+		assertSame(t, e.getCause());
+		assertTrue(e.getMessage().indexOf("root") < 0);
+		assertTrue(e.getMessage().indexOf(t.getClass().getName()) < 0);
+		assertTrue(e.getMessage().indexOf("msg") >= 0);
+	}
+
+	/*
+	 * Class under test for void InvalidPreferencesFormatException(Throwable)
+	 */
+	public void testInvalidPreferencesFormatExceptionThrowable() {
+		Throwable t = new Throwable("root");
+		InvalidPreferencesFormatException e = new InvalidPreferencesFormatException(
+				t);
+		assertSame(t, e.getCause());
+		assertTrue(e.getMessage().indexOf("root") >= 0);
+		assertTrue(e.getMessage().indexOf(t.getClass().getName()) >= 0);
+	}
+
+    /**
+     * @tests serialization/deserialization.
+     */
+    public void testSerializationSelf() throws Exception {
+
+        SerializationTest.verifySelf(new InvalidPreferencesFormatException(
+                "msg"));
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+
+        SerializationTest.verifyGolden(this,
+                new InvalidPreferencesFormatException("msg"));
+    }
+}
+

Added: incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.golden.ser
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.golden.ser?rev=434378&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/harmony/enhanced/classlib/trunk/modules/prefs/src/test/resources/serialization/org/apache/harmony/prefs/tests/java/util/prefs/InvalidPreferencesFormatExceptionTest.golden.ser
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message