Java 类java.sql.SQLRecoverableException 实例源码

项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
    SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
    SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:openjdk-jdk10    文件:SQLRecoverableExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
    SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
    SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:openjdk9    文件:SQLRecoverableExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
    SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
    SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:jdk8u_jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
    SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
    SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLRecoverableException ex = new SQLRecoverableException("Exception 1", t1);
    SQLRecoverableException ex1 = new SQLRecoverableException("Exception 2");
    SQLRecoverableException ex2 = new SQLRecoverableException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    SQLException sqe = ex;
    while (sqe != null) {
        assertTrue(msgs[num++].equals(sqe.getMessage()));
        Throwable c = sqe.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        sqe = sqe.getNextException();
    }
}
项目:cassandra-jdbc-wrapper    文件:PooledCassandraConnection.java   
void statementErrorOccurred(CassandraPreparedStatement preparedStatement, SQLException sqlException)
{
    StatementEvent event = new StatementEvent(this, preparedStatement, sqlException);
    for (StatementEventListener listener : statementEventListeners)
    {
        listener.statementErrorOccurred(event);
    }

    String cql = preparedStatement.getCql();
    Set<CassandraPreparedStatement> usedStatements = usedPreparedStatements.get(cql);

    if (!(event.getSQLException() instanceof SQLRecoverableException))
    {
        preparedStatement.close();
        usedStatements.remove(preparedStatement);
    }
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(Throwable)
 */
public void test_Constructor_LThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The reason of SQLRecoverableException should be equals to cause.toString()",
            "java.lang.Exception: MYTHROWABLE", sQLRecoverableException
                    .getMessage());
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, Throwable)
 */
public void test_Constructor_LStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING", cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getMessage());
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, Throwable)
 */
public void test_Constructor_LStringLStringLThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_1() {
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", null);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertNull("The cause of SQLRecoverableException should be null",
            sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING", null, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_4() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, "MYTESTSTRING", cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_6() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, null, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", 1, cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 1",
            sQLRecoverableException.getErrorCode(), 1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_1() {
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", 1, null);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 1",
            sQLRecoverableException.getErrorCode(), 1);
    assertNull("The cause of SQLRecoverableException should be null",
            sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", 0, cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_3() {
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", 0, null);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertNull("The cause of SQLRecoverableException should be null",
            sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_4() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", -1, cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be -1",
            sQLRecoverableException.getErrorCode(), -1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_5() {
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING1", "MYTESTSTRING2", -1, null);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING2", sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING1", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be -1",
            sQLRecoverableException.getErrorCode(), -1);
    assertNull("The cause of SQLRecoverableException should be null",
            sQLRecoverableException.getCause());

}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_6() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING", null, 1, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 1",
            sQLRecoverableException.getErrorCode(), 1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_7() {
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING", null, 1, null);
    assertNotNull(sQLRecoverableException);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 1",
            sQLRecoverableException.getErrorCode(), 1);
    assertNull("The cause of SQLRecoverableException should be null",
            sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_8() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING", null, 0, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_10() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            "MYTESTSTRING", null, -1, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertEquals(
            "The reason of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be -1",
            sQLRecoverableException.getErrorCode(), -1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_12() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, "MYTESTSTRING", 1, cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 1",
            sQLRecoverableException.getErrorCode(), 1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_14() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, "MYTESTSTRING", 0, cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_15() {
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, "MYTESTSTRING", 0, null);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertNull("The cause of SQLRecoverableException should be null",
            sQLRecoverableException.getCause());

}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_16() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, "MYTESTSTRING", -1, cause);
    assertNotNull(sQLRecoverableException);
    assertEquals(
            "The SQLState of SQLRecoverableException set and get should be equivalent",
            "MYTESTSTRING", sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be -1",
            sQLRecoverableException.getErrorCode(), -1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_18() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, null, 1, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 1",
            sQLRecoverableException.getErrorCode(), 1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_20() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, null, 0, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be 0",
            sQLRecoverableException.getErrorCode(), 0);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:cn1    文件:SQLRecoverableExceptionTest.java   
