You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by qi...@apache.org on 2008/09/09 05:19:55 UTC

svn commit: r693355 [4/4] - in /harmony/enhanced/classlib/branches/java6: ./ depends/build/ depends/build/platform/ depends/jars/ make/ modules/archive/src/main/native/zlib/unix/ modules/awt/src/main/native/gl/shared/ modules/awt/src/main/native/lcmm/s...

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/makefile Mon Sep  8 20:19:53 2008
@@ -36,10 +36,6 @@
   $(SHAREDSUB)hystrftime.obj $(SHAREDSUB)hystsl.obj hysysinfo.obj hytime.obj \
   $(SHAREDSUB)hytlshelpers.obj hytty.obj hyvmem.obj
 
-!IF "$(HY_NO_SIG)" == "false"
-BUILDFILES = $(BUILDFILES) hysignal.obj
-!ENDIF
-
 MDLLIBFILES = $(MDLLIBFILES) $(LIBPATH)hythr$(HY_LINKLIB_SUFFIX)
 VIRTFILES = hyprt.res
 

Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile Mon Sep  8 20:19:53 2008
@@ -38,7 +38,7 @@
 SYSLIBFILES = ws2_32.lib Iphlpapi.lib
 
 MDLLIBFILES = #\
-#  $(LIBPATH)hysig.lib $(LIBPATH)hycommon.lib $(LIBPATH)hypool.lib \
+#  $(LIBPATH)hycommon.lib $(LIBPATH)hypool.lib \
 #  $(LIBPATH)hythr.lib $(LIBPATH)vmi.lib $(JPEG_DIR)libjpeg.lib
 
 DLLBASE=0x13300000

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Date.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Date.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Date.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Date.java Mon Sep  8 20:19:53 2008
@@ -17,8 +17,6 @@
 
 package java.sql;
 
