harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r592673 [8/10] - in /harmony/enhanced/classlib/branches/java6: depends/build/ depends/build/platform/ depends/manifests/icu4j_3.8/META-INF/ make/ modules/archive/ modules/archive/src/main/native/archive/unix/ modules/archive/src/main/native...
Date Wed, 07 Nov 2007 09:51:11 GMT
Modified: harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ReplaceTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ReplaceTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ReplaceTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/ReplaceTest.java Wed Nov  7 01:51:00 2007
@@ -16,71 +16,75 @@
 
 package org.apache.harmony.tests.java.util.regex;
 
-import junit.framework.TestCase;
-import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
 
+import junit.framework.TestCase;
+
+@SuppressWarnings("nls")
 public class ReplaceTest extends TestCase {
-	
-	public void testSimpleReplace() throws PatternSyntaxException {
-		String target, pattern, repl;
-
-		target = "foobarfobarfoofo1";
-		pattern = "fo[^o]";
-		repl = "xxx";
+
+    public void testSimpleReplace() throws PatternSyntaxException {
+        String target, pattern, repl;
+
+        target = "foobarfobarfoofo1";
+        pattern = "fo[^o]";
+        repl = "xxx";
 
         Pattern p = Pattern.compile(pattern);
         Matcher m = p.matcher(target);
 
         assertEquals("foobarxxxarfoofo1", m.replaceFirst(repl));
         assertEquals("foobarxxxarfooxxx", m.replaceAll(repl));
-	}
+    }
 
-	public void testCaptureReplace() {
-		String target, pattern, repl, s;
-		Pattern p = null;
-		Matcher m;
-
-		target = "[31]foo;bar[42];[99]xyz";
-		pattern = "\\[([0-9]+)\\]([a-z]+)";
-		repl = "$2[$1]";
-
-		p = Pattern.compile(pattern);
-		m = p.matcher(target);
-		s = m.replaceFirst(repl);
-		assertEquals("foo[31];bar[42];[99]xyz", s);
-		s = m.replaceAll(repl);
-		assertEquals("foo[31];bar[42];xyz[99]", s);
-
-		target = "[31]foo(42)bar{63}zoo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;";
-		pattern = "\\[([0-9]+)\\]([a-z]+)\\(([0-9]+)\\)([a-z]+)\\{([0-9]+)\\}([a-z]+)";
-		repl = "[$5]$6($3)$4{$1}$2";
-		p = Pattern.compile(pattern);
-		m = p.matcher(target);
-		s = m.replaceFirst(repl);
-		// System.out.println(s);
-		assertEquals("[63]zoo(42)bar{31}foo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;", s
-				);
-		s = m.replaceAll(repl);
-		// System.out.println(s);
-		assertEquals("[63]zoo(42)bar{31}foo;[56]ghi(34)def{12}abc;{99}xyz[88]xyz(77)xyz;", s
-				);
-	}
-
-	public void testEscapeReplace() {
-		String target, pattern, repl, s;
-
-		target = "foo'bar''foo";
-		pattern = "'";
-		repl = "\\'";
-		s = target.replaceAll(pattern, repl);
-		assertEquals("foo'bar''foo", s);
-		repl = "\\\\'";
-		s = target.replaceAll(pattern, repl);
-		assertEquals("foo\\'bar\\'\\'foo", s);
-		repl = "\\$3";
-		s = target.replaceAll(pattern, repl);
-		assertEquals("foo$3bar$3$3foo", s);
-	}
+    public void testCaptureReplace() {
+        String target, pattern, repl, s;
+        Pattern p = null;
+        Matcher m;
+
+        target = "[31]foo;bar[42];[99]xyz";
+        pattern = "\\[([0-9]+)\\]([a-z]+)";
+        repl = "$2[$1]";
+
+        p = Pattern.compile(pattern);
+        m = p.matcher(target);
+        s = m.replaceFirst(repl);
+        assertEquals("foo[31];bar[42];[99]xyz", s);
+        s = m.replaceAll(repl);
+        assertEquals("foo[31];bar[42];xyz[99]", s);
+
+        target = "[31]foo(42)bar{63}zoo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;";
+        pattern = "\\[([0-9]+)\\]([a-z]+)\\(([0-9]+)\\)([a-z]+)\\{([0-9]+)\\}([a-z]+)";
+        repl = "[$5]$6($3)$4{$1}$2";
+        p = Pattern.compile(pattern);
+        m = p.matcher(target);
+        s = m.replaceFirst(repl);
+        // System.out.println(s);
+        assertEquals(
+                "[63]zoo(42)bar{31}foo;[12]abc(34)def{56}ghi;{99}xyz[88]xyz(77)xyz;",
+                s);
+        s = m.replaceAll(repl);
+        // System.out.println(s);
+        assertEquals(
+                "[63]zoo(42)bar{31}foo;[56]ghi(34)def{12}abc;{99}xyz[88]xyz(77)xyz;",
+                s);
+    }
+
+    public void testEscapeReplace() {
+        String target, pattern, repl, s;
+
+        target = "foo'bar''foo";
+        pattern = "'";
+        repl = "\\'";
+        s = target.replaceAll(pattern, repl);
+        assertEquals("foo'bar''foo", s);
+        repl = "\\\\'";
+        s = target.replaceAll(pattern, repl);
+        assertEquals("foo\\'bar\\'\\'foo", s);
+        repl = "\\$3";
+        s = target.replaceAll(pattern, repl);
+        assertEquals("foo$3bar$3$3foo", s);
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/src/test/java/org/apache/harmony/tests/java/util/regex/SplitTest.java Wed Nov  7 01:51:00 2007
@@ -17,154 +17,155 @@
 
 package org.apache.harmony.tests.java.util.regex;
 
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 
 import junit.framework.TestCase;
-import java.util.regex.*;
 
 /**
  * TODO Type description
- * 
  */
+@SuppressWarnings("nls")
 public class SplitTest extends TestCase {
-	
-	public void testSimple() {
-		Pattern p = Pattern.compile("/");
-		String[] results = p.split("have/you/done/it/right");
-		String[] expected = new String[] { "have", "you", "done", "it", "right" };
-		assertEquals(expected.length, results.length);
-		for (int i = 0; i < expected.length; i++) {
-			assertEquals(results[i], expected[i]);
-		}
-	}
-
-	public void testSplit1() throws PatternSyntaxException {
-		Pattern p = Pattern.compile(" ");
-
-		String input = "poodle zoo";
-		String tokens[];
-
-		tokens = p.split(input, 1);
-		assertEquals(1, tokens.length);
-		assertTrue(tokens[0].equals(input));
-		tokens = p.split(input, 2);
-		assertEquals(2, tokens.length);
-		assertEquals("poodle", tokens[0]);
-		assertEquals("zoo", tokens[1]);
-		tokens = p.split(input, 5);
-		assertEquals(2, tokens.length);
-		assertEquals("poodle", tokens[0]);
-		assertEquals("zoo", tokens[1]);
-		tokens = p.split(input, -2);
-		assertEquals(2, tokens.length);
-		assertEquals("poodle", tokens[0]);
-		assertEquals("zoo", tokens[1]);
-		tokens = p.split(input, 0);
-		assertEquals(2, tokens.length);
-		assertEquals("poodle", tokens[0]);
-		assertEquals("zoo", tokens[1]);
-		tokens = p.split(input);
-		assertEquals(2, tokens.length);
-		assertEquals("poodle", tokens[0]);
-		assertEquals("zoo", tokens[1]);
-
-		p = Pattern.compile("d");
-
-		tokens = p.split(input, 1);
-		assertEquals(1, tokens.length);
-		assertTrue(tokens[0].equals(input));
-		tokens = p.split(input, 2);
-		assertEquals(2, tokens.length);
-		assertEquals("poo", tokens[0]);
-		assertEquals("le zoo", tokens[1]);
-		tokens = p.split(input, 5);
-		assertEquals(2, tokens.length);
-		assertEquals("poo", tokens[0]);
-		assertEquals("le zoo", tokens[1]);
-		tokens = p.split(input, -2);
-		assertEquals(2, tokens.length);
-		assertEquals("poo", tokens[0]);
-		assertEquals("le zoo", tokens[1]);
-		tokens = p.split(input, 0);
-		assertEquals(2, tokens.length);
-		assertEquals("poo", tokens[0]);
-		assertEquals("le zoo", tokens[1]);
-		tokens = p.split(input);
-		assertEquals(2, tokens.length);
-		assertEquals("poo", tokens[0]);
-		assertEquals("le zoo", tokens[1]);
-
-		p = Pattern.compile("o");
-
-		tokens = p.split(input, 1);
-		assertEquals(1, tokens.length);
-		assertTrue(tokens[0].equals(input));
-		tokens = p.split(input, 2);
-		assertEquals(2, tokens.length);
-		assertEquals("p", tokens[0]);
-		assertEquals("odle zoo", tokens[1]);
-		tokens = p.split(input, 5);
-		assertEquals(5, tokens.length);
-		assertEquals("p", tokens[0]);
-		assertTrue(tokens[1].equals(""));
-		assertEquals("dle z", tokens[2]);
-		assertTrue(tokens[3].equals(""));
-		assertTrue(tokens[4].equals(""));
-		tokens = p.split(input, -2);
-		assertEquals(5, tokens.length);
-		assertEquals("p", tokens[0]);
-		assertTrue(tokens[1].equals(""));
-		assertEquals("dle z", tokens[2]);
-		assertTrue(tokens[3].equals(""));
-		assertTrue(tokens[4].equals(""));
-		tokens = p.split(input, 0);
-		assertEquals(3, tokens.length);
-		assertEquals("p", tokens[0]);
-		assertTrue(tokens[1].equals(""));
-		assertEquals("dle z", tokens[2]);
-		tokens = p.split(input);
-		assertEquals(3, tokens.length);
-		assertEquals("p", tokens[0]);
-		assertTrue(tokens[1].equals(""));
-		assertEquals("dle z", tokens[2]);
-	}
-
-	public void testSplit2() {
-		Pattern p = Pattern.compile("");
-		String s[];
-		s = p.split("a", -1);
-		assertEquals(3, s.length);
-		assertEquals("", s[0]);
-		assertEquals("a", s[1]);
-		assertEquals("", s[2]);
-
-		s = p.split("", -1);
-		assertEquals(1, s.length);
-		assertEquals("", s[0]);
-
-		s = p.split("abcd", -1);
-		assertEquals(6, s.length);
-		assertEquals("", s[0]);
-		assertEquals("a", s[1]);
-		assertEquals("b", s[2]);
-		assertEquals("c", s[3]);
-		assertEquals("d", s[4]);
-		assertEquals("", s[5]);
+
+    public void testSimple() {
+        Pattern p = Pattern.compile("/");
+        String[] results = p.split("have/you/done/it/right");
+        String[] expected = new String[] { "have", "you", "done", "it", "right" };
+        assertEquals(expected.length, results.length);
+        for (int i = 0; i < expected.length; i++) {
+            assertEquals(results[i], expected[i]);
+        }
+    }
+
+    public void testSplit1() throws PatternSyntaxException {
+        Pattern p = Pattern.compile(" ");
+
+        String input = "poodle zoo";
+        String tokens[];
+
+        tokens = p.split(input, 1);
+        assertEquals(1, tokens.length);
+        assertTrue(tokens[0].equals(input));
+        tokens = p.split(input, 2);
+        assertEquals(2, tokens.length);
+        assertEquals("poodle", tokens[0]);
+        assertEquals("zoo", tokens[1]);
+        tokens = p.split(input, 5);
+        assertEquals(2, tokens.length);
+        assertEquals("poodle", tokens[0]);
+        assertEquals("zoo", tokens[1]);
+        tokens = p.split(input, -2);
+        assertEquals(2, tokens.length);
+        assertEquals("poodle", tokens[0]);
+        assertEquals("zoo", tokens[1]);
+        tokens = p.split(input, 0);
+        assertEquals(2, tokens.length);
+        assertEquals("poodle", tokens[0]);
+        assertEquals("zoo", tokens[1]);
+        tokens = p.split(input);
+        assertEquals(2, tokens.length);
+        assertEquals("poodle", tokens[0]);
+        assertEquals("zoo", tokens[1]);
+
+        p = Pattern.compile("d");
+
+        tokens = p.split(input, 1);
+        assertEquals(1, tokens.length);
+        assertTrue(tokens[0].equals(input));
+        tokens = p.split(input, 2);
+        assertEquals(2, tokens.length);
+        assertEquals("poo", tokens[0]);
+        assertEquals("le zoo", tokens[1]);
+        tokens = p.split(input, 5);
+        assertEquals(2, tokens.length);
+        assertEquals("poo", tokens[0]);
+        assertEquals("le zoo", tokens[1]);
+        tokens = p.split(input, -2);
+        assertEquals(2, tokens.length);
+        assertEquals("poo", tokens[0]);
+        assertEquals("le zoo", tokens[1]);
+        tokens = p.split(input, 0);
+        assertEquals(2, tokens.length);
+        assertEquals("poo", tokens[0]);
+        assertEquals("le zoo", tokens[1]);
+        tokens = p.split(input);
+        assertEquals(2, tokens.length);
+        assertEquals("poo", tokens[0]);
+        assertEquals("le zoo", tokens[1]);
+
+        p = Pattern.compile("o");
+
+        tokens = p.split(input, 1);
+        assertEquals(1, tokens.length);
+        assertTrue(tokens[0].equals(input));
+        tokens = p.split(input, 2);
+        assertEquals(2, tokens.length);
+        assertEquals("p", tokens[0]);
+        assertEquals("odle zoo", tokens[1]);
+        tokens = p.split(input, 5);
+        assertEquals(5, tokens.length);
+        assertEquals("p", tokens[0]);
+        assertTrue(tokens[1].equals(""));
+        assertEquals("dle z", tokens[2]);
+        assertTrue(tokens[3].equals(""));
+        assertTrue(tokens[4].equals(""));
+        tokens = p.split(input, -2);
+        assertEquals(5, tokens.length);
+        assertEquals("p", tokens[0]);
+        assertTrue(tokens[1].equals(""));
+        assertEquals("dle z", tokens[2]);
+        assertTrue(tokens[3].equals(""));
+        assertTrue(tokens[4].equals(""));
+        tokens = p.split(input, 0);
+        assertEquals(3, tokens.length);
+        assertEquals("p", tokens[0]);
+        assertTrue(tokens[1].equals(""));
+        assertEquals("dle z", tokens[2]);
+        tokens = p.split(input);
+        assertEquals(3, tokens.length);
+        assertEquals("p", tokens[0]);
+        assertTrue(tokens[1].equals(""));
+        assertEquals("dle z", tokens[2]);
+    }
+
+    public void testSplit2() {
+        Pattern p = Pattern.compile("");
+        String s[];
+        s = p.split("a", -1);
+        assertEquals(3, s.length);
+        assertEquals("", s[0]);
+        assertEquals("a", s[1]);
+        assertEquals("", s[2]);
+
+        s = p.split("", -1);
+        assertEquals(1, s.length);
+        assertEquals("", s[0]);
+
+        s = p.split("abcd", -1);
+        assertEquals(6, s.length);
+        assertEquals("", s[0]);
+        assertEquals("a", s[1]);
+        assertEquals("b", s[2]);
+        assertEquals("c", s[3]);
+        assertEquals("d", s[4]);
+        assertEquals("", s[5]);
     }
 
     public void testSplitSupplementaryWithEmptyString() {
-        
+
         /*
-         * See http://www.unicode.org/reports/tr18/#Supplementary_Characters
-         * We have to treat text as code points not code units.
+         * See http://www.unicode.org/reports/tr18/#Supplementary_Characters We
+         * have to treat text as code points not code units.
          */
         Pattern p = Pattern.compile("");
         String s[];
-		s = p.split("a\ud869\uded6b", -1);
+        s = p.split("a\ud869\uded6b", -1);
         assertEquals(5, s.length);
-		assertEquals("", s[0]);
-		assertEquals("a", s[1]);
+        assertEquals("", s[0]);
+        assertEquals("a", s[1]);
         assertEquals("\ud869\uded6", s[2]);
-        assertEquals("b", s[3]);                
-        assertEquals("", s[4]);        
-	}
+        assertEquals("b", s[3]);
+        assertEquals("", s[4]);
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/security/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/build.xml?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/build.xml Wed Nov  7 01:51:00 2007
@@ -90,6 +90,10 @@
                 <include name="*${progdb.suffix}*" if="is.windows" />
                 <exclude name="*${manifest.suffix}"/>
             </fileset>
+            <!-- Copy link exports file on z/OS -->
+            <fileset dir="${hy.security.src.main.native}/security/${hy.os.family}">
+                <include name="*${linklib.suffix}*" if="is.zos" />
+            </fileset>
         </copy>
     </target>
     

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?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- 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 Wed Nov  7 01:51:00 2007
@@ -83,7 +83,8 @@
 
     private int concurrency = ResultSet.CONCUR_UPDATABLE;
 
-    private boolean readOnly;
+    //compatiable with RI, default: true
+    private boolean readOnly = true;
 
     private boolean escapeProcessing;
 
@@ -988,5 +989,11 @@
             result[i] = param;
         }
         return result;
+    }
+    
+    public BaseRowSet clone() throws CloneNotSupportedException{
+        BaseRowSet result = (BaseRowSet) super.clone();        
+        return result;
+        
     }
 }

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?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- 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 Wed Nov  7 01:51:00 2007
@@ -26,7 +26,7 @@
 import java.sql.Types;
 import java.util.HashMap;
 
-public class DefaultUDTMap<T> {
+class DefaultUDTMap<T> {
 
     public static HashMap<String, Class<?>> DEFAULTMAP = new HashMap<String, Class<?>>();
 

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties Wed Nov  7 01:51:00 2007
@@ -67,3 +67,6 @@
 rowset.4=Not an insert row
 rowset.5=There are conflicts between rowset and data source
 rowset.6=Errors in the process of Writing Back RowData
+rowset.7=Not a valid cursor
+rowset.8=The Result Set Type is TYPE_FORWARD_ONLY 
+rowset.9=PageSize can not larger than MaxRows

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRow.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRow.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRow.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRow.java Wed Nov  7 01:51:00 2007
@@ -16,10 +16,12 @@
  */
 package org.apache.harmony.sql.internal.rowset;
 
+
 import java.sql.Blob;
+import java.sql.SQLException;
 import java.util.BitSet;
 
-public class CachedRow {
+public class CachedRow implements Cloneable{
     private Object[] columnData;
 
     private Object[] originalColumnData;
@@ -30,6 +32,8 @@
 
     private boolean insert;
 
+    private boolean nonUpdateable = false;
+
     public CachedRow(Object[] columnData) {
         this.columnData = columnData;
         this.originalColumnData = columnData;
@@ -51,9 +55,25 @@
         mask.flip(0,columnData.length);
     }
 
+    public void setNonUpdateable() {
+        // setDelete();
+        // setInsert();
+        // mask.clear();
+        // mask.flip(0,columnData.length);
+        nonUpdateable = true;
+    }
+
+    public boolean getNonUpdateable() {
+        return nonUpdateable;
+    }
+
     public void setDelete() {
         this.isDelete = true;
     }
+    
+    public void unDoDelete() {
+        this.isDelete = false;
+    }
 
     public boolean getDelete() {
         return isDelete;
@@ -67,7 +87,9 @@
         return this.insert;
     }
 
-    public void updateString(int columnIndex, String x) {
+    public void updateString(int columnIndex, String x) throws SQLException {
+        if (nonUpdateable)
+            throw new SQLException("Not Updateable of the CurrentRow");
         this.columnData[columnIndex - 1] = x;
         setUpdateMask(columnIndex - 1);
     }
@@ -86,14 +108,43 @@
     }
     
     public Object getObject(int columnIndex) {
-        return  this.columnData[columnIndex - 1];
+        return this.columnData[columnIndex - 1];
     }
 
     public int getInt(int columnIndex) {
         return (Integer) this.columnData[columnIndex - 1];
     }
-    
-    public Blob getBLOb(int columnIndex){
-        return (Blob) this.columnData[columnIndex-1];
+
+    public Blob getBLOb(int columnIndex) {
+        return (Blob) this.columnData[columnIndex - 1];
+    }
+
+    public boolean getBoolean(int columnIndex) {
+        return (Boolean) this.columnData[columnIndex - 1];
+    }
+
+    public byte getByte(int columnIndex) {
+        return (Byte) this.columnData[columnIndex - 1];
+    }
+
+    public byte[] getBytes(int columnIndex) {
+        return (byte[]) this.columnData[columnIndex - 1];
+    }
+
+    // deep clone
+    public CachedRow createClone() throws CloneNotSupportedException {  
+        CachedRow cr = (CachedRow) super.clone();
+
+        Object[] cd = new Object[columnData.length];
+        for (int i = 0; i < columnData.length; i++) {
+            cd[i] = columnData[i];
+        }
+        cr.columnData = cd;
+        cr.insert = insert;
+        cr.isDelete = isDelete;
+        cr.mask = (BitSet) mask.clone();
+        cr.nonUpdateable = nonUpdateable;
+        // cr.originalColumnData
+        return cr;
     }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java Wed Nov  7 01:51:00 2007
@@ -26,6 +26,7 @@
 import java.sql.Date;
 import java.sql.DriverManager;
 import java.sql.NClob;
+import java.sql.PreparedStatement;
 import java.sql.Ref;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
@@ -62,6 +63,8 @@
 public class CachedRowSetImpl extends BaseRowSet implements CachedRowSet,
         RowSetInternal {
 
+    private static final long serialVersionUID = 1L;
+
     private ArrayList<CachedRow> rows;
 
     private RowSetMetaData meta;
@@ -70,25 +73,32 @@
 
     private CachedRow originalRow;
 
-    // start from : 0 rather than 1.
+    // start from : 1.
     private int currentRowIndex;
 
+    // the number of the rows in one "page"
     private int pageSize;
 
+    private int pageNumber = 1;
+
     private String tableName;
 
     private int rememberedCursorPosition;
 
     private CachedRow insertRow;
 
+    private int[] keyCols;
+
     private int columnCount;
 
     private SyncProvider syncProvider;
 
-    private String dataBaseURL;
-
     private CachedRowSetImpl originalResultSet;
 
+    private Object currentColumn;
+
+    private SQLWarning sqlwarn;
+
     public CachedRowSetImpl(String providerID) throws SyncFactoryException {
         syncProvider = SyncFactory.getInstance(providerID);
     }
@@ -116,9 +126,12 @@
         if (currentRow == insertRow)
             throw new SyncProviderException();
         try {
-            dataBaseURL = con.getMetaData().getURL();
+            setUrl(con.getMetaData().getURL());
             RowSetWriter rowSetWriter = syncProvider.getRowSetWriter();
-            rowSetWriter.writeData(this);
+            CachedRowSetImpl input = (CachedRowSetImpl) createCopy();
+            rowSetWriter.writeData(input);
+            // setOriginalRow();
+            notifyRowSetChanged();
         } catch (SQLException e) {
             e.printStackTrace();
             throw new SyncProviderException();
@@ -148,33 +161,140 @@
     }
 
     public void commit() throws SQLException {
-        throw new NotImplementedException();
+        getConnection().commit();
     }
 
     public CachedRowSet createCopy() throws SQLException {
-        throw new NotImplementedException();
+        CachedRowSetImpl output;
+        try {
+            output = (CachedRowSetImpl) super.clone();
+            // restore "this"'s states
+            int temp = currentRowIndex;
+            CachedRow cr;
+            if (currentRow != null)
+                cr = currentRow.createClone();
+            else
+                cr = null;
+            first();
+
+            // Deep Copy
+            ArrayList<CachedRow> data = new ArrayList<CachedRow>();
+
+            do {
+                data.add(currentRow.createClone());
+            } while (next());
+
+            // TODO: should be the same granularity with RI using Debug tool
+            // inspect!
+            ((CachedRowSetImpl) output).setRows(data, columnCount);
+            output.setMetaData(((RowSetMetaDataImpl) getMetaData()));
+            output.originalResultSet = this.originalResultSet;
+            output.setUrl(getUrl());
+            output.setTableName(getTableName());
+
+            // Constraints
+            output.setReadOnly(isReadOnly());
+            output.setConcurrency(this.getConcurrency());
+            output.setType(this.getType());
+
+            // recovery this's state for the modification of the operation
+            // first() and next();
+            currentRow = cr;
+            currentRowIndex = temp;
+
+            return output;
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
+            return null;
+        }
     }
 
     public CachedRowSet createCopyNoConstraints() throws SQLException {
-        throw new NotImplementedException();
+        CachedRowSetImpl output;
+        try {
+            output = (CachedRowSetImpl) super.clone();
+            // restore "this"'s states
+            int temp = currentRowIndex;
+            CachedRow cr;
+            if (currentRow != null)
+                cr = currentRow.createClone();
+            else
+                cr = null;
+            first();
+
+            // Deep Copy
+            ArrayList<CachedRow> data = new ArrayList<CachedRow>();
+            do {
+                data.add(currentRow.createClone());
+            } while (next());
+
+            // TODO: should be the same granularity with RI using Debug tool
+            // inspect!
+            ((CachedRowSetImpl) output).setRows(data, columnCount);
+            output.setMetaData((RowSetMetaData) (this.getMetaData()));
+            output.originalResultSet = this.originalResultSet;
+            output.setUrl(getUrl());
+            output.setTableName(getTableName());
+
+            // recovery this's state for the modification of the operation
+            // first() and next();
+            currentRow = cr;
+            currentRowIndex = temp;
+
+            return output;
+        } catch (CloneNotSupportedException e) {
+            e.printStackTrace();
+            return null;
+        }
     }
 
     public CachedRowSet createCopySchema() throws SQLException {
-        throw new NotImplementedException();
+        // For webRowSet: represent the table structure: Columns
+        CachedRowSetImpl result;
+        try {
+            result = (CachedRowSetImpl) super.clone();
+            result.meta = (RowSetMetaDataImpl) meta;
+            result.keyCols = this.keyCols == null ? null : this.keyCols.clone();
+            return result;
+        } catch (CloneNotSupportedException e1) {
+            return null;
+        }
     }
 
     public RowSet createShared() throws SQLException {
-        throw new NotImplementedException();
+        // shallow copy
+        CachedRowSetImpl result = new CachedRowSetImpl();
+        result.rows = this.rows;
+
+        result.currentRowIndex = this.currentRowIndex;
+        result.currentRow = this.currentRow;
+        result.meta = this.meta;
+
+        result.setReadOnly(isReadOnly());
+        result.setConcurrency(super.getConcurrency());
+        result.setType(super.getType());
+
+        return result;
     }
 
     public void execute(Connection conn) throws SQLException {
-        //new connection using the direct-base class: BaseRowSet to get the connection and make the data query 
-        //and then populate the data
-        throw new NotImplementedException();
+        // ensure the getConnection can works!
+        String localCommand = getCommand();
+        if (localCommand == null || getParams() == null)
+            throw new SQLException();
+
+        PreparedStatement ps = conn.prepareStatement(localCommand);
+        Object[] params = getParams();
+        for (int i = 0; i < params.length; i++)
+            ps.setObject(i + 1, params[i]);
+
+        if (ps.execute()) {
+            populate(ps.getResultSet());
+        }
     }
 
     public int[] getKeyColumns() throws SQLException {
-        throw new NotImplementedException();
+        return keyCols.clone();
     }
 
     public ResultSet getOriginal() throws SQLException {
@@ -186,8 +306,8 @@
             throw new SQLException();
         CachedRowSetImpl specialRset = new CachedRowSetImpl();
         ArrayList<CachedRow> data = new ArrayList<CachedRow>();
-        data.add(this.originalRow);        
-        specialRset.setRows(data, this.columnCount);        
+        data.add(this.originalRow);
+        specialRset.setRows(data, this.columnCount);
         return specialRset;
     }
 
@@ -207,25 +327,35 @@
         return tableName;
     }
 
+    /**
+     * refill the cachedrowset with pagesize, and the previous rowset was
+     * replaced
+     */
     public boolean nextPage() throws SQLException {
-        throw new NotImplementedException();
+        pageNumber++;
+        return false;
     }
 
     public void populate(ResultSet data) throws SQLException {
-        populate(data, 0);
+        populate(data, -1);
     }
 
     public void populate(ResultSet rs, int startRow) throws SQLException {
+        initParams();
         composeMetaData(rs.getMetaData());
+
         new CachedRowSetReader(rs, startRow).readData(this);
-        dataBaseURL = rs.getStatement().getConnection().getMetaData().getURL();        
+
         setTableName(rs.getMetaData().getTableName(1));
-        
-        //deep clone the resultset        
+
         originalResultSet = new CachedRowSetImpl();
         new CachedRowSetReader(this, startRow).readData(originalResultSet);
-        originalResultSet.setMetaData((RowSetMetaData)(this.getMetaData()));
-        first();
+        originalResultSet.setMetaData((RowSetMetaData) (this.getMetaData()));
+
+        // recovery the states
+        currentRow = null;
+        currentRowIndex = 0;
+
     }
 
     private void composeMetaData(ResultSetMetaData metaData)
@@ -243,7 +373,8 @@
     }
 
     public boolean previousPage() throws SQLException {
-        throw new NotImplementedException();
+        // TODO
+        return false;
     }
 
     public void release() throws SQLException {
@@ -268,7 +399,7 @@
     }
 
     public void setKeyColumns(int[] keys) throws SQLException {
-        throw new NotImplementedException();
+        keyCols = keys.clone();
     }
 
     public void setMetaData(RowSetMetaData md) throws SQLException {
@@ -276,10 +407,12 @@
     }
 
     public void setOriginalRow() throws SQLException {
+
         if (currentRow == null)
             throw new SQLException();
         originalRow = currentRow;
-        currentRow.setUnavailable(); 
+        currentRow.setNonUpdateable();
+
     }
 
     public void setPageSize(int size) throws SQLException {
@@ -287,13 +420,12 @@
             // rowset.2=Negative page size
             throw new SQLException(Messages.getString("rowset.2"));
         }
+        if ((getMaxRows() != 0) && (getMaxRows() < size))
+            throw new SQLException(Messages.getString("rowset.9"));
         this.pageSize = size;
     }
 
     public void setSyncProvider(String provider) throws SQLException {
-        // If a different concurrency control mechanism is desired, a different
-        // implementation of SyncProvider can be plugged in using the method
-        // setSyncProvider
         syncProvider = SyncFactory.getInstance(provider);
     }
 
@@ -322,7 +454,10 @@
     }
 
     public void undoDelete() throws SQLException {
-        throw new NotImplementedException();
+        if (currentRow == null)
+            throw new SQLException();
+        if (currentRow.getDelete())
+            currentRow.unDoDelete();
     }
 
     public void undoInsert() throws SQLException {
@@ -374,15 +509,35 @@
     }
 
     public boolean absolute(int row) throws SQLException {
-        throw new NotImplementedException();
+        if (rows.size() == 0)
+            return false;
+        if (getType() == ResultSet.TYPE_FORWARD_ONLY)
+            throw new SQLException();
+        if (row < 0) {
+            row = rows.size() + row + 1;
+        } else if (row == 0) {
+            this.currentRowIndex = row;
+            this.currentRow = null;
+            return true;
+        }
+
+        this.currentRowIndex = row;
+        this.currentRow = (CachedRow) rows.get(currentRowIndex - 1);
+        return true;
     }
 
     public void afterLast() throws SQLException {
-        throw new NotImplementedException();
+        if (getType() == TYPE_FORWARD_ONLY)
+            throw new SQLException(Messages.getString("rowset.8"));
+        currentRowIndex = rows.size() + 1;
+        currentRow = null;
     }
 
     public void beforeFirst() throws SQLException {
-        throw new NotImplementedException();
+        if (getType() == TYPE_FORWARD_ONLY)
+            throw new SQLException(Messages.getString("rowset.8"));
+        currentRowIndex = 0;
+        currentRow = null;
     }
 
     public void cancelRowUpdates() throws SQLException {
@@ -394,8 +549,13 @@
     }
 
     public void close() throws SQLException {
-        //TODO need more concerns!
-        rows.clear();        
+
+        // TODO need more concerns!
+        rows.clear();
+        currentRowIndex = 0;
+        currentRow = null;
+        meta = null;
+
     }
 
     public void deleteRow() throws SQLException {
@@ -415,11 +575,7 @@
     }
 
     public boolean first() throws SQLException {
-        if (rows.size() == 0)
-            return false;
-        this.currentRowIndex = 0;
-        this.currentRow = (CachedRow) rows.get(0);
-        return true;
+        return absolute(1);
     }
 
     public Array getArray(int columnIndex) throws SQLException {
@@ -469,31 +625,31 @@
     }
 
     public Blob getBlob(String columnName) throws SQLException {
-        throw new NotImplementedException();
+        return this.currentRow.getBLOb(getIndexByName(columnName));
     }
 
     public boolean getBoolean(int columnIndex) throws SQLException {
-        throw new NotImplementedException();
+        return this.currentRow.getBoolean(columnIndex);
     }
 
     public boolean getBoolean(String columnName) throws SQLException {
-        throw new NotImplementedException();
+        return this.currentRow.getBoolean(getIndexByName(columnName));
     }
 
     public byte getByte(int columnIndex) throws SQLException {
-        throw new NotImplementedException();
+        return this.currentRow.getByte(columnIndex);
     }
 
     public byte getByte(String columnName) throws SQLException {
-        throw new NotImplementedException();
+        return this.currentRow.getByte(getIndexByName(columnName));
     }
 
     public byte[] getBytes(int columnIndex) throws SQLException {
-        throw new NotImplementedException();
+        return this.currentRow.getBytes(columnIndex);
     }
 
     public byte[] getBytes(String columnName) throws SQLException {
-        throw new NotImplementedException();
+        return this.currentRow.getBytes(getIndexByName(columnName));
     }
 
     public Reader getCharacterStream(int columnIndex) throws SQLException {
@@ -549,6 +705,7 @@
     }
 
     public int getInt(int columnIndex) throws SQLException {
+        checkCursorValid();
         return this.currentRow.getInt(columnIndex);
     }
 
@@ -615,6 +772,13 @@
         return currentRow.getString(columnIndex);
     }
 
+    private boolean checkCursorValid() throws SQLException {
+        if ((currentRowIndex <= 0) || (currentRowIndex > rows.size()))
+            throw new SQLException(Messages.getString("rowset.7"));
+        else
+            return false;
+    }
+
     public String getString(String columnName) throws SQLException {
         return currentRow.getString(getIndexByName(columnName));
     }
@@ -703,14 +867,16 @@
     }
 
     public boolean last() throws SQLException {
-        throw new NotImplementedException();
+        return absolute(-1);
     }
 
     public void moveToCurrentRow() throws SQLException {
+
         if (this.currentRow == this.insertRow) {
             this.currentRowIndex = rememberedCursorPosition;
-            this.currentRow = rows.get(currentRowIndex);
+            this.currentRow = rows.get(currentRowIndex - 1);
         }
+
     }
 
     public void moveToInsertRow() throws SQLException {
@@ -730,7 +896,12 @@
     }
 
     public boolean previous() throws SQLException {
-        throw new NotImplementedException();
+        currentRowIndex--;
+        if (rows.size() < currentRowIndex) {
+            return false;
+        }
+        currentRow = rows.get(currentRowIndex - 1);
+        return true;
     }
 
     public void refreshRow() throws SQLException {
@@ -743,14 +914,21 @@
 
     public boolean rowDeleted() throws SQLException {
         checkValidRow();
+        checkCursorValid();
         return currentRow.getDelete();
     }
 
     public boolean rowInserted() throws SQLException {
+
+        /**
+         * FIXME: Determin the currentRow if have had a insertion 1. Need
+         * traverse the rows and find if the data hava been added
+         */
         return this.currentRow.getInsert();
     }
 
     public boolean rowUpdated() throws SQLException {
+
         boolean sign = false;
         for (int i = 0; i < meta.getColumnCount(); ++i)
             sign = this.currentRow.getUpdateMask(i) | sign;
@@ -924,6 +1102,7 @@
                 || (this.getConcurrency() == (ResultSet.CONCUR_READ_ONLY)))
             throw new SQLException();
         rows.set(currentRowIndex, currentRow);
+        notifyRowChanged();
     }
 
     public void updateShort(int columnIndex, short x) throws SQLException {
@@ -961,20 +1140,19 @@
     }
 
     public boolean wasNull() throws SQLException {
+        // return (currentColumn instanceof Types(Types.NULL));
         throw new NotImplementedException();
     }
 
     public void execute() throws SQLException {
-        //new connection using the direct-base class: BaseRowSet to get the connection and make the data query 
-        //populate the data
-        throw new NotImplementedException();
+        execute(getConnection());
     }
 
     public Connection getConnection() throws SQLException {
-        return DriverManager.getConnection(dataBaseURL);
-    } 
-    
-    CachedRow getCurrentRow(){
+        return DriverManager.getConnection(getUrl());
+    }
+
+    CachedRow getCurrentRow() {
         return currentRow;
     }
 
@@ -1181,6 +1359,12 @@
     public boolean isClosed() throws SQLException {
         // TODO Auto-generated method stub
         return false;
+    }
+
+    @Override
+    public void setCommand(String cmd) throws SQLException {
+        initParams();
+        super.setCommand(cmd);
     }
 
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetReader.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetReader.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetReader.java Wed Nov  7 01:51:00 2007
@@ -23,6 +23,7 @@
 
 import javax.sql.RowSetInternal;
 import javax.sql.RowSetReader;
+import javax.sql.rowset.CachedRowSet;
 
 public class CachedRowSetReader implements RowSetReader {
 
@@ -39,14 +40,29 @@
     }
 
     public void readData(RowSetInternal theCaller) throws SQLException {
+        int pageSize = ((CachedRowSet)theCaller).getPageSize();
         ArrayList<CachedRow> data = new ArrayList<CachedRow>();
-        int columnCount = metadata.getColumnCount();
-        while (rs.next()) {
+        int columnCount = metadata.getColumnCount();        
+        int tempCursor = 0;
+        
+        if (startRow >= 0) {
+            if (rs.getType() == ResultSet.TYPE_FORWARD_ONLY)
+                throw new SQLException();
+            else {
+                rs.beforeFirst();
+                for (int j = 1; j++ < startRow; rs.next())
+                    ;
+            }
+        }
+        
+        while ((rs.next())) {            
             Object[] columnData = new Object[columnCount];
             for (int i = 0; i < columnCount; i++) {
                 columnData[i] = rs.getObject(i+1);
             }
-            data.add(new CachedRow(columnData));
+            if((pageSize>0)&&(pageSize<++tempCursor)) break;
+            data.add(new CachedRow(columnData));            
+            
         }
         ((CachedRowSetImpl) theCaller).setRows(data, columnCount);
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetWriter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetWriter.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetWriter.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetWriter.java Wed Nov  7 01:51:00 2007
@@ -32,6 +32,7 @@
 
 public class CachedRowSetWriter implements RowSetWriter {
 
+
     private ResultSet primaryKeys;
 
     private CachedRowSet originalRowSet;
@@ -46,7 +47,7 @@
 
     private String sql;
 
-    private int columnCount, keysCount, keyColumnNumber;
+    private int columnCount;
 
     private int signal = 0;
 
@@ -55,18 +56,22 @@
     private String keyColumnName, whereStatementForOriginal,
             whereStatementForCurrent;
 
+
     public boolean writeData(RowSetInternal theRowSet) throws SQLException {
         // use an optimistic concurrency control mechanism
+
         initial(theRowSet);
         // analyse every row and do responsible task.
         currentRowSet.first();
         originalRowSet.first();
-        while (currentRowSet.next()) {
+        do{
             // rolling with currentRowSet
             if (originalRowSet.next()) {
                 // deal with updated or deleted row which need do conflict check
-                if (checkConflictNotExist()) {
-                    writeRowData();
+                if (checkConflictNotExist(originalRowSet)) {
+                    //If all of the values in the data source are already the values to be persisted, 
+                    //the method acceptChanges does nothing. 
+                    if(!checkConflictNotExist(currentRowSet))  writeRowData();
                 } else {
                     cleanEnvironment();
                     throw new SyncProviderException(Messages
@@ -79,13 +84,14 @@
                 // FIXME: need pre-check before insert into database?
                 writeRowData();
             }
-        }
+        }while (currentRowSet.next());
 
         cleanEnvironment();
+
         return true;
     }
-
-    private void initial(RowSetInternal theRowSet) throws SQLException {
+    
+    private void initial(RowSetInternal theRowSet) throws SQLException {      
         currentRowSet = (CachedRowSetImpl) theRowSet;
         // initial environment
         originalRowSet = (CachedRowSet) currentRowSet.getOriginal();
@@ -96,9 +102,9 @@
         primaryKeys = originalConnection.getMetaData().getPrimaryKeys("",
                 currentRowSet.getMetaData().getSchemaName(1), tableName);
         cachedKeySet.populate(primaryKeys);
-        keysCount = cachedKeySet.getMetaData().getColumnCount();
     }
 
+
     private void writeRowData() throws SQLException {
         try {
             createScriptForWriteBack();
@@ -122,19 +128,21 @@
             e.printStackTrace();
             new SQLException(Messages.getString("rowset.6"));
         }
+
     }
 
+
     private void createScriptForWriteBack() throws SQLException {
         cachedKeySet.first();
         whereStatementForCurrent = "";
         String insertCollector = "", updateCollector = "";
         // FIXME:uses getUpdateMask()
 
-        while (cachedKeySet.next()) {
+         do{
             keyColumnName = cachedKeySet.getString("COLUMN_NAME");
             whereStatementForCurrent = whereStatementForCurrent + keyColumnName
                     + " = ? " + " and ";
-        }
+        }while (cachedKeySet.next());
 
         whereStatementForCurrent = subStringN(whereStatementForCurrent, 5);
 
@@ -185,12 +193,12 @@
                     + originalRowSet.getMetaData().getColumnName(i) + ", ";
         tempSelector = tempSelector.substring(0, tempSelector.length() - 2);
         sql = "select " + tempSelector + " from " + tableName + " where ";
-        while (cachedKeySet.next()) {
+        do {
             keyColumnName = cachedKeySet.getString("COLUMN_NAME");
             whereStatementForOriginal = whereStatementForOriginal
                     + keyColumnName + " = ? " + " and ";
             whereStatementForOriginal = subStringN(whereStatementForOriginal, 5);
-        }
+        } while (cachedKeySet.next());
         cachedKeySet.first();
         sql = sql + whereStatementForOriginal;
     }
@@ -199,11 +207,11 @@
             throws SQLException {
         cachedKeySet.first();
         int i = from+1;        
-        while (cachedKeySet.next()) {
+        do {
             keyColumnName = cachedKeySet.getString("COLUMN_NAME");
             ((PreparedStatement) statement).setObject(i++, inputRS
                     .getObject(keyColumnName));
-        }
+        } while (cachedKeySet.next()); 
     }
 
     private void fillParasOfAllColumn() throws SQLException {
@@ -212,7 +220,7 @@
                     .getObject(i));
     }
 
-    private boolean checkConflictNotExist() {
+    private boolean checkConflictNotExist(CachedRowSet crs) {
         try {
             createScriptForCheck();
             statement = originalConnection.prepareStatement(sql);
@@ -222,8 +230,7 @@
             // compare line by line, column by column
             if (dataInDB.next()) {
                 for (int i = 1; i <= dataInDB.getMetaData().getColumnCount(); i++) {
-                    if (!(dataInDB.getObject(i).equals(originalRowSet
-                            .getObject(i))))
+                    if (!(dataInDB.getObject(i).equals(crs.getObject(i))))
                         return false;
                 }
             }
@@ -234,7 +241,7 @@
     }
 
     private void cleanEnvironment() {
-        try {
+        try {           
             originalRowSet.close();
             originalConnection.close();
             cachedKeySet.close();
@@ -246,4 +253,5 @@
         }
     }
     // end class
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/HYOptimisticProvider.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/HYOptimisticProvider.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/HYOptimisticProvider.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/HYOptimisticProvider.java Wed Nov  7 01:51:00 2007
@@ -30,6 +30,10 @@
 
     private final static int providerGrade = SyncProvider.DATASOURCE_NO_LOCK;
 
+    private final static String vendor = "Apache Harmony";
+
+    private final static String version = "";
+
     @Override
     public int getDataSourceLock() throws SyncProviderException {
         // TODO Auto-generated method stub
@@ -58,14 +62,12 @@
 
     @Override
     public String getVendor() {
-        // TODO Auto-generated method stub
-        return null;
+        return vendor;
     }
 
     @Override
     public String getVersion() {
-        // TODO Auto-generated method stub
-        return null;
+        return version;
     }
 
     @Override

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetImplTest.java Wed Nov  7 01:51:00 2007
@@ -22,6 +22,7 @@
 import java.sql.SQLException;
 import java.sql.Statement;
 
+import javax.sql.RowSetMetaData;
 import javax.sql.rowset.CachedRowSet;
 
 import junit.framework.TestCase;
@@ -29,6 +30,7 @@
 public class CachedRowSetImplTest extends TestCase {
 
     private static final String DERBY_URL_Create = "jdbc:derby:src/test/resources/TESTDB;create=true";
+
     private static final String DERBY_URL = "jdbc:derby:src/test/resources/TESTDB";
 
     private Connection conn;
@@ -42,84 +44,80 @@
     public void setUp() throws IllegalAccessException, InstantiationException,
             ClassNotFoundException, SQLException {
         Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+
         try {
             conn = DriverManager.getConnection(DERBY_URL);
         } catch (SQLException e) {
             try {
-                conn = DriverManager.getConnection(DERBY_URL_Create);  
-            } catch (SQLException ee) {                
+                conn = DriverManager.getConnection(DERBY_URL_Create);
+            } catch (SQLException ee) {
                 throw new SQLException("Create DB Failure!");
-            }  
-        };
+            }
+        }
+        ;
+
         st = conn.createStatement();
+
         rs = conn.getMetaData().getTables(null, "APP", "USER_INFO", null);
-        //careful: Integer, rather than int!
+        // careful: Integer, rather than int!
+
         if (!rs.next()) {
             st
                     .execute("create table USER_INFO (ID INTEGER NOT NULL,NAME VARCHAR(10) NOT NULL)");
             st
                     .execute("ALTER TABLE USER_INFO  ADD CONSTRAINT USER_INFO_PK Primary Key (ID)");
         }
-        
-//        ResultSet primaryKeys = conn.getMetaData().getPrimaryKeys(null, "APP", "USER_INFO");
-//        
-//        while(primaryKeys.next()){
-//            System.out.println(primaryKeys.getString("TABLE_NAME"));
-//            System.out.println(primaryKeys.getString("KEY_SEQ"));
-//            System.out.println(primaryKeys.getString("PK_NAME"));
-//            System.out.println(primaryKeys.getString("COLUMN_NAME"));
-//        }
-        
-//      ResultSet rss = DriverManager.getConnection(DERBY_URL).getMetaData()
-//      .getPrimaryKeys(null, "APP", "USER_INFO");
-//while (rss.next()) {
-//  for (int i = 0; i < rss.getMetaData().getColumnCount(); i++) {
-//
-//      System.out.println(rss.getString(i + 1));
-//
-//  }
-//}        
+
         st.executeUpdate("delete from USER_INFO");
         st.executeUpdate("insert into USER_INFO(ID,NAME) values (1,'hermit')");
         st.executeUpdate("insert into USER_INFO(ID,NAME) values (2,'test')");
         rs = st.executeQuery("select * from USER_INFO");
         try {
             crset = (CachedRowSet) Class.forName(
-                    "com.sun.rowset.CachedRowSetImpl").newInstance();            
+
+            "com.sun.rowset.CachedRowSetImpl").newInstance();
+
             System.out.println("Testing RI");
         } catch (ClassNotFoundException e) {
-//            System.setProperty("CachedRowSetImpl_Test_Signal",
-//                    "Testing Harmony");            
+
             crset = (CachedRowSet) Class.forName(
                     "org.apache.harmony.sql.internal.rowset.CachedRowSetImpl")
                     .newInstance();
+
+            System.setProperty("Testing Harmony", "true");
             System.out.println("Testing Harmony");
+
         }
         crset.populate(rs);
         rs = st.executeQuery("select * from USER_INFO");
+        crset.setUrl(DERBY_URL);
     }
 
     public void tearDown() throws SQLException {
         if (rs != null) {
             rs.close();
         }
+        if (crset != null)
+            crset.close();
     }
 
     public void testSetSyncProvider() throws Exception {
-        // String mySyncProvider = "org.apache.internal.SyncProviderImpl";
-        // crset.setSyncProvider(mySyncProvider);
-        // assertEquals(crset.getSyncProvider().getClass().getCanonicalName(),
-        // mySyncProvider);
+        if (System.getProperty("Testing Harmony") == "true") {
+            String mySyncProvider = "org.apache.harmony.sql.internal.rowset.HYOptimisticProvider";
+            crset.setSyncProvider(mySyncProvider);
+            assertEquals(crset.getSyncProvider().getClass().getCanonicalName(),
+                    mySyncProvider);
+        }
     }
 
     public void testColumnUpdatedInt() throws SQLException {
         crset.first();
-//        try {
-//            assertFalse(crset.columnUpdated(1));
-//            fail("should throw SQLException");
-//        } catch (SQLException e) {
-//            // expected;
-//        }
+        // try {
+        // assertFalse(crset.columnUpdated(1));
+        // fail("should throw SQLException");
+        // } catch (SQLException e) {
+        // // expected;
+        // }
         crset.next();
         try {
             crset.columnUpdated(-1);
@@ -138,12 +136,12 @@
 
     public void testColumnUpdatedString() throws SQLException {
         crset.first();
-//        try {
-//            assertFalse(crset.columnUpdated("ID"));
-//            fail("should throw SQLException");
-//        } catch (SQLException e) {
-//            // expected;
-//        }
+        // try {
+        // assertFalse(crset.columnUpdated("ID"));
+        // fail("should throw SQLException");
+        // } catch (SQLException e) {
+        // // expected;
+        // }
         crset.next();
         try {
             assertFalse(crset.columnUpdated("Incorrect"));
@@ -172,7 +170,8 @@
         assertEquals(Integer.MAX_VALUE, crset.getPageSize());
     }
 
-    public void testGetTableName() throws SQLException {        
+    public void testGetTableName() throws SQLException {
+
         crset.setTableName("USER");
         assertEquals("USER", crset.getTableName());
     }
@@ -192,12 +191,12 @@
 
     public void testDeleteRow() throws SQLException {
         crset.first();
-//        try {
-//            crset.deleteRow();
-//            fail("should throw SQLException");
-//        } catch (SQLException e) {
-//            // expected;
-//        }
+        // try {
+        // crset.deleteRow();
+        // fail("should throw SQLException");
+        // } catch (SQLException e) {
+        // // expected;
+        // }
         crset.next();
         assertFalse(crset.rowDeleted());
         crset.deleteRow();
@@ -206,12 +205,12 @@
     }
 
     public void testRowDeleted() throws SQLException {
-//        try {
-//            crset.rowDeleted();
-//            fail("should throw SQLException");
-//        } catch (SQLException e) {
-//            // expected;
-//        }
+        // try {
+        // crset.rowDeleted();
+        // fail("should throw SQLException");
+        // } catch (SQLException e) {
+        // // expected;
+        // }
     }
 
     public void testInsertRow() throws SQLException {
@@ -237,55 +236,229 @@
         assertEquals("TonyWu", crset.getString("Name"));
         assertEquals(3, crset.getInt(1));
         assertEquals(3, crset.getInt("ID"));
-        //FIXME
-        //The value returned depends on whether or not this ResultSet object can detect visible inserts. 
-        // It depends on implementation?? 
-//        assertTrue(crset.rowInserted());
+
+        crset.moveToCurrentRow();
+        assertFalse(crset.rowInserted());
+
     }
 
-    public void testAcceptChanges() throws SQLException {        
+    public void testAcceptChanges() throws SQLException {
         rs.next();
         assertEquals(1, rs.getInt(1));
+
         assertEquals("hermit", rs.getString(2));
-        crset.next();
+        crset.first();
+
         assertEquals(1, crset.getInt(1));
+
         assertEquals("hermit", crset.getString(2));
         crset.updateString(2, "HarmonY");
-        
+
         crset.moveToInsertRow();
         crset.updateInt(1, 16);
-        crset.updateString(2, "Apache");        
+        crset.updateString(2, "Apache");
         crset.insertRow();
         crset.moveToCurrentRow();
-        
+
         crset.deleteRow();
-        
+        /*
+         * RI will print the change result
+         */
+        crset.acceptChanges();
+
+        rs = st.executeQuery("select * from USER_INFO");
+        rs.next();
+        assertEquals(rs.getString(2), "test");
+        rs.next();
+        assertEquals(rs.getString(2), "Apache");
+
+    }
+
+    public void testExecute() throws SQLException {
+        crset.setCommand("Update User_INFO set Name= ? Where ID= ? ");
+        crset.setString(1, "executed!");
+        crset.setInt(2, 1);
+        crset.execute();
+
+        crset.setCommand("SELECT ID, NAME FROM USER_INFO" + " WHERE ID = ? ");
+        crset.setInt(1, 1);
+        crset.execute();
+
+        crset.first();
+        assertEquals("executed!", crset.getString(2));
+
+        crset.setCommand("Update User_INFO set Name= ? Where ID= ? ");
+        crset.setString(1, "executed!");
+        crset.setInt(2, 1);
+        crset.execute(DriverManager.getConnection(DERBY_URL));
+
+        crset.setCommand("SELECT ID, NAME FROM USER_INFO" + " WHERE ID = ? ");
+        crset.setInt(1, 1);
+        crset.execute(DriverManager.getConnection(DERBY_URL));
+    }
+
+    public void testExecute2() throws Exception {
+        crset.setCommand("SELECT ID, NAME FROM USER_INFO" + " WHERE ID = ? ");
+        crset.setInt(1, 1);
+        crset.execute();
+
+        crset.first();
+        assertEquals("hermit", crset.getString(2));
+    }
+
+    public void testCreateShared() throws Exception {
+        CachedRowSet crsetShared = (CachedRowSet) crset.createShared();
+        crsetShared.first();
+        crset.first();
+        crsetShared.updateString(2, "copyTest2");
+        assertEquals(crsetShared.getString(2), "copyTest2");
+        assertEquals(crset.getString(2), "copyTest2");
+    }
+
+    public void testcreateCopyNoConstraints() throws Exception {
+        crset.first();
+
+        CachedRowSet crsetCopyNoConstraints = (CachedRowSet) crset
+                .createCopyNoConstraints();
+
+        // Modify he constraints
+        crset.setReadOnly(false);
+        crset.setConcurrency(ResultSet.CONCUR_READ_ONLY);
+        crset.setType(ResultSet.TYPE_FORWARD_ONLY);
+
+        crsetCopyNoConstraints.first();
+        crsetCopyNoConstraints.updateString(2, "copyTest2");
+        assertEquals(crsetCopyNoConstraints.getString(2), "copyTest2");
+        assertEquals(crset.getString(2), "hermit");
+        // the copyNoConstraints keep the default value of the CachedRowSet
+        assertEquals(crsetCopyNoConstraints.isReadOnly(), true);
+        assertEquals(crsetCopyNoConstraints.getConcurrency(),
+                ResultSet.CONCUR_UPDATABLE);
+        assertEquals(crsetCopyNoConstraints.getType(),
+                ResultSet.TYPE_SCROLL_INSENSITIVE);
+
+    }
+
+    public void testCopySchema() throws Exception {
+        crset.first();
+        CachedRowSet crsetCopySchema = (CachedRowSet) crset.createCopySchema();
+
+        RowSetMetaData rsmCopySchema = (RowSetMetaData) crsetCopySchema
+                .getMetaData();
+        assertEquals("USER_INFO", rsmCopySchema.getTableName(1));
+        assertEquals(2, rsmCopySchema.getColumnCount());
+
+        RowSetMetaData rsm = (RowSetMetaData) crset.getMetaData();
+        rsm.setTableName(1, "newBorn");
+        assertEquals("newBorn", rsm.getTableName(1));
+
+        crset.setTableName("test");
+        assertEquals("test", crset.getTableName());
+    }
+
+    public void testCreateCopy() throws Exception {
+        crset.first();
+        assertEquals(crset.getString(2), "hermit");
+        crset.updateString(2, "copyTest");
+        crset.updateRow();
+        crset.acceptChanges();
+
+        rs = st.executeQuery("select * from USER_INFO");
+        rs.next();
+        assertEquals(rs.getString(2), "copyTest");
+
+        CachedRowSet crsetCopy = (CachedRowSet) crset.createCopy();
+
+        crsetCopy.first();
+        crsetCopy.updateString(2, "copyTest2");
+        crsetCopy.updateRow();
+        crsetCopy.acceptChanges();
+
+        assertEquals(crsetCopy.getString(2), "copyTest2");
+        assertEquals(crset.getString(2), "copyTest");
+
+        rs = st.executeQuery("select * from USER_INFO");
+        rs.next();
+        assertEquals(rs.getString(2), "copyTest2");
+
+        crset.first();
+        assertEquals(crset.getString(2), "copyTest");
+    }
+
+    public void testAfterLast() throws Exception {
         try {
-            // RI: acceptChanges() also failure, only the
-            // acceptChanges(connection) passed.
-            // HY: two status both passed.
-            // Action: ??
-            crset.acceptChanges(DriverManager.getConnection(DERBY_URL));
-            // FIXME
-            // crset.acceptChanges();
+            rs.afterLast();
+            fail("Should throw SQLException");
         } catch (SQLException e) {
-            fail("should throw SyncProviderException");
+            // expected
+        }
+
+        crset.afterLast();
+        crset.previous();
+        assertEquals(2, crset.getInt(1));
+    }
+
+    public void testNextandPreviousPage() throws Exception {
+
+        st.executeUpdate("delete from USER_INFO");
+        st.executeUpdate("insert into USER_INFO(ID,NAME) values (1,'1')");
+        st.executeUpdate("insert into USER_INFO(ID,NAME) values (2,'2')");
+        st.executeUpdate("insert into USER_INFO(ID,NAME) values (3,'3')");
+        st.executeUpdate("insert into USER_INFO(ID,NAME) values (4,'4')");
+        rs = st.executeQuery("select * from USER_INFO");
+
+        crset.setPageSize(2);
+        crset.setCommand("SELECT ID FROM USER_INFO");
+        crset.execute();
+
+        for (int j = 0; j < 2; j++)
+            crset.next();
+        assertFalse(crset.next());
+
+        int i = 0;
+
+        crset.beforeFirst();
+        while (crset.nextPage()) {
+            while (crset.next()) {
+                assertEquals(++i, crset.getInt(1));
+            }
+        }
+
+        while (crset.previousPage()) {
+            crset.afterLast();
+            while (crset.previous()) {
+                assertEquals(i--, crset.getInt(1));
+            }
+        }
+
+        while (crset.previousPage()) {
+            i = i - crset.getPageSize();
+            int j = i;
+            while (crset.next()) {
+                assertEquals(++j, crset.getInt(1));
+            }
         }
     }
 
-// public void testAcceptChangesConnection() throws SQLException {
-//        rs.next();
-//        assertEquals(1, rs.getInt(1));
-//        crset.first();
-//        assertEquals(1, crset.getInt(1));
-//        crset.updateInt(1, 3);
-//        assertEquals(3, crset.getInt(1));
-//        crset.updateRow();
-//        crset.moveToCurrentRow();
-//        assertEquals(3, crset.getInt(1));
-//        // crset.acceptChanges(conn);
-//        // rs = st.executeQuery("select * from USER_INFO");
-//        // rs.next();
-//        // assertEquals(3, rs.getInt(1));
-//    }
+    public void testPopulate() throws Exception {
+        CachedRowSet cc = crset.createCopy();
+
+        try {
+            crset.populate(rs, 0);
+            fail("should throw exception");
+        } catch (Exception e) {
+            // expected
+        }
+        crset.populate(rs);
+        crset.first();
+        assertEquals("hermit", crset.getString(2));
+
+        crset.populate(cc, 2);
+        crset.first();
+        assertEquals("test", crset.getString(2));
+
+        crset.populate(cc, 1);
+        crset.first();
+        assertEquals("hermit", crset.getString(2));
+    }
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JComboBox.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JComboBox.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JComboBox.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/JComboBox.java Wed Nov  7 01:51:00 2007
@@ -568,7 +568,6 @@
 
     public void actionPerformed(ActionEvent e) {
         setSelectedItem(editor.getItem());
-        getUI().setPopupVisible(this, false);
     }
 
     public void contentsChanged(ListDataEvent e) {

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/SwingUtilities.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/SwingUtilities.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/SwingUtilities.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/SwingUtilities.java Wed Nov  7 01:51:00 2007
@@ -401,6 +401,9 @@
         while (child != null && child instanceof Container) {
             parent = child;
             child = parent.getComponentAt(x, y);
+            if (child == parent) {
+                break;
+            }
         }
 
         return (child != null) ? child : parent;

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/main/java/common/javax/swing/plaf/basic/BasicComboBoxUI.java Wed Nov  7 01:51:00 2007
@@ -125,7 +125,6 @@
 
         public void focusLost(final FocusEvent e) {
             hasFocus = false;
-            comboBox.hidePopup();
             comboBox.repaint();
         }
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/AbstractButtonTest.java Wed Nov  7 01:51:00 2007
@@ -996,30 +996,28 @@
         String exceptionText = "exceptionText";
         int res = button.checkVerticalKey(SwingConstants.TOP, exceptionText);
         assertEquals("returned value ", 1, res);
-        Throwable exception = null;
         try {
             res = button.checkVerticalKey(SwingConstants.WEST, exceptionText);
-        } catch (Exception e) {
-            exception = e;
+        } catch (IllegalArgumentException e) {
+            assertEquals("exception's message ", exceptionText, e.getMessage());
+            return;
         }
-        assertTrue("exception's been thrown ", exception != null);
-        assertEquals("exception's class ", IllegalArgumentException.class, exception.getClass());
-        assertEquals("exception's message ", exceptionText, exception.getMessage());
+
+        fail("Expected IllegalArgumentException to be thrown");
     }
 
     public void testCheckHorizontalKey() {
         String exceptionText = "exceptionText";
         int res = button.checkHorizontalKey(SwingConstants.TRAILING, exceptionText);
         assertEquals("returned value ", SwingConstants.TRAILING, res);
-        Throwable exception = null;
         try {
             res = button.checkHorizontalKey(SwingConstants.TOP, exceptionText);
-        } catch (Exception e) {
-            exception = e;
+        } catch (IllegalArgumentException e) {
+            assertEquals("exception's message ", exceptionText, e.getMessage());
+            return;
         }
-        assertTrue("exception's been thrown ", exception != null);
-        assertEquals("exception's class ", IllegalArgumentException.class, exception.getClass());
-        assertEquals("exception's message ", exceptionText, exception.getMessage());
+        
+        fail("Expected IllegalArgumentException to be thrown");
     }
 
     public void testCreateActionPropertyChangeListener() {

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JEditorPaneTest.java Wed Nov  7 01:51:00 2007
@@ -460,15 +460,11 @@
                 "javax.swing.text.html.HTMLEditorKit", "text/html", TEST_URL, jep);
     }
 
-    public void testJEditorPaneJarHTML() {
-        try {
-            // Regression for HARMONY-4529
-            URL jar = getClass().getResource("testhtml.jar");
-            URL url = new URL("jar:" + jar + "!/index.html");
-            new JEditorPane(url);
-        } catch (Exception e) {
-            fail("Unexpected exception: " + e);
-        }
+    public void testJEditorPaneJarHTML() throws Exception {
+        // Regression for HARMONY-4529
+        URL jar = getClass().getResource("testhtml.jar");
+        URL url = new URL("jar:" + jar + "!/index.html");
+        new JEditorPane(url);
     }
 
     private void assertEquals(final ArrayList<HyperlinkListener> a, final Object objects[]) {

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/JListRTest.java Wed Nov  7 01:51:00 2007
@@ -24,12 +24,8 @@
 
 public class JListRTest extends TestCase {
     public void testAddSelectionInterval() throws Exception {
-        try {
-            JList jl = new JList();
-            jl.addSelectionInterval(10000000, 1);
-        } catch (Exception e) {
-            fail("Unexpected exception :" + e);
-        }
+        JList jl = new JList();
+        jl.addSelectionInterval(10000000, 1);
     }
 
     public void testSetSelectedIndicies() throws Exception {

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingUtilitiesRTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingUtilitiesRTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingUtilitiesRTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/SwingUtilitiesRTest.java Wed Nov  7 01:51:00 2007
@@ -22,6 +22,7 @@
  */
 package javax.swing;
 
+import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.FontMetrics;
 import java.awt.Frame;
@@ -105,4 +106,44 @@
         final JDialog dialog = new JDialog(f);
         assertSame(f, SwingUtilities.getAncestorOfClass(Frame.class, dialog));
     }
+    
+    public void testDeadLoop_4820() {
+        final int DEAD_LOOP_TIMEOUT = 1000;
+        final int VALID_NUMBER_OF_CALLS = 15;
+        final int counter[] = {0};
+        
+        class MFrame extends Frame {
+            MFrame() {
+                setSize(300,200) ;
+                show();
+            }
+        
+            public Component locate(int x, int y) {
+                counter[0]++;
+                return super.locate(x,y);
+            }
+            
+            public Component getComponentAt(int x, int y) {
+                counter[0]++;
+                return super.getComponentAt(x, y);
+            }
+            
+            public Component getComponentAt(java.awt.Point p) {
+                counter[0]++;
+                return super.getComponentAt(p);
+            }
+        }
+
+        Frame f = new MFrame();
+        
+        SwingUtilities.getDeepestComponentAt(f, 10, 10);
+        try {
+            Thread.sleep(DEAD_LOOP_TIMEOUT);
+        } catch (Exception e) {}
+        
+        f.dispose();
+        
+        assertTrue("Dead loop occured", counter[0] <= VALID_NUMBER_OF_CALLS);
+    }
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/plaf/metal/MetalBordersTest.java Wed Nov  7 01:51:00 2007
@@ -190,7 +190,8 @@
         try {
             border.getBorderInsets(new JButton());
             fail("should throw ClassCastException");
-        } catch (Exception e) {
+        } catch (ClassCastException e) {
+            // Expected
         }
         checkInsets(border, testToolBar);
     }

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/javax/swing/text/UtilitiesTest.java Wed Nov  7 01:51:00 2007
@@ -828,14 +828,10 @@
         assertEquals(-1, Utilities.getRowEnd(c, 6));
     }
 
-    public void testGetRowStartEnd() {
-        try {
-            getRowStartEndTest(jta);
-            //getRowStartEndTest(jtp);
-            getRowStartEndTest(jtf);
-        } catch (Exception e) {
-            assertFalse("Unexpected exception", true);
-        }
+    public void testGetRowStartEnd() throws Exception {
+        getRowStartEndTest(jta);
+        //getRowStartEndTest(jtp);
+        getRowStartEndTest(jtf);
     }
 
     void getPreviousWordTest(final JTextComponent c) {

Modified: harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.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/html/parser/DTDTest.java?rev=592673&r1=592672&r2=592673&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/html/parser/DTDTest.java Wed Nov  7 01:51:00 2007
@@ -35,10 +35,8 @@
             Element e = dtd.getElement(-1);
             fail("IndexOutOfBoundsException wasn't raised as RI, but method returned: " + e);
         } catch (IndexOutOfBoundsException e) {
-        } catch (Exception e) {
-            fail(e.getClass().getName()
-                    + " raised but IndexOutOfBoundsException had to be raised");
-        }
+            // Expected
+        } 
     }
 
     public void testGetElementUpperOutOfBounds() {
@@ -46,9 +44,7 @@
             Element e = dtd.getElement(dtd.elements.size());
             fail("IndexOutOfBoundsException didn't raised as RI, but method returned: " + e);
         } catch (IndexOutOfBoundsException e) {
-        } catch (Exception e) {
-            fail(e.getClass().getName()
-                    + " raised but IndexOutOfBoundsException had to be raised");
+            // Expected
         }
     }
 }



Mime
View raw message