harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r548988 - in /harmony/enhanced/classlib/branches/java6/modules/sql/src: main/java/java/sql/BatchUpdateException.java test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
Date Wed, 20 Jun 2007 08:22:07 GMT
Author: tonywu
Date: Wed Jun 20 01:22:07 2007
New Revision: 548988

URL: http://svn.apache.org/viewvc?view=rev&rev=548988
Log:
Apply patch HARMONY-4241 ([classlib][sql][java6] 5 new constructors in java.sql.BatchUpdateException)

Modified:
    harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/BatchUpdateException.java
    harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/BatchUpdateException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/BatchUpdateException.java?view=diff&rev=548988&r1=548987&r2=548988
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/BatchUpdateException.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/BatchUpdateException.java
Wed Jun 20 01:22:07 2007
@@ -45,6 +45,91 @@
     private int[] updateCounts = null;
 
     /**
+	 * Creates an BatchUpdateException object. The Reason string is set to the
+	 * null if cause == null otherwise to cause.toString(), and the cause
+	 * Throwable object is set to the given cause Throwable object.
+	 * 
+	 * @param cause -
+	 *            the Throwable object for the underlying reason this
+	 *            SQLException
+	 *            
+	 * @since 1.6
+	 */
+    public BatchUpdateException(Throwable cause) {
+		this(null, cause);
+	}
+
+    /**
+	 * Creates an BatchUpdateException object. The Reason string is set to the
+	 * null if cause == null otherwise to cause.toString(), and the cause
+	 * Throwable object is set to the given cause Throwable object. SQLState is
+	 * initialized to null while vendorCode is zero.
+	 * 
+	 * @param cause -
+	 *            the Throwable object for the underlying reason this
+	 *            SQLException
+	 * 
+	 * @since 1.6
+	 */
+    public BatchUpdateException(int[] updateCounts, Throwable cause) {
+    	super(cause);
+    	this.updateCounts = updateCounts;    	
+    }
+
+    /**
+	 * Creates an BatchUpdateException object. The cause Throwable object is set
+	 * to the given cause Throwable object. SQLState is initialized to null
+	 * while vendorCode is zero.
+	 * 
+	 * @param cause -
+	 *            the Throwable object for the underlying reason this
+	 *            SQLException
+	 * 
+	 * @since 1.6
+	 */
+    public BatchUpdateException(String reason, int[] updateCounts,
+            Throwable cause) {
+    	super(reason, cause);
+    	this.updateCounts = updateCounts;
+    }
+
+    /**
+	 * Creates an BatchUpdateException object. The cause Throwable object is set
+	 * to the given cause Throwable object and the updateCounts array set to the
+	 * int array parameter. SQLState is initialized to null while vendorCode is
+	 * zero.
+	 * 
+	 * @param cause -
+	 *            the Throwable object for the underlying reason this
+	 *            SQLException
+	 * 
+	 * @since 1.6
+	 */
+    public BatchUpdateException(String reason, String SQLState,
+            int[] updateCounts, Throwable cause) {
+    	super(reason, SQLState, cause);
+    	this.updateCounts = updateCounts;
+    }
+
+    /**
+	 * Creates an BatchUpdateException object. The cause Throwable object is set
+	 * to the given cause Throwable object and the updateCounts array set to the
+	 * int array parameter. VendorCode is set to the given vendorCode. SQLState
+	 * is initialized to null while vendorCode is zero.
+	 * 
+	 * @param cause -
+	 *            the Throwable object for the underlying reason this
+	 *            SQLException
+	 * 
+	 * @since 1.6
+	 */
+    public BatchUpdateException(String reason, String SQLState, int vendorCode,
+            int[] updateCounts, Throwable cause) {
+    	super(reason, SQLState, vendorCode, cause);
+    	this.updateCounts = updateCounts;
+    }
+
+    /**
      * Creates a BatchUpdateException with the Reason, SQLState, and Update
      * Counts set to null and a Vendor Code of 0.
      */
@@ -144,4 +229,5 @@
     public int[] getUpdateCounts() {
         return updateCounts;
     }
+
 }

Modified: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java?view=diff&rev=548988&r1=548987&r2=548988
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
(original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/BatchUpdateExceptionTest.java
Wed Jun 20 01:22:07 2007
@@ -287,6 +287,95 @@
 		} // end for
 
 	} // end method testBatchUpdateExceptionStringStringintintArray