-import java.text.SimpleDateFormat;
-
 /**
  * A Date class which can consume and produce dates in SQL Date format.
  * <p>
@@ -168,8 +166,28 @@
      */
     @Override
     public String toString() {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
-        return dateFormat.format(this);
+        StringBuilder sb = new StringBuilder(10);
+
+        format((getYear() + 1900), 4, sb);
+        sb.append('-');
+        format((getMonth() + 1), 2, sb);
+        sb.append('-');
+        format(getDate(), 2, sb);
+
+        return sb.toString();
+    }
+
+    private static final String PADDING = "0000";  //$NON-NLS-1$
+
+    /* 
+    * Private method to format the time 
+    */ 
+    private void format(int date, int digits, StringBuilder sb) { 
+        String str = String.valueOf(date);
+        if (digits - str.length() > 0) {
+            sb.append(PADDING.substring(0, digits - str.length()));
+        }
+        sb.append(str); 
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Time.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Time.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Time.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Time.java Mon Sep  8 20:19:53 2008
@@ -17,7 +17,6 @@
 
 package java.sql;
 
-import java.text.SimpleDateFormat;
 import java.util.Date;
 
 /**
@@ -180,8 +179,28 @@
      */
     @Override
     public String toString() {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss"); //$NON-NLS-1$
-        return dateFormat.format(this);
+        StringBuilder sb = new StringBuilder(8);
+
+        format(getHours(), 2, sb);
+        sb.append(':');
+        format(getMinutes(), 2, sb);
+        sb.append(':');
+        format(getSeconds(), 2, sb);
+
+        return sb.toString();
+    }
+
+    private static final String PADDING = "00";  //$NON-NLS-1$
+
+    /* 
+    * Private method to format the time 
+    */ 
+    private void format(int date, int digits, StringBuilder sb) { 
+        String str = String.valueOf(date);
+        if (digits - str.length() > 0) {
+            sb.append(PADDING.substring(0, digits - str.length()));
+        }
+        sb.append(str); 
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Timestamp.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Timestamp.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Timestamp.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/Timestamp.java Mon Sep  8 20:19:53 2008
@@ -308,62 +308,43 @@
     @SuppressWarnings("deprecation")
     @Override
     public String toString() {
-        /*
-         * Use a DecimalFormat to lay out the nanosecond value as a simple
-         * string of 9 integers, with leading Zeros
-         */
-        DecimalFormat decimalFormat = new DecimalFormat("0"); //$NON-NLS-1$
-        decimalFormat.setMinimumIntegerDigits(9);
-        decimalFormat.setMaximumIntegerDigits(9);
-        String theNanos = decimalFormat.format(nanos);
-        theNanos = stripTrailingZeros(theNanos);
-
-        String year = format((getYear() + 1900), 4);
-        String month = format((getMonth() + 1), 2);
-        String date = format(getDate(), 2);
-        String hours = format(getHours(), 2);
-        String minutes = format(getMinutes(), 2);
-        String seconds = format(getSeconds(), 2);
-
-        return year + '-' + month + '-' + date + ' ' + hours + ':' + minutes
-                + ':' + seconds + '.' + theNanos;
-    }
+        StringBuilder sb = new StringBuilder(29);
 
-    /*
-     * Private method to format the time
-     */
-    private String format(int date, int digits) {
-        StringBuilder dateStringBuffer = new StringBuilder(String.valueOf(date));
-        while (dateStringBuffer.length() < digits) {
-            dateStringBuffer = dateStringBuffer.insert(0, '0');
+        format((getYear() + 1900), 4, sb);
+        sb.append('-');
+        format((getMonth() + 1), 2, sb);
+        sb.append('-');
+        format(getDate(), 2, sb);
+        sb.append(' ');
+        format(getHours(), 2, sb);
+        sb.append(':');
+        format(getMinutes(), 2, sb);
+        sb.append(':');
+        format(getSeconds(), 2, sb);
+        sb.append('.');
+        if (nanos == 0) {
+            sb.append('0');
+        } else {
+            format(nanos, 9, sb);
+            while (sb.charAt(sb.length() - 1) == '0') {
+                sb.setLength(sb.length() - 1);
+            }
         }
-        return dateStringBuffer.toString();
+
+        return sb.toString();
     }
 
-    /*
-     * Private method to strip trailing '0' characters from a string. @param
-     * inputString the starting string @return a string with the trailing zeros
-     * stripped - will leave a single 0 at the beginning of the string
-     */
-    private String stripTrailingZeros(String inputString) {
-        String finalString;
+    private static final String PADDING = "000000000";  //$NON-NLS-1$
 
-        int i;
-        for (i = inputString.length(); i > 0; i--) {
-            if (inputString.charAt(i - 1) != '0') {
-                break;
-            }
-            /*
-             * If the string has a 0 as its first character, return a string
-             * with a single '0'
-             */
-            if (i == 1) {
-                return "0"; //$NON-NLS-1$
-            }
+    /* 
+    * Private method to format the time 
+    */ 
+    private void format(int date, int digits, StringBuilder sb) { 
+        String str = String.valueOf(date);
+        if (digits - str.length() > 0) {
+            sb.append(PADDING.substring(0, digits - str.length()));
         }
-
-        finalString = inputString.substring(0, i);
-        return finalString;
+        sb.append(str); 
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DateTest.java Mon Sep  8 20:19:53 2008
@@ -234,16 +234,26 @@
      * toString() method.
      */
     public void testToString() {
-        // This test is set up for GMT time zone, so need to set the time zone
-        // to GMT first
-        TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
-
-        for (int i = 0; i < TIME_ARRAY.length; i++) {
-            Date theDate = new Date(TIME_ARRAY[i]);
-            assertEquals(SQL_DATEARRAY[i], theDate.toString());
+		// Loop through the timezones testing the String conversion for each
+		for (int i = 0; i < TIMEZONES.length; i++) {
+			testToString(TIMEZONES[i], TIME_ARRAY, SQL_TZ_DATEARRAYS[i]);
+		} // end for
+
+	} // end method testToString()
+
+    private void testToString(String timeZone, long[] theDates, String[] theDateStrings) {
+        // Set the timezone
+        TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+
+        for (int i = 0; i < theDates.length; i++) {
+            // Create the Date object
+            Date theDate = new Date(theDates[i]);
+            // Convert to a date string ... and compare
+            String JDBCString = theDate.toString();
+            assertEquals(theDateStrings[i], JDBCString);
         } // end for
 
-    } // end method testToString()
+    } // end testToString( String, long[], String[] )
 
     /*
      * Test of the void setTime(int) method This does depend on the Time Zone
@@ -374,6 +384,13 @@
             // expected
         }
     }
+    
+    // Reset defualt timezone
+    static TimeZone defaultTimeZone = TimeZone.getDefault();
+    
+    protected void tearDown(){
+    	TimeZone.setDefault(defaultTimeZone);
+    }
 
 } // end class DateTest
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimeTest.java Mon Sep  8 20:19:53 2008
@@ -299,5 +299,13 @@
             // expected
         }
     }
+    
+    
+    // Reset defualt timezone
+    static TimeZone defaultTimeZone = TimeZone.getDefault();
+    
+    protected void tearDown(){
+    	TimeZone.setDefault(defaultTimeZone);
+    }
 } // end class TimeTest
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/TimestampTest.java Mon Sep  8 20:19:53 2008
@@ -109,6 +109,13 @@
     static String[][] STRING_ARRAYS = { STRING_GMT_ARRAY, STRING_LA_ARRAY,
             STRING_JP_ARRAY };
 
+    // Test ToString
+	static String[][] STRING_TIMESTAMP_ARRAYS = {
+			STRING_GMT_ARRAY,
+			new String[] { "1970-01-01 02:45:20.231", "1970-01-01 14:17:59.0",
+					"1969-12-31 05:14:39.309" },
+			new String[]{"1970-01-01 19:45:20.231","1970-01-02 07:17:59.0","1969-12-31 22:14:39.309"} };
+    
     /*
      * Constructor test
      */
@@ -228,6 +235,7 @@
      */
     @SuppressWarnings("deprecation")
     public void testGetDate() {
+    	TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
         for (int i = 0; i < TIME_ARRAY.length; i++) {
             Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
             assertEquals(DATE_ARRAY[i], theTimestamp.getDate());
@@ -240,6 +248,7 @@
      */
     @SuppressWarnings("deprecation")
     public void testGetHours() {
+    	TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
         for (int i = 0; i < TIME_ARRAY.length; i++) {
             Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
             assertEquals(HOURS_ARRAY[i], theTimestamp.getHours());
@@ -277,6 +286,7 @@
     static String theExceptionMessage = "Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff";
 
     public void testValueOfString() {
+    	TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
         for (int i = 0; i < TIME_ARRAY.length; i++) {
             Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
             Timestamp theTimestamp2 = Timestamp.valueOf(STRING_GMT_ARRAY[i]);
@@ -308,7 +318,8 @@
      * Method test for valueOf
      */
     public void testValueOfString1() {
-
+    	TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+    	
         Timestamp theReturn;
         long[] theReturnTime = { 38720231, 38720231, 80279000, -38720691,
                 38720000 };
@@ -350,13 +361,34 @@
      * Method test for toString
      */
     public void testToString() {
-        for (int i = 0; i < TIME_ARRAY.length; i++) {
-            Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
-            assertEquals(STRING_GMT_ARRAY[i], theTimestamp.toString());
-        } // end for
+		for (int i = 0; i < TIME_ARRAY.length; i++) {
+			testToString(TIMEZONES[i], TIME_ARRAY, STRING_TIMESTAMP_ARRAYS[i]);
+		} // end for
+		
+		TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+
+		Timestamp t1 = new Timestamp(Long.MIN_VALUE);
+		assertEquals("292278994-08-17 07:12:55.192", t1.toString()); //$NON-NLS-1$
 
-    } // end method testtoString
+		Timestamp t2 = new Timestamp(Long.MIN_VALUE + 1);
+		assertEquals("292278994-08-17 07:12:55.193", t2.toString()); //$NON-NLS-1$
 
+		Timestamp t3 = new Timestamp(Long.MIN_VALUE + 807);
+		assertEquals("292278994-08-17 07:12:55.999", t3.toString()); //$NON-NLS-1$
+
+		Timestamp t4 = new Timestamp(Long.MIN_VALUE + 808);
+		assertEquals("292269055-12-02 16:47:05.0", t4.toString()); //$NON-NLS-1$
+	} // end method testtoString
+
+    private void testToString(String timeZone, long[] theTimeStamps, String[] theTimeStampStrings) {
+    	TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
+        for (int i = 0; i < TIME_ARRAY.length; i++) {
+            Timestamp theTimestamp = new Timestamp(theTimeStamps[i]);
+            assertEquals(theTimeStampStrings[i], theTimestamp.toString());
+        } // end for
+    	
+    }
+    
     /*
      * Method test for getNanos
      */
@@ -372,6 +404,8 @@
      * Method test for setNanos
      */
     public void testSetNanosint() {
+    	TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+    	
         int[] NANOS_INVALID = { -137891990, 1635665198, -1 };
         for (int i = 0; i < TIME_ARRAY.length; i++) {
             Timestamp theTimestamp = new Timestamp(TIME_ARRAY[i]);
@@ -599,22 +633,10 @@
         SerializationTest.verifyGolden(this, object);
     }
 
-    /**
-     * @tests java.sql.Timestamp#toString()
-     */
-    public void test_toString() {
-
-        Timestamp t1 = new Timestamp(Long.MIN_VALUE);
-        assertEquals("292278994-08-17 07:12:55.192", t1.toString()); //$NON-NLS-1$
-
-        Timestamp t2 = new Timestamp(Long.MIN_VALUE + 1);
-        assertEquals("292278994-08-17 07:12:55.193", t2.toString()); //$NON-NLS-1$
-
-        Timestamp t3 = new Timestamp(Long.MIN_VALUE + 807);
-        assertEquals("292278994-08-17 07:12:55.999", t3.toString()); //$NON-NLS-1$
-
-        Timestamp t4 = new Timestamp(Long.MIN_VALUE + 808);
-        assertEquals("292269055-12-02 16:47:05.0", t4.toString()); //$NON-NLS-1$
+    // Reset defualt timezone
+    TimeZone defaultTimeZone = TimeZone.getDefault();
+    
+    protected void tearDown(){
+    	TimeZone.setDefault(defaultTimeZone);
     }
-
 } // end class TimestampTest

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/CipherSuite.java Mon Sep  8 20:19:53 2008
@@ -364,7 +364,7 @@
      * @return
      */
     public static CipherSuite getByCode(byte b1, byte b2) {
-        if (b1 != 0 || b2 > cuitesByCode.length) {
+        if (b1 != 0 || (b2 & 0xFF) > cuitesByCode.length) {
             // Unknoun
             return new CipherSuite("UNKNOUN_" + b1 + "_" + b2, false, 0, "",
                     "", new byte[] { b1, b2 });
@@ -383,7 +383,7 @@
      */
     public static CipherSuite getByCode(byte b1, byte b2, byte b3) {
         if (b1 == 0 && b2 == 0) {
-            if (b3 <= cuitesByCode.length) {
+            if ((b3 & 0xFF) <= cuitesByCode.length) {
                 return cuitesByCode[b3];
             }
         }

Modified: harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/x-net/src/main/java/org/apache/harmony/xnet/provider/jsse/ServerHandshakeImpl.java Mon Sep  8 20:19:53 2008
@@ -323,31 +323,25 @@
      * @param bytes
      */
     public void unwrapSSLv2(byte[] bytes) {
+        io_stream.append(bytes);
+        io_stream.mark();
         try {
-            io_stream.append(bytes);
-            io_stream.mark();
-            try {
-                clientHello = new ClientHello(io_stream);
-            } catch (IOException e) {
-                io_stream.reset();
-                return;
-            }
-            if (nonBlocking) {
-                delegatedTasks.add(new DelegatedTask(
-                        new PrivilegedExceptionAction(){ 
-                    public Object run() throws Exception {
-                        processClientHello();
-                        return null;
+            clientHello = new ClientHello(io_stream);
+        } catch (IOException e) {
+            io_stream.reset();
+            return;
+        }
+        if (nonBlocking) {
+            delegatedTasks.add(new DelegatedTask(
+                    new PrivilegedExceptionAction() {
+                        public Object run() throws Exception {
+                            processClientHello();
+                            return null;
                         }
-                    },
-                    this,
-                    AccessController.getContext()));
-                return;
-            }
-            processClientHello();
-        } catch (Exception e) {
-            fatalAlert(AlertProtocol.INTERNAL_ERROR, "INTERNAL ERROR", e);
+                    }, this, AccessController.getContext()));
+            return;
         }
+        processClientHello();
     }
 
     /**

Modified: harmony/enhanced/classlib/branches/java6/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java?rev=693355&r1=693354&r2=693355&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/support/src/test/java/org/apache/harmony/testframework/serialization/SerializationTest.java Mon Sep  8 20:19:53 2008
@@ -35,6 +35,8 @@
 import java.lang.reflect.Method;
 import java.security.Permission;
 import java.security.PermissionCollection;
+import java.security.UnresolvedPermission;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -297,11 +299,88 @@
             Collection<Permission> tstCollection = new HashSet<Permission>(
                     Collections.list(dserPC.elements()));
 
-            Assert.assertEquals(refCollection, tstCollection);
+            Assert.assertEquals(refCollection.size(), tstCollection.size());
+            int size = refCollection.size();
+            if (size > 0) {
+				ArrayList<Permission> refList = Collections.list(initPC
+						.elements());
+				ArrayList<Permission> tstList = Collections.list(dserPC
+						.elements());
+				if (refList.get(0) instanceof UnresolvedPermission
+						&& tstList.get(0) instanceof UnresolvedPermission) {
+					boolean found;
+					UnresolvedPermission refPerm, tstPerm;
+					for (int i = 0; i < size; i++) {
+						found = false;
+						refPerm = (UnresolvedPermission) refList.get(i);
+						for (int j = 0; j < size; j++) {
+							tstPerm = (UnresolvedPermission) tstList.get(i);
+							if (equalsUnresolvedPermission(refPerm, tstPerm)) {
+								found = true;
+								break;
+							}
+						}
+
+						Assert.assertTrue(found);
+					}
+				} else {
+					Assert.assertEquals(refCollection, tstCollection);
+				}
+			}
         }
+    
+        /*
+		 * check whether the given two UnresolvedPermission objects equal to
+		 * each other
+		 */
+		private boolean equalsUnresolvedPermission(UnresolvedPermission up1,
+				UnresolvedPermission up2) {
+			java.security.cert.Certificate[] certs = up1.getUnresolvedCerts();
+			if (certs != null && certs.length == 0) {
+				if (null == up2.getUnresolvedCerts()) {
+					if (up1.getName().equals(up2.getName())) {
+						String up1Name = up1.getUnresolvedName();
+						String up2Name = up2.getUnresolvedName();
+						if (up1Name == null ? up2Name == null : up1Name
+								.equals(up2Name)) {
+							String up1Actions = up1.getUnresolvedActions();
+							String up2Actions = up2.getUnresolvedActions();
+							return up1Actions == null ? up2Actions == null
+									: up1Actions.equals(up2Actions);
+						}
+					}
+				}
+				return false;
+			}
+			return up1.equals(up2);
+		}
     };
 
     /**
+	 * Comparator for java.security.UnresolvedPermission objects
+	 */
+	public final static SerializableAssert UNRESOLVED_PERMISSION_COMPARATOR = new SerializableAssert() {
+		public void assertDeserialized(Serializable initial,
+				Serializable deserialized) {
+			UnresolvedPermission initPerm = (UnresolvedPermission) initial;
+			UnresolvedPermission dserPerm = (UnresolvedPermission) deserialized;
+			java.security.cert.Certificate[] certs = initPerm
+					.getUnresolvedCerts();
+			if (certs != null && certs.length == 0) {
+				Assert.assertEquals(initPerm.getUnresolvedType(), dserPerm
+						.getUnresolvedType());
+				Assert.assertEquals(initPerm.getUnresolvedName(), dserPerm
+						.getUnresolvedName());
+				Assert.assertEquals(initPerm.getUnresolvedActions(), dserPerm
+						.getUnresolvedActions());
+				Assert.assertNull(dserPerm.getUnresolvedCerts());
+			} else {
+				Assert.assertEquals(initPerm, dserPerm);
+			}
+		}
+	};
+    
+    /**
      * Returns <code>comparator</code> for provided serializable
      * <code>object</code>.
      * 
@@ -332,6 +411,11 @@
                 new Class[] { Object.class });
 
         if (m.getDeclaringClass() != Object.class) {
+        	if (object instanceof UnresolvedPermission) {
+				// object is an instance of UnresolvedPermission, use
+				// UNRESOLVED_PERMISSION_COMPARATOR
+				return UNRESOLVED_PERMISSION_COMPARATOR;
+			}
             // one of classes overrides Object.equals(Object) method
             // use default comparator
             return DEFAULT_COMPARATOR;