harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r548684 [3/3] - in /harmony/enhanced/classlib/branches/java6/modules: awt/make/ awt/src/main/native/fontlib/shared/ beans/src/main/java/java/beans/beancontext/ beans/src/main/java/org/apache/harmony/beans/internal/nls/ jndi/META-INF/ jndi/s...
Date Tue, 19 Jun 2007 10:37:07 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/accessors.rc
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/accessors.rc?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/accessors.rc (original)
+++ harmony/enhanced/classlib/branches/java6/modules/misc/src/main/native/accessors/windows/accessors.rc Tue Jun 19 03:37:02 2007
@@ -1,9 +1,10 @@
 ;
-; Copyright 1998, 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
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You 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
 ; 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyprt.rc
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyprt.rc?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyprt.rc (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/port/windows/hyprt.rc Tue Jun 19 03:37:02 2007
@@ -1,9 +1,10 @@
 ;
-; Copyright 1998, 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
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You 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
 ; 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/hysig.rc
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/hysig.rc?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/hysig.rc (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/hysig.rc Tue Jun 19 03:37:02 2007
@@ -1,9 +1,10 @@
 ;
-; Copyright 2003, 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
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You 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
 ; 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/makefile?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/sig/windows/makefile Tue Jun 19 03:37:02 2007
@@ -1,8 +1,9 @@
-# Copyright 2003, 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
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
 # 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/windows/hythr.rc
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/windows/hythr.rc?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/windows/hythr.rc (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thread/windows/hythr.rc Tue Jun 19 03:37:02 2007
@@ -1,9 +1,10 @@
 ;
-; Copyright 1998, 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
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You 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
 ; 

Modified: harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/hythr.rc
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/hythr.rc?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/hythr.rc (original)
+++ harmony/enhanced/classlib/branches/java6/modules/portlib/src/main/native/thrstub/windows/hythr.rc Tue Jun 19 03:37:02 2007
@@ -1,9 +1,10 @@
 ;
-; Copyright 1998, 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
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You 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
 ; 

Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/hyprefs.rc
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/hyprefs.rc?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/hyprefs.rc (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/hyprefs.rc Tue Jun 19 03:37:02 2007
@@ -1,9 +1,10 @@
 ;
-; Copyright 1998, 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
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements.  See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You 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
 ; 

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/KeyStore.java Tue Jun 19 03:37:02 2007
@@ -380,12 +380,8 @@
         if (!isInit) {
             throw new KeyStoreException(NOTINITKEYSTORE);
         }
-        if (stream == null) {
-            throw new IOException(Messages.getString("security.51")); //$NON-NLS-1$
-        }
-        if (password == null) {
-            throw new IOException(Messages.getString("security.50")); //$NON-NLS-1$
-        }
+
+        //Just delegate stream and password to implSpi
         implSpi.engineStore(stream, password);
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/UnresolvedPermission.java Tue Jun 19 03:37:02 2007
@@ -57,16 +57,12 @@
      */
     private static final long serialVersionUID = -4821973115467008846L;
 
-    private static final ObjectStreamField serialPersistentFields[] = {
-        new ObjectStreamField("type", String.class), //$NON-NLS-1$
-        new ObjectStreamField("name", String.class), //$NON-NLS-1$
-        new ObjectStreamField("actions", String.class), }; //$NON-NLS-1$
 
-    // Target name
-    private transient String targetName;
-
-    //Target actions
-    private transient String targetActions;
+    private String type;    
+    
+    private String name;
+    
+    private String actions;
 
     // The signer certificates 
     private transient Certificate[] targetCerts;
@@ -89,8 +85,9 @@
                                 Certificate[] certs) {
         super(type);
         checkType(type);
-        targetName = name;
-        targetActions = actions;
+        this.type = type;
+        this.name = name;
+        this.actions = actions;
         if (certs != null && certs.length != 0) {
             //TODO filter non-signer certificates ???
             List tmp = new ArrayList();
@@ -142,10 +139,10 @@
         if (obj instanceof UnresolvedPermission) {
             UnresolvedPermission that = (UnresolvedPermission)obj;
             if (getName().equals(that.getName())
-                && (targetName == null ? that.targetName == null 
-                    : targetName.equals(that.targetName))
-                && (targetActions == null ? that.targetActions == null
-                    : targetActions.equals(that.targetActions))
+                && (name == null ? that.name == null 
+                    : name.equals(that.name))
+                && (actions == null ? that.actions == null
+                    : actions.equals(that.actions))
                 && (PolicyUtils.matchSubset(targetCerts, that.targetCerts) 
                     && PolicyUtils.matchSubset(that.targetCerts, targetCerts))) {
                 return true;
@@ -166,11 +163,11 @@
     public int hashCode() {
         if (hash == 0) {
             hash = getName().hashCode();
-            if (targetName != null) {
-                hash ^= targetName.hashCode();
+            if (name != null) {
+                hash ^= name.hashCode();
             }
-            if (targetActions != null) {
-                hash ^= targetActions.hashCode();
+            if (actions != null) {
+                hash ^= actions.hashCode();
             }
         }
         return hash;
@@ -190,14 +187,14 @@
      * @com.intel.drl.spec_ref 
      */
     public String getUnresolvedName() {
-        return targetName;
+        return name;
     }
 
     /** 
      * @com.intel.drl.spec_ref 
      */
     public String getUnresolvedActions() {
-        return targetActions;
+        return actions;
     }
 
     /** 
@@ -244,8 +241,8 @@
 	 * @return a printable representation for the receiver.
 	 */
     public String toString() {
-        return "(unresolved " + getName() + " " + targetName + " " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-            + targetActions + ")"; //$NON-NLS-1$
+        return "(unresolved " + type + " " + name + " " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+            + actions + ")"; //$NON-NLS-1$
     }
 
 	/**
@@ -281,8 +278,8 @@
         if (PolicyUtils.matchSubset(targetCerts, targetType.getSigners())) {
             try {
                 return PolicyUtils.instantiatePermission(targetType,
-                                                         targetName,
-                                                         targetActions);
+                                                         name,
+                                                         actions);
             } catch (Exception ignore) {
                 //TODO log warning?
             }
@@ -311,11 +308,7 @@
      *  @see  <a href="http://java.sun.com/j2se/1.5.0/docs/api/serialized-form.html#java.security.UnresolvedPermission">Java Spec</a>
      */
     private void writeObject(ObjectOutputStream out) throws IOException {
-        ObjectOutputStream.PutField fields = out.putFields();
-        fields.put("type", getUnresolvedType()); //$NON-NLS-1$
-        fields.put("name", getUnresolvedName()); //$NON-NLS-1$
-        fields.put("actions", getUnresolvedActions()); //$NON-NLS-1$
-        out.writeFields();
+        out.defaultWriteObject();
         if (targetCerts == null) {
             out.writeInt(0);
         } else {
@@ -342,13 +335,8 @@
      */
     private void readObject(ObjectInputStream in) throws IOException,
         ClassNotFoundException {
-        checkType(getUnresolvedType());
-        ObjectInputStream.GetField fields = in.readFields();
-        if (!getUnresolvedType().equals(fields.get("type", null))) { //$NON-NLS-1$
-            throw new InvalidObjectException(Messages.getString("security.31")); //$NON-NLS-1$
-        }
-        targetName = (String)fields.get("name", null); //$NON-NLS-1$
-        targetActions = (String)fields.get("actions", null); //$NON-NLS-1$
+        in.defaultReadObject();        
+        checkType(getUnresolvedType());      
         int certNumber = in.readInt();
         if (certNumber != 0) {
             targetCerts = new Certificate[certNumber];

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/org/apache/harmony/security/fortress/DefaultPolicyParser.java Tue Jun 19 03:37:02 2007
@@ -198,7 +198,7 @@
             if ("file".equals(codebase.getProtocol())) { //$NON-NLS-1$
             	File codeFile = new File(codebase.getFile());
             	if (codeFile.isAbsolute()) {
-            		codebase = new URL("file://" +  //$NON-NLS-1$
+            		codebase = new URL("file:/" +  //$NON-NLS-1$
                             codeFile.getAbsolutePath());            		
             	}
             }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java Tue Jun 19 03:37:02 2007
@@ -143,6 +143,11 @@
         mockKeyStore.setCertificateEntry("Alias", null);
     }
     
+    public void test_store_null() throws Exception {
+        mockKeyStore.load(null, null);
+        mockKeyStore.store(null, null);
+    }
+    
     protected void setUp() throws Exception {
         super.setUp();
         mockKeyStore = new MyKeyStore(new MyKeyStoreSpi(), null, "MyKeyStore");

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnresolvedPermissionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnresolvedPermissionTest.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnresolvedPermissionTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/UnresolvedPermissionTest.java Tue Jun 19 03:37:02 2007
@@ -17,10 +17,16 @@
 
 package org.apache.harmony.security.tests.java.security;
 
+import java.io.Serializable;
 import java.security.AllPermission;
 import java.security.SecurityPermission;
 import java.security.UnresolvedPermission;
 
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+import tests.util.SerializationTester;
+
 import junit.framework.TestCase;
 
 /**
@@ -74,5 +80,42 @@
         assertFalse(up.implies(up));
         assertFalse(up.implies(new AllPermission()));
         assertFalse(up.implies(new SecurityPermission("a.b.c")));
+    }
+    
+    public void testSerialization() throws Exception {
+        UnresolvedPermission up = new UnresolvedPermission(
+                "java.security.SecurityPermission", "a.b.c", "actions", null);
+        assertEquals("java.security.SecurityPermission", up.getUnresolvedType());
+        assertEquals("a.b.c", up.getUnresolvedName());
+        assertEquals("actions", up.getUnresolvedActions());
+        assertNull(up.getUnresolvedCerts());
+
+        UnresolvedPermission deserializedUp = (UnresolvedPermission) SerializationTester
+                .getDeserilizedObject(up);
+        assertEquals("java.security.SecurityPermission", deserializedUp
+                .getUnresolvedType());
+        assertEquals("a.b.c", deserializedUp.getUnresolvedName());
+        assertEquals("actions", deserializedUp.getUnresolvedActions());
+        assertNull(deserializedUp.getUnresolvedCerts());
+    }
+    
+    public void testSerialization_Compatibility() throws Exception {
+        UnresolvedPermission up = new UnresolvedPermission(
+                "java.security.SecurityPermission", "a.b.c", "actions", null);
+        assertEquals("java.security.SecurityPermission", up.getUnresolvedType());
+        assertEquals("a.b.c", up.getUnresolvedName());
+        assertEquals("actions", up.getUnresolvedActions());
+        assertNull(up.getUnresolvedCerts());
+
+        SerializationTest.verifyGolden(this, up, new SerializableAssert() {
+            public void assertDeserialized(Serializable orig, Serializable ser) {
+                UnresolvedPermission deserializedUp = (UnresolvedPermission) ser;
+                assertEquals("java.security.SecurityPermission", deserializedUp
+                        .getUnresolvedType());
+                assertEquals("a.b.c", deserializedUp.getUnresolvedName());
+                assertEquals("actions", deserializedUp.getUnresolvedActions());
+                assertNull(deserializedUp.getUnresolvedCerts());
+            }
+        });
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KeyStore_Impl3Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KeyStore_Impl3Test.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KeyStore_Impl3Test.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/test/impl/java/org/apache/harmony/security/tests/java/security/KeyStore_Impl3Test.java Tue Jun 19 03:37:02 2007
@@ -142,11 +142,8 @@
             } catch (NullPointerException e) {
             }
 
-            try {
-                kss[i].store(bos, null);
-                fail("store(...) does not throw any exception when password is null");
-            } catch (IOException e) {
-            }
+            //RI does not throw exception while password is null.
+            kss[i].store(bos, null);
 
             kss[i].store(bos, pwd);
             ByteArrayInputStream bis = new ByteArrayInputStream(bos

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DriverManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DriverManager.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DriverManager.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/DriverManager.java Tue Jun 19 03:37:02 2007
@@ -17,6 +17,8 @@
 
 package java.sql;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Properties;
 import java.util.Enumeration;
 import java.util.Iterator;
@@ -51,7 +53,7 @@
      * Set to hold Registered Drivers - initial capacity 10 drivers (will expand
      * automatically if necessary.
      */
-    private static final Set<Driver> theDriverSet = new HashSet<Driver>(10);
+    private static final List<Driver> theDrivers = new ArrayList<Driver>(10);
 
     // Permission for setting log
     private static final SQLPermission logPermission = new SQLPermission("setLog"); //$NON-NLS-1$
@@ -121,8 +123,8 @@
             // sql.1=DriverManager: calling class not authorized to deregister JDBC driver
             throw new SecurityException(Messages.getString("sql.1")); //$NON-NLS-1$
         } // end if
-        synchronized (theDriverSet) {
-            theDriverSet.remove(driver);
+        synchronized (theDrivers) {
+            theDrivers.remove(driver);
         }
     }
 
@@ -168,13 +170,13 @@
             // sql.5=The url cannot be null
             throw new SQLException(Messages.getString("sql.5"), sqlState); //$NON-NLS-1$
         }
-        synchronized (theDriverSet) {
+        synchronized (theDrivers) {
             /*
              * Loop over the drivers in the DriverSet checking to see if one can
              * open a connection to the supplied URL - return the first
              * connection which is returned
              */
-            for (Driver theDriver : theDriverSet) {
+            for (Driver theDriver : theDrivers) {
                 Connection theConnection = theDriver.connect(url, info);
                 if (theConnection != null) {
                     return theConnection;
@@ -226,13 +228,13 @@
     public static Driver getDriver(String url) throws SQLException {
         ClassLoader callerClassLoader = VM.callerClassLoader();
 
-        synchronized (theDriverSet) {
+        synchronized (theDrivers) {
             /*
              * Loop over the drivers in the DriverSet checking to see if one
              * does understand the supplied URL - return the first driver which
              * does understand the URL
              */
-            Iterator<Driver> theIterator = theDriverSet.iterator();
+            Iterator<Driver> theIterator = theDrivers.iterator();
             while (theIterator.hasNext()) {
                 Driver theDriver = theIterator.next();
                 if (theDriver.acceptsURL(url)
@@ -261,13 +263,13 @@
          * Synchronize to avoid clashes with additions and removals of drivers
          * in the DriverSet
          */
-        synchronized (theDriverSet) {
+        synchronized (theDrivers) {
             /*
              * Create the Enumeration by building a Vector from the elements of
              * the DriverSet
              */
             Vector<Driver> theVector = new Vector<Driver>();
-            Iterator<Driver> theIterator = theDriverSet.iterator();
+            Iterator<Driver> theIterator = theDrivers.iterator();
             while (theIterator.hasNext()) {
                 Driver theDriver = theIterator.next();
                 if (DriverManager.isClassFromClassLoader(theDriver,
@@ -345,8 +347,8 @@
         if (driver == null) {
             throw new NullPointerException();
         }
-        synchronized (theDriverSet) {
-            theDriverSet.add(driver);
+        synchronized (theDrivers) {
+            theDrivers.add(driver);
         }
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/ConnectionEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/ConnectionEvent.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/ConnectionEvent.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/ConnectionEvent.java Tue Jun 19 03:37:02 2007
@@ -30,7 +30,7 @@
 
     private static final long serialVersionUID = -4843217645290030002L;
 
-    private SQLException theSQLException;
+    private SQLException ex;
 
     /**
      * Creates a connection event initialized with a supplied PooledConnection.
@@ -56,7 +56,7 @@
     public ConnectionEvent(PooledConnection theConnection,
             SQLException theException) {
         super(theConnection);
-        theSQLException = theException;
+        ex = theException;
     }
 
     /**
@@ -67,6 +67,6 @@
      *         null if no error has occurred.
      */
     public SQLException getSQLException() {
-        return theSQLException;
+        return ex;
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/BaseRowSet.java Tue Jun 19 03:37:02 2007
@@ -32,7 +32,6 @@
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.util.Calendar;
-import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Map;
 import java.util.Vector;
@@ -86,7 +85,7 @@
 
     private int isolation;
 
-    private int fetchDir;
+    private int fetchDir = ResultSet.FETCH_FORWARD;
 
     private int fetchSize;
 
@@ -278,13 +277,11 @@
     }
 
     public Map<String, Class<?>> getTypeMap() {
-        //TODO determine if copy is necessary
-        return new HashMap<String, Class<?>>(map);
+        return map;
     }
 
     public void setTypeMap(Map<String, Class<?>> map) {
-        //TODO determine if copy is necessary
-        this.map = new HashMap<String, Class<?>>(map);
+        this.map = map;
     }
 
     public int getMaxFieldSize() throws SQLException {

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/DefaultUDTMap.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/DefaultUDTMap.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/DefaultUDTMap.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/DefaultUDTMap.java Tue Jun 19 03:37:02 2007
@@ -21,6 +21,7 @@
 import java.sql.Array;
 import java.sql.Blob;
 import java.sql.Clob;
+import java.sql.SQLException;
 import java.sql.Struct;
 import java.sql.Types;
 import java.util.HashMap;
@@ -34,45 +35,45 @@
                 || type == Types.DATALINK || type == Types.STRUCT || type == Types.JAVA_OBJECT);
     }
 
-    public static SerialDatalink[] processObject(URL[] elements)
+    public static SerialDatalink[] processDatalink(Object[] elements)
             throws SerialException {
         SerialDatalink[] ret = new SerialDatalink[elements.length];
         for (int i = 0; i < elements.length; i++) {
-            ret[i] = new SerialDatalink(elements[i]);
+            ret[i] = new SerialDatalink((URL)elements[i]);
         }
         return ret;
     }
 
-    public static Struct[] processObject(Struct[] elements)
+    public static Struct[] processStruct(Object[] elements)
             throws SerialException {
         Struct[] ret = new Struct[elements.length];
         for (int i = 0; i < elements.length; i++) {
-            ret[i] = elements[i];
+            ret[i] = (Struct)elements[i];
         }
         return ret;
     }
 
-    public static Array[] processObject(Array[] elements)
+    public static Array[] processArray(Object[] elements)
             throws SerialException {
         Array[] ret = new Array[elements.length];
         for (int i = 0; i < elements.length; i++) {
-            ret[i] = elements[i];
+            ret[i] = (Array)elements[i];
         }
         return ret;
     }
 
-    public static Clob[] processObject(Clob[] elements) throws SerialException {
+    public static Clob[] processClob(Object[] elements) throws SQLException {
         Clob[] ret = new Clob[elements.length];
         for (int i = 0; i < elements.length; i++) {
-            ret[i] = elements[i];
+            ret[i] = new SerialClob((Clob)elements[i]);
         }
         return ret;
     }
 
-    public static Blob[] processObject(Blob[] elements) throws SerialException {
+    public static Blob[] processBlob(Object[] elements) throws SQLException {
         Blob[] ret = new Blob[elements.length];
         for (int i = 0; i < elements.length; i++) {
-            ret[i] = elements[i];
+            ret[i] = new SerialBlob((Blob)elements[i]);
         }
         return ret;
     }
@@ -89,3 +90,4 @@
         return ret;
     }
 }
+

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialArray.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialArray.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialArray.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialArray.java Tue Jun 19 03:37:02 2007
@@ -18,13 +18,9 @@
 package javax.sql.rowset.serial;
 
 import java.io.Serializable;
-import java.net.URL;
 import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.sql.Struct;
 import java.sql.Types;
 import java.util.Map;
 
@@ -62,51 +58,74 @@
     public SerialArray(Array array, Map<String, Class<?>> map)
             throws SerialException, SQLException {
         if (null == array || null == array.getArray() || null == map) {
-            throw new SQLException(Messages.getString("sql.39"));
+            throw new SQLException(Messages.getString("sql.39")); //$NON-NLS-1$
         }
         baseType = array.getBaseType();
         baseTypeName = array.getBaseTypeName();
         Object[] element = (Object[]) array.getArray(map);
-
-        switch (baseType) {
-        case Types.STRUCT:
-            elements = DefaultUDTMap.processObject((Struct[])element);
-            break;
-        case Types.ARRAY:
-            elements = DefaultUDTMap.processObject((Array[])element);
-            break;
-        case Types.CLOB:
-            elements = DefaultUDTMap.processObject((Clob[])element);
-            break;
-        case Types.BLOB:
-            elements = DefaultUDTMap.processObject((Blob[])element);
-            break;
-        case Types.DATALINK:
-            elements = DefaultUDTMap.processObject((URL[])element);
-            break;
-        case Types.JAVA_OBJECT:
-            elements = DefaultUDTMap.processObject(element);
-            break;
-        default:
-            elements = new Object[element.length];
-            for (int i = 0; i < element.length; i++) {
-                elements[i] = element[i];
-            }
+        if (element.length == 0) {
+            elements = new Object[0];
+        } else {
+            transferElements(baseType, element);
         }
     }
+    
+    /**
+	 * Transfers primitive objects to SerialXXX objects according to the given
+	 * type.
+     * @throws SQLException 
+	 */
+    private void transferElements(int type, Object[] element) throws SQLException {
+    	switch (type) {
+		case Types.STRUCT:
+			elements = DefaultUDTMap.processStruct(element);
+			break;
+		case Types.ARRAY:
+			elements = DefaultUDTMap.processArray(element);
+			break;
+		case Types.CLOB:
+			elements = DefaultUDTMap.processClob(element);
+			break;
+		case Types.BLOB:
+			elements = DefaultUDTMap.processBlob(element);
+			break;
+		case Types.DATALINK:
+			elements = DefaultUDTMap.processDatalink(element);
+			break;
+		case Types.JAVA_OBJECT:
+			elements = DefaultUDTMap.processObject(element);
+			break;
+		default:
+			elements = new Object[element.length];
+			for (int i = 0; i < element.length; i++) {
+				elements[i] = element[i];
+			}
+		}
+    }
 
     /**
-     * The constructor
-     * 
-     * @param array
-     *            array to be serializated
-     * @throws SerialException
-     *             when any error occurs during serializing
-     * @throws SQLException
-     *             if array is null
-     */
+	 * The constructor
+	 * 
+	 * @param array
+	 *            array to be serializated
+	 * @throws SerialException
+	 *             when any error occurs during serializing
+	 * @throws SQLException
+	 *             if array is null
+	 */
     public SerialArray(Array array) throws SerialException, SQLException {
-        this(array, DefaultUDTMap.DEFAULTMAP);
+    	if (null == array || null == array.getArray()) {
+            throw new SQLException(Messages.getString("sql.39")); //$NON-NLS-1$
+        }
+        baseType = array.getBaseType();
+        baseTypeName = array.getBaseTypeName();
+        
+        Object[] element = (Object[]) array.getArray();
+        if (element.length == 0) {
+            elements = new Object[0];
+        } else {
+            transferElements(baseType, element);
+        }
     }
 
     /**
@@ -136,7 +155,7 @@
      */
     public Object getArray(long index, int count) throws SerialException {
         if (index < 0 || count + index > elements.length) {
-            throw new SerialException("Illegal Argument");
+            throw new SerialException(Messages.getString("sql.42")); //$NON-NLS-1$
         }
         Object[] ret = new Object[count];
         System.arraycopy(elements, (int) index, ret, 0, count);
@@ -160,7 +179,7 @@
     public Object getArray(long index, int count, Map<String, Class<?>> map)
             throws SerialException {
         if (index < 0 || count + index > elements.length ) {
-            throw new SerialException(Messages.getString("sql.40"));
+            throw new SerialException(Messages.getString("sql.40")); //$NON-NLS-1$
         }
         Object[] ret = new Object[count];
         System.arraycopy(elements, (int) index, ret, 0, count);
@@ -264,5 +283,4 @@
             throws SerialException {
         throw new UnsupportedOperationException();
     }
-
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/serial/SerialClob.java Tue Jun 19 03:37:02 2007
@@ -60,12 +60,10 @@
         if (clob == null) {
             throw new SQLException(Messages.getString("sql.19"));//$NON-NLS-1$
         }
-
-        characterStream = clob.getCharacterStream();
-        asciiStream = clob.getAsciiStream();
-        if (characterStream == null || asciiStream == null) {
-            throw new SQLException(Messages.getString("sql.20"));//$NON-NLS-1$
-        }
+        if ((characterStream = clob.getCharacterStream()) == null
+				&& (asciiStream = clob.getAsciiStream()) == null) {
+			throw new SQLException(Messages.getString("sql.20"));//$NON-NLS-1$
+		}
 
         this.clob = clob;
         origLen = clob.length();
@@ -83,10 +81,12 @@
     }
 
     public long length() throws SerialException {
+        checkValidation();
         return len;
     }
 
     public InputStream getAsciiStream() throws SerialException, SQLException {
+        checkValidation();
         if (clob == null) {
             throw new SerialException(Messages.getString("sql.25")); // $NON-NLS-1$
         }
@@ -94,6 +94,7 @@
     }
 
     public Reader getCharacterStream() throws SerialException {
+        checkValidation();
         return new CharArrayReader(buf);
     }
 
@@ -114,12 +115,14 @@
 
     public long position(Clob searchClob, long start) throws SerialException,
             SQLException {
+        checkValidation();
         String searchString = searchClob.getSubString(1, (int)searchClob.length());
         return position(searchString, start);
     }
 
     public long position(String searchString, long start) throws SerialException,
             SQLException {
+        checkValidation();
         if (start < 1 || len - (start - 1) < searchString.length()) {
             return -1;
         }
@@ -148,26 +151,38 @@
 
     public OutputStream setAsciiStream(long pos) throws SerialException,
             SQLException {
+        checkValidation();
         if (clob == null) {
             throw new SerialException(Messages.getString("sql.25")); // $NON-NLS-1$
         }
-        return clob.setAsciiStream(pos);
+        OutputStream os = clob.setAsciiStream(pos);
+        if(os == null){
+            throw new SerialException(Messages.getString("sql.46")); // $NON-NLS-1$
+        }
+        return os;
     }
 
     public Writer setCharacterStream(long pos) throws SerialException,
             SQLException {
+        checkValidation();
         if (clob == null) {
             throw new SerialException(Messages.getString("sql.25")); // $NON-NLS-1$
         }
-        return clob.setCharacterStream(pos);
+        Writer writer = clob.setCharacterStream(pos);
+        if(writer == null){
+            throw new SerialException(Messages.getString("sql.45")); // $NON-NLS-1$
+        }
+        return writer;
     }
 
     public int setString(long pos, String str) throws SerialException {
+        checkValidation();
         return setString(pos, str, 0, str.length());
     }
 
     public int setString(long pos, String str, int offset, int length)
             throws SerialException {
+        checkValidation();
         if (pos < 1 || length < 0 || pos > (len - length + 1)) {
             throw new SerialException(Messages.getString("sql.21")); // $NON-NLS-1$
         }
@@ -182,6 +197,7 @@
     }
 
     public void truncate(long length) throws SerialException {
+        checkValidation();
         if(length > len || length < 0) {
             throw new SerialException(Messages.getString("sql.24"));
         }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/ProviderImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/ProviderImpl.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/ProviderImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/ProviderImpl.java Tue Jun 19 03:37:02 2007
@@ -25,7 +25,8 @@
         className = name;
 
         try {
-            Class<?> implClass = Class.forName(className);
+			Class<?> implClass = Class.forName(className, true, Thread
+					.currentThread().getContextClassLoader());
             impl = (SyncProvider) implClass.newInstance();
         } catch (ClassNotFoundException e) {
             errMsg = Messages.getString("sql.40", className); //$NON-NLS-1$
@@ -41,7 +42,11 @@
         this.version = version;
     }
 
-    public SyncProvider getImpl() {
+    public SyncProvider getImpl() throws SyncFactoryException {
+		if (null == impl) {
+			throw new SyncFactoryException(Messages.getString(
+					"sql.40", className)); //$NON-NLS-1$
+		}
         return impl;
     }
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/javax/sql/rowset/spi/SyncFactory.java Tue Jun 19 03:37:02 2007
@@ -86,10 +86,13 @@
     private static Enumeration<SyncProvider> getRegisteredProvidersImpl() {
         if (!initialized) {
             // 1. load from System property
-            String sysProvider = System.getProperty(ROWSET_SYNC_PROVIDER);
-            if (sysProvider != null) {
-                providers.put(sysProvider, new ProviderImpl(sysProvider));
-            }
+        	String rowsetPropStr = System.getProperty(ROWSET_SYNC_PROVIDER);
+        	if (rowsetPropStr != null) {
+        		String[] sysProviders = rowsetPropStr.split(":"); //$NON-NLS-1$    			
+				for (String sysProvider : sysProviders) {
+					providers.put(sysProvider, new ProviderImpl(sysProvider));
+				}   		
+        	}
 
             // 2. looks in the resource file
             Properties rowsetProp = new Properties();

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/DriverManagerTest.java Tue Jun 19 03:37:02 2007
@@ -25,6 +25,7 @@
 import java.sql.Connection;
 import java.sql.Driver;
 import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
 import java.sql.SQLException;
 import java.sql.SQLPermission;
 import java.util.Enumeration;
@@ -576,7 +577,68 @@
 		} // end method checkPermission( Permission )
 
 	} // end class TestSecurityManager
+    
+    
+    /**
+     * @tests {@link java.sql.DriverManager#registerDriver(Driver)}
+     * 
+     * Registers a driver for multiple times and deregisters it only once.
+     * 
+     * Regression for HARMONY-4205
+     */
+    public void test_registerDriver_MultiTimes() throws SQLException {
+        int register_count = 10;
+        int deregister_count = 1;
+
+        Driver dummy = new DummyDriver();
+        DriverManager.registerDriver(new BadDummyDriver());
+        for (int i = 0; i < register_count; i++) {
+            DriverManager.registerDriver(dummy);
+        }
+        DriverManager.registerDriver(new BadDummyDriver());
+        for (int i = 0; i < deregister_count; i++) {
+            DriverManager.deregisterDriver(dummy);
+        }
+        Driver d = DriverManager.getDriver("jdbc:dummy_protocol:dummy_subname");
+        assertNotNull(d);
+    }
+    
+    private static class BadDummyDriver extends DummyDriver {
+        public boolean acceptsURL(String url) {
+            return false;
+        }
+    }
+
+    private static class DummyDriver implements Driver {
+
+        String goodurl = "jdbc:dummy_protocol:dummy_subname";
+
+        public boolean acceptsURL(String url) {
+            return url.equals(goodurl);
+        }
+
+        public Connection connect(String url, Properties info) {
+            return null;
+        }
+
+        public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
+            return null;
+        }
+
+        public int getMajorVersion() {
+            return 0;
+        }
 
+        public int getMinorVersion() {
+            return 0;
+        }
+
+        public boolean jdbcCompliant() {
+            return true;
+        }
+
+    }
+    
 } // end class DriverManagerTest
 
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/ConnectionEventTest.java Tue Jun 19 03:37:02 2007
@@ -17,8 +17,13 @@
 
 package org.apache.harmony.sql.tests.javax.sql;
 
+import java.io.Serializable;
 import java.sql.SQLException;
 import javax.sql.ConnectionEvent;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
 import junit.framework.TestCase;
 
 public class ConnectionEventTest extends TestCase {
@@ -53,5 +58,58 @@
         assertSame(ipc, ce.getSource());
         assertSame(e, ce.getSQLException());
     }
+    
+    /**
+     * @tests serialization/deserialization compatibility.
+     */
+    public void testSerializationSelf() throws Exception {
+        Impl_PooledConnection ipc = new Impl_PooledConnection();
+        SQLException e = new SQLException();
+        ConnectionEvent ce = new ConnectionEvent(ipc, e);
+        SerializationTest.verifySelf(ce, CONNECTIONEVENT_COMPARATOR);
+    }
+
+    /**
+     * @tests serialization/deserialization compatibility with RI.
+     */
+    public void testSerializationCompatibility() throws Exception {
+        Impl_PooledConnection ipc = new Impl_PooledConnection();
+        SQLException nextSQLException = new SQLException("nextReason",
+                "nextSQLState", 33);
+
+        int vendorCode = 10;
+        SQLException sqlException = new SQLException("reason", "SQLState",
+                vendorCode);
+
+        sqlException.setNextException(nextSQLException);
+
+        ConnectionEvent ce = new ConnectionEvent(ipc, sqlException);
+
+        SerializationTest.verifyGolden(this, ce, CONNECTIONEVENT_COMPARATOR);
+    }
+
+    private static final SerializableAssert CONNECTIONEVENT_COMPARATOR = new SerializableAssert() {
+
+        public void assertDeserialized(Serializable initial,
+                Serializable deserialized) {
+            ConnectionEvent ceInitial = (ConnectionEvent) initial;
+            ConnectionEvent ceDeser = (ConnectionEvent) deserialized;
+
+            SQLException initThr = ceInitial.getSQLException();
+            SQLException dserThr = ceDeser.getSQLException();
+
+            // verify SQLState
+            assertEquals(initThr.getSQLState(), dserThr.getSQLState());
+
+            // verify vendorCode
+            assertEquals(initThr.getErrorCode(), dserThr.getErrorCode());
+
+            // verify next
+            if (initThr.getNextException() == null) {
+                assertNull(dserThr.getNextException());
+            }
+        }
+
+    };
 }   
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/BaseRowSetTest.java Tue Jun 19 03:37:02 2007
@@ -21,6 +21,7 @@
 import java.sql.Blob;
 import java.sql.Clob;
 import java.sql.Ref;
+import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Types;
 
@@ -41,6 +42,22 @@
         assertEquals(0, params.length);
     }
     
+    /**
+     * @tests {@link javax.sql.rowset.BaseRowSet#getFetchDirection()}
+     */
+    public void testGetFetchDirection() throws SQLException {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
+    }
+    
+    /**
+     * @tests {@link javax.sql.rowset.BaseRowSet#getTypeMap()}
+     */
+    public void testGetTypeMap() {
+        BaseRowSetImpl brs = new BaseRowSetImpl();
+        assertNull(brs.getTypeMap());
+    }
+    
     public void testSetNullintint() throws Exception {
         BaseRowSetImpl brs = new BaseRowSetImpl();
         try {
@@ -161,6 +178,43 @@
         assertNotNull(params);
         assertEquals(1, params.length);
         assertEquals(Short.valueOf((short)1), params[0]);
+    }
+    
+    /**
+     * @tests {@link javax.sql.rowset.BaseRowSet#setFetchDirection(int)}
+     */
+    public void testSetFetchDirectionI() throws SQLException {
+    	BaseRowSetImpl brs = new BaseRowSetImpl();
+    	brs.setFetchDirection(ResultSet.FETCH_FORWARD);
+    	assertEquals(ResultSet.FETCH_FORWARD, brs.getFetchDirection());
+    	
+    	brs.setType(ResultSet.TYPE_SCROLL_SENSITIVE);
+    	brs.setFetchDirection(ResultSet.FETCH_UNKNOWN);
+    	assertEquals(ResultSet.FETCH_UNKNOWN, brs.getFetchDirection());
+    	
+    	brs.setType(ResultSet.TYPE_FORWARD_ONLY);
+    	try {
+    		brs.setFetchDirection(ResultSet.FETCH_REVERSE);
+    		fail("should throw SQLException");
+    	} catch (SQLException e) {
+    		// expected
+    	}
+    	
+    	try {
+    		brs.setFetchDirection(1100);
+    		fail("should throw SQLException");
+    	} catch (SQLException e) {
+    		// expected
+    	}
+    }
+    
+    /**
+     * @tests {@link javax.sql.rowset.BaseRowSet#setTypeMap(java.util.Map)}
+     */
+    public void testSetTypeMap() {
+    	BaseRowSetImpl brs = new BaseRowSetImpl();
+    	brs.setTypeMap(null);
+    	assertNull(brs.getTypeMap());
     }
     
     public void testSetArray() throws SQLException {

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialArrayTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialArrayTest.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialArrayTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialArrayTest.java Tue Jun 19 03:37:02 2007
@@ -27,6 +27,7 @@
 import java.util.Map;
 
 import javax.sql.rowset.serial.SerialArray;
+import javax.sql.rowset.serial.SerialClob;
 import javax.sql.rowset.serial.SerialException;
 
 import junit.framework.TestCase;
@@ -60,6 +61,8 @@
     }
 
     public void testConstructor_ObjectArray() throws SQLException {
+        assertNotNull(new SerialArray(new SQLArray()));
+
         // OK
         sa = new SerialArray(mock);
         // array.getArray should not return null
@@ -382,6 +385,64 @@
 
         public void writeSQL(SQLOutput stream) throws SQLException {
             return;
+        }
+    }
+    
+    private static class SQLArray implements java.sql.Array {
+
+        Object[] array;
+
+        SQLArray() throws SQLException {
+
+            char[] chars = { 'a', 'b', 'c', 'd' };
+            array = new Object[1];
+
+            array[0] = (Object) new SerialClob(chars);
+        }
+
+        public Object getArray() {
+            return array;
+        }
+
+        public int getBaseType() {
+            return java.sql.Types.CLOB;
+        }
+
+        /** Everything below here is just supplied to satisfy
+         the interface and is not part of this testcase.
+         **/
+
+        public Object getArray(long index, int count) {
+            return null;
+        }
+
+        public Object getArray(long index, int count, Map<String, Class<?>> map) {
+            return null;
+        }
+
+        public Object getArray(Map<String, Class<?>> map) {
+            return null;
+        }
+
+        public String getBaseTypeName() {
+            return null;
+        }
+
+        public ResultSet getResultSet() {
+            return null;
+        }
+
+        public ResultSet getResultSet(long index, int count) {
+            return null;
+        }
+
+        public ResultSet getResultSet(Map<String, Class<?>> map) {
+            return null;
+        }
+
+        public ResultSet getResultSet(long index, int count,
+                Map<String, Class<?>> map) {
+            return null;
         }
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/javax/sql/rowset/serial/SerialClobTest.java Tue Jun 19 03:37:02 2007
@@ -62,22 +62,8 @@
 
         mockClob.characterStreamReader = null;
         mockClob.asciiInputStream = new ByteArrayInputStream(new byte[] { 1 });
-        try {
-            new SerialClob(mockClob);
-            fail("should throw SQLException");
-        } catch (SQLException e) {
-            // expected
-        }
-
         mockClob.characterStreamReader = new CharArrayReader(new char[] { 1 });
         mockClob.asciiInputStream = null;
-        try {
-            new SerialClob(mockClob);
-            fail("should throw SQLException");
-        } catch (SQLException e) {
-            // expected
-        }
-
         mockClob.characterStreamReader = new MockAbnormalReader();
         mockClob.asciiInputStream = new ByteArrayInputStream(new byte[] { 1 });
         try {
@@ -261,9 +247,17 @@
         MockSerialClob mockClob = new MockSerialClob();
         mockClob.characterStreamReader = new CharArrayReader(mockClob.buf);
         mockClob.asciiInputStream = new ByteArrayInputStream(new byte[] { 1 });
-        mockClob.asciiOutputStream = new ByteArrayOutputStream();
         SerialClob serialClob = new SerialClob(mockClob);
-        OutputStream os = serialClob.setAsciiStream(1);
+        OutputStream os = null;
+        try {
+            os = serialClob.setAsciiStream(1);
+            fail("should throw SerialException");
+        } catch (SerialException e) {
+            // expected
+        }
+        mockClob.asciiOutputStream = new ByteArrayOutputStream();
+        os = serialClob.setAsciiStream(1);
+        assertNotNull(os);
         assertTrue(mockClob.isSetAsciiStreamInvoked);
         assertEquals(mockClob.asciiOutputStream, os);
         

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelSemanticTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelSemanticTest.java?view=diff&rev=548684&r1=548683&r2=548684
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelSemanticTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelSemanticTest.java Tue Jun 19 03:37:02 2007
@@ -1,9 +1,10 @@
 /*
-*  Copyright 2006 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
+*  Licensed to the Apache Software Foundation (ASF) under one or more
+*  contributor license agreements.  See the NOTICE file distributed with
+*  this work for additional information regarding copyright ownership.
+*  The ASF licenses this file to You 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
 *



Mime
View raw message