You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2007/06/21 07:28:59 UTC
svn commit: r549379 [1/4] - in
/harmony/enhanced/classlib/branches/java6/modules/sql: META-INF/
src/main/java/java/sql/ src/test/java/org/apache/harmony/sql/tests/java/sql/
src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/
Author: tonywu
Date: Wed Jun 20 22:28:57 2007
New Revision: 549379
URL: http://svn.apache.org/viewvc?view=rev&rev=549379
Log:
Apply patch HARMONY-4255 ([classlib][sql][java6] 4 new exception classes in the java.sql package)
Added:
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLClientInfoException.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLNonTransientException.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLRecoverableException.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLTransientException.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLClientInfoExceptionTest.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLNonTransientExceptionTest.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLRecoverableExceptionTest.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLTransientExceptionTest.java (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/SQLClientInfoExceptionTest.golden.ser (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/SQLNonTransientExceptionTest.golden.ser (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/SQLRecoverableExceptionTest.golden.ser (with props)
harmony/enhanced/classlib/branches/java6/modules/sql/src/test/resources/serialization/org/apache/harmony/sql/tests/java/sql/SQLTransientExceptionTest.golden.ser (with props)
Modified:
harmony/enhanced/classlib/branches/java6/modules/sql/META-INF/MANIFEST.MF
Modified: harmony/enhanced/classlib/branches/java6/modules/sql/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/META-INF/MANIFEST.MF?view=diff&rev=549379&r1=549378&r2=549379
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/META-INF/MANIFEST.MF Wed Jun 20 22:28:57 2007
@@ -25,6 +25,7 @@
java.util.logging,
java.util.zip;resolution:=optional,
javax.naming,
+ javax.xml.transform,
org.apache.harmony.kernel.vm,
org.apache.harmony.luni.util,
org.apache.harmony.testframework.serialization;hy_usage=test;resolution:=optional
Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLClientInfoException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLClientInfoException.java?view=auto&rev=549379
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLClientInfoException.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLClientInfoException.java Wed Jun 20 22:28:57 2007
@@ -0,0 +1,211 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+import java.util.Map;
+
+/**
+ * An exception, which is subclass of SQLException, is thrown when one or more
+ * client info properties could not be set on a Connection.
+ */
+public class SQLClientInfoException extends SQLException {
+ private static final long serialVersionUID = -4319604256824655880L;
+
+ private Map<String, ClientInfoStatus> failedProperties = null;
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to
+ * null, the SQLState string is set to null and the Error Code is set to 0.
+ */
+ public SQLClientInfoException() {
+ super();
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to the
+ * given reason string, the SQLState string is set to null and the Error
+ * Code is set to 0, and the Map<String,ClientInfoStatus> object is set to
+ * the failed properties.
+ *
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ */
+ public SQLClientInfoException(Map<String, ClientInfoStatus> failedProperties) {
+ super();
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to the
+ * null if cause == null or cause.toString() if cause!=null, the cause
+ * Throwable object is set to the given cause Throwable object, and the Map<String,ClientInfoStatus>
+ * object is set to the failed properties.
+ *
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLClientInfoException(
+ Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
+ super(cause);
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to
+ * reason, and the Map<String,ClientInfoStatus> object is set to the failed
+ * properties.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ */
+ public SQLClientInfoException(String reason,
+ Map<String, ClientInfoStatus> failedProperties) {
+ super(reason);
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to
+ * reason, the cause Throwable object is set to the given cause Throwable
+ * object, and the Map<String,ClientInfoStatus> object is set to the failed
+ * properties.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLClientInfoException(String reason,
+ Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
+ super(reason, cause);
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to
+ * reason, the SQLState string is set to the sqlState, the Error Code is set
+ * to the vendorCode and the Map<String,ClientInfoStatus> object is set to
+ * the failed properties.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ *
+ */
+ public SQLClientInfoException(String reason, String sqlState,
+ int vendorCode, Map<String, ClientInfoStatus> failedProperties) {
+ super(reason, sqlState, vendorCode);
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to
+ * reason, the SQLState string is set to the sqlState, the Error Code is set
+ * to the vendorCode the cause Throwable object is set to the given cause
+ * Throwable object, and the Map<String,ClientInfoStatus> object is set to
+ * the failed properties.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLClientInfoException(String reason, String SQLState,
+ int vendorCode, Map<String, ClientInfoStatus> failedProperties,
+ Throwable cause) {
+ super(reason, SQLState, vendorCode, cause);
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to
+ * reason, the SQLState string is set to the sqlState, and the Map<String,ClientInfoStatus>
+ * object is set to the failed properties.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ */
+ public SQLClientInfoException(String reason, String SQLState,
+ Map<String, ClientInfoStatus> failedProperties) {
+ super(reason, SQLState);
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * Creates an SQLClientInfoException object. The Reason string is set to
+ * reason, the SQLState string is set to the sqlState, the Error Code is set
+ * to the vendorCode, and the Map<String,ClientInfoStatus> object is set to
+ * the failed properties.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ * @param failedProperties
+ * the Map<String,ClientInfoStatus> object to use as the
+ * property values
+ */
+ public SQLClientInfoException(String reason, String SQLState,
+ Map<String, ClientInfoStatus> failedProperties, Throwable cause) {
+ super(reason, SQLState, cause);
+ this.failedProperties = failedProperties;
+ }
+
+ /**
+ * returns that the client info properties which could not be set
+ *
+ * @return the list of ClientInfoStatus objects indicate client info
+ * properties
+ */
+ public Map<String, ClientInfoStatus> getFailedProperties() {
+ return failedProperties;
+ }
+}
Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLClientInfoException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLNonTransientException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLNonTransientException.java?view=auto&rev=549379
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLNonTransientException.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLNonTransientException.java Wed Jun 20 22:28:57 2007
@@ -0,0 +1,142 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+public class SQLNonTransientException extends SQLException {
+
+ private static final long serialVersionUID = -9104382843534716547L;
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * null, the SQLState string is set to null and the Error Code is set to 0.
+ */
+ public SQLNonTransientException() {
+ super();
+ }
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to null and the Error
+ * Code is set to 0.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ */
+ public SQLNonTransientException(String reason) {
+ super(reason, null, 0);
+ }
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string and the Error Code is set to 0.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ */
+ public SQLNonTransientException(String reason, String sqlState) {
+ super(reason, sqlState, 0);
+ }
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string and the Error Code is set to the given error code value.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ */
+ public SQLNonTransientException(String reason, String sqlState,
+ int vendorCode) {
+ super(reason, sqlState, vendorCode);
+ }
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * the null if cause == null or cause.toString() if cause!=null,and the
+ * cause Throwable object is set to the given cause Throwable object.
+ *
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLNonTransientException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * the given and the cause Throwable object is set to the given cause
+ * Throwable object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLNonTransientException(String reason, Throwable cause) {
+ super(reason, cause);
+ }
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string and the cause Throwable object is set to the given cause Throwable
+ * object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLNonTransientException(String reason, String sqlState,
+ Throwable cause) {
+ super(reason, sqlState, cause);
+ }
+
+ /**
+ * Creates an SQLNonTransientException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string , the Error Code is set to the given error code value, and the
+ * cause Throwable object is set to the given cause Throwable object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLNonTransientException(String reason, String sqlState,
+ int vendorCode, Throwable cause) {
+ super(reason, sqlState, vendorCode, cause);
+ }
+}
Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLNonTransientException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLRecoverableException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLRecoverableException.java?view=auto&rev=549379
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLRecoverableException.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLRecoverableException.java Wed Jun 20 22:28:57 2007
@@ -0,0 +1,142 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+public class SQLRecoverableException extends SQLException {
+
+ private static final long serialVersionUID = -4144386502923131579L;
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * null, the SQLState string is set to null and the Error Code is set to 0.
+ */
+ public SQLRecoverableException() {
+ super();
+ }
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to null and the Error
+ * Code is set to 0.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ */
+ public SQLRecoverableException(String reason) {
+ super(reason, null, 0);
+ }
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string and the Error Code is set to 0.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ */
+ public SQLRecoverableException(String reason, String sqlState) {
+ super(reason, sqlState, 0);
+ }
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string and the Error Code is set to the given error code value.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ */
+ public SQLRecoverableException(String reason, String sqlState,
+ int vendorCode) {
+ super(reason, sqlState, vendorCode);
+ }
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * the null if cause == null or cause.toString() if cause!=null,and the
+ * cause Throwable object is set to the given cause Throwable object.
+ *
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLRecoverableException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * the given and the cause Throwable object is set to the given cause
+ * Throwable object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLRecoverableException(String reason, Throwable cause) {
+ super(reason, cause);
+ }
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string and the cause Throwable object is set to the given cause Throwable
+ * object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLRecoverableException(String reason, String sqlState,
+ Throwable cause) {
+ super(reason, sqlState, cause);
+ }
+
+ /**
+ * Creates an SQLRecoverableException object. The Reason string is set to
+ * the given reason string, the SQLState string is set to the given SQLState
+ * string , the Error Code is set to the given error code value, and the
+ * cause Throwable object is set to the given cause Throwable object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLRecoverableException(String reason, String sqlState,
+ int vendorCode, Throwable cause) {
+ super(reason, sqlState, vendorCode, cause);
+ }
+}
Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLRecoverableException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLTransientException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLTransientException.java?view=auto&rev=549379
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLTransientException.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLTransientException.java Wed Jun 20 22:28:57 2007
@@ -0,0 +1,140 @@
+/*
+ * 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
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package java.sql;
+
+public class SQLTransientException extends SQLException {
+
+ private static final long serialVersionUID = -9042733978262274539L;
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to
+ * null, the SQLState string is set to null and the Error Code is set to 0.
+ */
+ public SQLTransientException() {
+ super();
+ }
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to the
+ * given reason string, the SQLState string is set to null and the Error
+ * Code is set to 0.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ */
+ public SQLTransientException(String reason) {
+ super(reason, null, 0);
+ }
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to the
+ * given reason string, the SQLState string is set to the given SQLState
+ * string and the Error Code is set to 0.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ */
+ public SQLTransientException(String reason, String sqlState) {
+ super(reason, sqlState, 0);
+ }
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to the
+ * given reason string, the SQLState string is set to the given SQLState
+ * string and the Error Code is set to the given error code value.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ */
+ public SQLTransientException(String reason, String sqlState, int vendorCode) {
+ super(reason, sqlState, vendorCode);
+ }
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to the
+ * null if cause == null or cause.toString() if cause!=null,and the cause
+ * Throwable object is set to the given cause Throwable object.
+ *
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLTransientException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to the
+ * given and the cause Throwable object is set to the given cause Throwable
+ * object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLTransientException(String reason, Throwable cause) {
+ super(reason, cause);
+ }
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to the
+ * given reason string, the SQLState string is set to the given SQLState
+ * string and the cause Throwable object is set to the given cause Throwable
+ * object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLTransientException(String reason, String sqlState, Throwable cause) {
+ super(reason, sqlState, cause);
+ }
+
+ /**
+ * Creates an SQLTransientException object. The Reason string is set to the
+ * given reason string, the SQLState string is set to the given SQLState
+ * string , the Error Code is set to the given error code value, and the
+ * cause Throwable object is set to the given cause Throwable object.
+ *
+ * @param reason
+ * the string to use as the Reason string
+ * @param sqlState
+ * the string to use as the SQLState string
+ * @param vendorCode
+ * the integer value for the error code
+ * @param cause
+ * the Throwable object for the underlying reason this
+ * SQLException
+ */
+ public SQLTransientException(String reason, String sqlState,
+ int vendorCode, Throwable cause) {
+ super(reason, sqlState, vendorCode, cause);
+ }
+}
Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/main/java/java/sql/SQLTransientException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLClientInfoExceptionTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLClientInfoExceptionTest.java?view=auto&rev=549379
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLClientInfoExceptionTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLClientInfoExceptionTest.java Wed Jun 20 22:28:57 2007
@@ -0,0 +1,265 @@
+package org.apache.harmony.sql.tests.java.sql;
+
+import java.io.Serializable;
+import java.sql.ClientInfoStatus;
+import java.sql.SQLClientInfoException;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.harmony.testframework.serialization.SerializationTest;
+import org.apache.harmony.testframework.serialization.SerializationTest.SerializableAssert;
+
+public class SQLClientInfoExceptionTest extends TestCase {
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException()
+ */
+ public void test_Constructor() {
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException();
+ assertNull("The SQLState of SQLClientInfoException should be null",
+ sqlClientInfoException.getSQLState());
+ assertNull("The reason of SQLClientInfoException should be null",
+ sqlClientInfoException.getMessage());
+ assertNull(
+ "The FailedProperties of SQLClientInfoException should be null",
+ sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+ }
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException(Map<String,ClientInfoStatus>)
+ */
+ public void test_Constructor_LMap() {
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ failedProperties);
+ assertNull("The SQLState of SQLClientInfoException should be null",
+ sqlClientInfoException.getSQLState());
+ assertNull("The reason of SQLClientInfoException should be null",
+ sqlClientInfoException.getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+ }
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException(Map<String,ClientInfoStatus>,Throwable)
+ */
+ public void test_Constructor_LMapLThrowable() {
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ Throwable cause = new RuntimeException("Message");
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ failedProperties, cause);
+ assertNull("The SQLState of SQLClientInfoException should be null",
+ sqlClientInfoException.getSQLState());
+ assertEquals(
+ "The reason of SQLClientInfoException should be equals to cause.toString()",
+ "java.lang.RuntimeException: Message", sqlClientInfoException
+ .getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+ assertEquals(
+ "The cause of SQLClientInfoException set and get should be equivalent",
+ cause, sqlClientInfoException.getCause());
+
+ sqlClientInfoException = new SQLClientInfoException(failedProperties,
+ null);
+ assertNull("The SQLState of SQLClientInfoException should be null",
+ sqlClientInfoException.getSQLState());
+ assertNull("The reason of SQLClientInfoException should be null",
+ sqlClientInfoException.getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+ }
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,Map<String,ClientInfoStatus>)
+ */
+ public void test_Constructor_LStringLMap() {
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ "Message", failedProperties);
+ assertNull("The SQLState of SQLClientInfoException should be null",
+ sqlClientInfoException.getSQLState());
+ assertEquals(
+ "The reason of SQLClientInfoException set and get should be equivalent",
+ "Message", sqlClientInfoException.getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+
+ }
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,Map<String,ClientInfoStatus>,Throwable)
+ */
+ public void test_Constructor_LStringLMapLThrowable() {
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ Throwable cause = new RuntimeException("Message");
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ "Message", failedProperties, cause);
+ assertNull("The SQLState of SQLClientInfoException should be null",
+ sqlClientInfoException.getSQLState());
+ assertEquals(
+ "The reason of SQLClientInfoException set and get should be equivalent",
+ "Message", sqlClientInfoException.getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+ assertEquals(
+ "The cause of SQLClientInfoException set and get should be equivalent",
+ cause, sqlClientInfoException.getCause());
+
+ }
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,String,Map<String,ClientInfoStatus>)
+ */
+ public void test_Constructor_LStringLStringLMap() {
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ "Message", "State", failedProperties);
+ assertEquals(
+ "The SQLState of SQLClientInfoException set and get should be equivalent",
+ "State", sqlClientInfoException.getSQLState());
+ assertEquals(
+ "The reason of SQLClientInfoException set and get should be equivalent",
+ "Message", sqlClientInfoException.getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+ }
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,String,Map<String,ClientInfoStatus>,Throwable)
+ */
+ public void test_Constructor_LStringLStringLMapLThrowable() {
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ Throwable cause = new RuntimeException("Message");
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ "Message", "State", failedProperties, cause);
+ assertEquals(
+ "The SQLState of SQLClientInfoException set and get should be equivalent",
+ "State", sqlClientInfoException.getSQLState());
+ assertEquals(
+ "The reason of SQLClientInfoException set and get should be equivalent",
+ "Message", sqlClientInfoException.getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 0",
+ sqlClientInfoException.getErrorCode(), 0);
+ assertEquals(
+ "The cause of SQLClientInfoException set and get should be equivalent",
+ cause, sqlClientInfoException.getCause());
+ }
+
+ /**
+ * @tests java.sql.SQLClientInfoException#SQLClientInfoException(String,String,int,Map<String,ClientInfoStatus>,Throwable)
+ */
+ public void test_Constructor_LStringLStringILMapLThrowable() {
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ Throwable cause = new RuntimeException("Message");
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ "Message", "State", 1, failedProperties, cause);
+ assertEquals(
+ "The SQLState of SQLClientInfoException set and get should be equivalent",
+ "State", sqlClientInfoException.getSQLState());
+ assertEquals(
+ "The reason of SQLClientInfoException set and get should be equivalent",
+ "Message", sqlClientInfoException.getMessage());
+ assertEquals(
+ "The FailedProperties of SQLClientInfoException set and get should be equivalent",
+ failedProperties, sqlClientInfoException.getFailedProperties());
+ assertEquals("The error code of SQLClientInfoException should be 1",
+ sqlClientInfoException.getErrorCode(), 1);
+ assertEquals(
+ "The cause of SQLClientInfoException set and get should be equivalent",
+ cause, sqlClientInfoException.getCause());
+ }
+
+ // comparator for SQLClientInfoException objects
+ private static final SerializableAssert exComparator = new SerializableAssert() {
+ public void assertDeserialized(Serializable initial,
+ Serializable deserialized) {
+
+ SerializationTest.THROWABLE_COMPARATOR.assertDeserialized(initial,
+ deserialized);
+
+ SQLClientInfoException initEx = (SQLClientInfoException) initial;
+ SQLClientInfoException desrEx = (SQLClientInfoException) deserialized;
+
+ assertEquals("Message", initEx.getMessage(), desrEx.getMessage());
+ assertEquals("Class", initEx.getClass(), desrEx.getClass());
+ assertEquals("Map", initEx.getFailedProperties(), desrEx
+ .getFailedProperties());
+ }
+ };
+
+ /**
+ * @tests serialization/deserialization.
+ */
+ public void testSerializationSelf() throws Exception {
+
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ Throwable cause = new RuntimeException("Message");
+ SQLClientInfoException sqlClientInfoException = new SQLClientInfoException(
+ "Message", "State", 1, failedProperties, cause);
+ SerializationTest.verifySelf(sqlClientInfoException, exComparator);
+ }
+
+ /**
+ * @tests serialization/deserialization compatibility with RI.
+ */
+ public void testSerializationCompatibility() throws Exception {
+
+ Map<String, ClientInfoStatus> failedProperties = new HashMap<String, ClientInfoStatus>();
+ failedProperties.put("String1", ClientInfoStatus.REASON_VALUE_INVALID);
+ failedProperties
+ .put("String2", ClientInfoStatus.REASON_VALUE_TRUNCATED);
+ Throwable cause = new RuntimeException("Message");
+ SerializationTest.verifyGolden(this, new SQLClientInfoException(
+ "Message", "State", 1, failedProperties, cause), exComparator);
+ }
+}
Propchange: harmony/enhanced/classlib/branches/java6/modules/sql/src/test/java/org/apache/harmony/sql/tests/java/sql/SQLClientInfoExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native