+	
+	/**
+	 * @tests {@link java.sql.BatchUpdateException#BatchUpdateException(Throwable)}
+	 * 
+	 * @since 1.6
+	 */
+	public void testBatchUpdateExceptionLThrowable() {
+		Throwable cause = new Exception("MYTHROWABLE");
+		BatchUpdateException batchUpdateException = new BatchUpdateException(
+				cause);
+		assertNotNull(batchUpdateException);
+		assertEquals("java.lang.Exception: MYTHROWABLE", batchUpdateException
+				.getMessage());
+		assertNull(batchUpdateException.getSQLState());
+		assertEquals(0, batchUpdateException.getErrorCode());
+		assertEquals(cause, batchUpdateException.getCause());
+	}
+	
+	/**
+	 * @tests {@link java.sql.BatchUpdateException#BatchUpdateException(int[], Throwable)}
+	 * 
+	 * @since 1.6
+	 */
+	public void testBatchUpdateException$ILThrowable() {
+		Throwable cause = new Exception("MYTHROWABLE");
+		int[] updateCounts = new int[] {1, 2, 3};
+		BatchUpdateException batchUpdateException = new BatchUpdateException(
+				updateCounts, cause);
+		assertNotNull(batchUpdateException);
+		assertEquals("java.lang.Exception: MYTHROWABLE", batchUpdateException
+				.getMessage());
+		int[] result = batchUpdateException.getUpdateCounts();
+		for (int i = 0; i < updateCounts.length; i++) {
+			assertEquals(updateCounts[i], result[i]);
+		}
+		assertEquals(cause, batchUpdateException.getCause());
+	}
+	
+	/**
+	 * @tests {@link java.sql.BatchUpdateException#BatchUpdateException(String, int[], Throwable)}
+	 * 
+	 * @since 1.6
+	 */
+	public void testBatchUpdateExceptionLString$ILThrowable() {
+		Throwable cause = new Exception("MYTHROWABLE");
+		int[] updateCounts = new int[] {1, 2, 3};
+		BatchUpdateException batchUpdateException = new BatchUpdateException(
+				"MYTESTSTRING1", "MYTESTSTRING2", updateCounts, cause);
+		assertNotNull(batchUpdateException);
+		assertEquals("MYTESTSTRING2", batchUpdateException.getSQLState());
+		assertEquals("MYTESTSTRING1", batchUpdateException.getMessage());
+		assertEquals(0, batchUpdateException.getErrorCode());
+		int[] result = batchUpdateException.getUpdateCounts();
+		for (int i = 0; i < updateCounts.length; i++) {
+			assertEquals(updateCounts[i], result[i]);
+		}
+		assertEquals(cause, batchUpdateException.getCause());
+	}
+	
+	/**
+	 * @tests {@link java.sql.BatchUpdateException#BatchUpdateException(String, String, int[],
Throwable)}
+	 * 
+	 * @since 1.6
+	 */
+	public void testBatchUpdateExceptionLStringLStringILThrowable() {
+		int[] updateCounts = new int[] { 1, 2, 3 };
+		BatchUpdateException batchUpdateException = new BatchUpdateException(
+				null, null, updateCounts, null);
+		assertNotNull(batchUpdateException);
+		assertNull(batchUpdateException.getSQLState());
+		assertNull(batchUpdateException.getMessage());
+		assertEquals(0, batchUpdateException.getErrorCode());
+		assertNull(batchUpdateException.getCause());
+	}
+	
+	/**
+	 * @tests {@link java.sql.BatchUpdateException#BatchUpdateException(String, String, int,
int[], Throwable)}
+	 * 
+	 * @since 1.6
+	 */
+	public void testBatchUpdateExceptionLStringLStringI$ILThrowable() {
+		BatchUpdateException batchUpdateException = new BatchUpdateException(
+				"MYTESTSTRING1", "MYTESTSTRING2", 1, null);
+		assertNotNull(batchUpdateException);
+		assertEquals("MYTESTSTRING2", batchUpdateException.getSQLState());
+		assertEquals("MYTESTSTRING1", batchUpdateException.getMessage());
+		assertEquals(batchUpdateException.getErrorCode(), 1);
+		assertNull(batchUpdateException.getCause());
+	}
 
 	/*
 	 * Method test for getUpdateCounts



Mime
View raw message