/**
 * @test java.sql.SQLRecoverableException(String, String, int, Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_22() {
    Throwable cause = new Exception("MYTHROWABLE");
    SQLRecoverableException sQLRecoverableException = new SQLRecoverableException(
            null, null, -1, cause);
    assertNotNull(sQLRecoverableException);
    assertNull("The SQLState of SQLRecoverableException should be null",
            sQLRecoverableException.getSQLState());
    assertNull("The reason of SQLRecoverableException should be null",
            sQLRecoverableException.getMessage());
    assertEquals("The error code of SQLRecoverableException should be -1",
            sQLRecoverableException.getErrorCode(), -1);
    assertEquals(
            "The cause of SQLRecoverableException set and get should be equivalent",
            cause, sQLRecoverableException.getCause());
}
项目:java-retry    文件:SqlTransientExceptionDetector.java   
@Override
public boolean isTransient(Exception e) {
    if (e instanceof SQLTransientException || e instanceof SQLRecoverableException) {
        return true;
    }
    if (e instanceof SQLNonTransientException) {
        return false;
    }
    if (e instanceof SQLException) {
        SQLException se = (SQLException) e;
        if (isSqlStateConnectionException(se) || isSqlStateRollbackException(se)) {
            return true;
        }
        if (isSqlStateDuplicateValueInUniqueIndex(se) && treatDuplicatesAsTransient) {
            return true;
        }
    }
    return false;
}
项目:as2-jdbc    文件:ASSQLProcessor.java   
private static ASSQLStatement getStatement (String queryString) throws SQLException
{
    CharStream charstream = new ANTLRStringStream(queryString);
    ASSQLLexer lexer = new ASSQLLexer(charstream);
    CommonTokenStream tokens = new CommonTokenStream(lexer);
    ASSQLParser parser = new ASSQLParser(tokens);

    ASSQLStatement statement = null;
    try
    {
        statement = parser.query();
    }
    catch (RecognitionException ex)
    {
        throw new SQLRecoverableException(ex);
    }

    // The lexer and parser queue up any errors they may have encountered
    // along the way, if necessary, we turn them into exceptions here.
    lexer.throwFirstRecognitionError();
    parser.throwFirstRecognitionError();

    return statement;
}
项目:lams    文件:SQLExceptionSubclassTranslator.java   
@Override
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
    if (ex instanceof SQLTransientException) {
        if (ex instanceof SQLTransientConnectionException) {
            return new TransientDataAccessResourceException(buildMessage(task, sql, ex), ex);
        }
        else if (ex instanceof SQLTransactionRollbackException) {
            return new ConcurrencyFailureException(buildMessage(task, sql, ex), ex);
        }
        else if (ex instanceof SQLTimeoutException) {
            return new QueryTimeoutException(buildMessage(task, sql, ex), ex);
        }
    }
    else if (ex instanceof SQLNonTransientException) {
        if (ex instanceof SQLNonTransientConnectionException) {
            return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex);
        }
        else if (ex instanceof SQLDataException) {
            return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
        }
        else if (ex instanceof SQLIntegrityConstraintViolationException) {
            return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
        }
        else if (ex instanceof SQLInvalidAuthorizationSpecException) {
            return new PermissionDeniedDataAccessException(buildMessage(task, sql, ex), ex);
        }
        else if (ex instanceof SQLSyntaxErrorException) {
            return new BadSqlGrammarException(task, sql, ex);
        }
        else if (ex instanceof SQLFeatureNotSupportedException) {
            return new InvalidDataAccessApiUsageException(buildMessage(task, sql, ex), ex);
        }
    }
    else if (ex instanceof SQLRecoverableException) {
        return new RecoverableDataAccessException(buildMessage(task, sql, ex), ex);
    }

    // Fallback to Spring's own SQL state translation...
    return null;
}
项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Create SQLRecoverableException and setting all objects to null
 */
@Test
public void test() {
    SQLRecoverableException e = new SQLRecoverableException(null,
           null, errorCode, null);
    assertTrue(e.getMessage() == null && e.getSQLState() == null
            && e.getCause() == null && e.getErrorCode() == errorCode);
}
项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Create SQLRecoverableException with no-arg constructor
 */
@Test
public void test1() {
    SQLRecoverableException ex = new SQLRecoverableException();
    assertTrue(ex.getMessage() == null
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0);
}
项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Create SQLRecoverableException with message
 */
@Test
public void test2() {
    SQLRecoverableException ex = new SQLRecoverableException(reason);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState() == null
            && ex.getCause() == null
            && ex.getErrorCode() == 0);
}
项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Create SQLRecoverableException with message, and SQLState
 */
@Test
public void test3() {
    SQLRecoverableException ex = new SQLRecoverableException(reason, state);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState().equals(state)
            && ex.getCause() == null
            && ex.getErrorCode() == 0);
}
项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Create SQLRecoverableException with message, SQLState, and error code
 */
@Test
public void test4() {
    SQLRecoverableException ex =
            new SQLRecoverableException(reason, state, errorCode);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState().equals(state)
            && ex.getCause() == null
            && ex.getErrorCode() == errorCode);
}
项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Create SQLRecoverableException with message, SQLState, errorCode, and Throwable
 */
@Test
public void test5() {
    SQLRecoverableException ex =
            new SQLRecoverableException(reason, state, errorCode, t);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState().equals(state)
            && cause.equals(ex.getCause().toString())
            && ex.getErrorCode() == errorCode);
}
项目:jdk8u-jdk    文件:SQLRecoverableExceptionTests.java   
/**
 * Create SQLRecoverableException with message, SQLState, and Throwable
 */
@Test
public void test6() {
    SQLRecoverableException ex = new SQLRecoverableException(reason, state, t);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState().equals(state)
            && cause.equals(ex.getCause().toString())
            && ex.getErrorCode() == 0);
}