微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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",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",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",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",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",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",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",Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_1() {
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING1",null);
    assertNotNull(sqlRecoverableException);
    assertEquals(
            "The sqlState of sqlRecoverableException set and get should be equivalent",0);
    assertNull("The cause of sqlRecoverableException should be null",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",Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_4() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,sqlRecoverableException.getsqlState());
    assertNull("The reason of sqlRecoverableException should be null",Throwable)
 */
public void test_Constructor_LStringLStringLThrowable_6() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,int,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING1",1,sqlRecoverableException.getMessage());
    assertEquals("The error code of sqlRecoverableException should be 1",1);
    assertEquals(
            "The cause of sqlRecoverableException set and get should be equivalent",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_1() {
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING1",1);
    assertNull("The cause of sqlRecoverableException should be null",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_2() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING1",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_3() {
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING1",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_4() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING1",-1,sqlRecoverableException.getMessage());
    assertEquals("The error code of sqlRecoverableException should be -1",-1);
    assertEquals(
            "The cause of sqlRecoverableException set and get should be equivalent",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_5() {
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING1",-1);
    assertNull("The cause of sqlRecoverableException should be null",sqlRecoverableException.getCause());

}
项目:cn1    文件sqlRecoverableExceptionTest.java   
/**
 * @test java.sql.sqlRecoverableException(String,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_6() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_7() {
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING",null);
    assertNotNull(sqlRecoverableException);
    assertNotNull(sqlRecoverableException);
    assertNull("The sqlState of sqlRecoverableException should be null",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_8() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_10() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            "MYTESTSTRING",Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_12() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_14() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_15() {
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_16() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_18() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_20() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,Throwable)
 */
public void test_Constructor_LStringLStringILThrowable_22() {
    Throwable cause = new Exception("MYTHROWABLE");
    sqlRecoverableException sqlRecoverableException = new sqlRecoverableException(
            null,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,ex);
        }
        else if (ex instanceof sqlTimeoutException) {
            return new QueryTimeoutException(buildMessage(task,ex);
        }
    }
    else if (ex instanceof sqlNonTransientException) {
        if (ex instanceof sqlNonTransientConnectionException) {
            return new DataAccessResourceFailureException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlDataException) {
            return new DataIntegrityViolationException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlIntegrityConstraintViolationException) {
            return new DataIntegrityViolationException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlInvalidAuthorizationSpecException) {
            return new PermissionDeniedDataAccessException(buildMessage(task,ex);
        }
        else if (ex instanceof sqlSyntaxErrorException) {
            return new BadsqlGrammarException(task,ex);
        }
        else if (ex instanceof sqlFeatureNotSupportedException) {
            return new InvalidDataAccessApiUsageException(buildMessage(task,ex);
        }
    }
    else if (ex instanceof sqlRecoverableException) {
        return new RecoverableDataAccessException(buildMessage(task,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,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,and Throwable
 */
@Test
public void test5() {
    sqlRecoverableException ex =
            new sqlRecoverableException(reason,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,and Throwable
 */
@Test
public void test6() {
    sqlRecoverableException ex = new sqlRecoverableException(reason,t);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getsqlState().equals(state)
            && cause.equals(ex.getCause().toString())
            && ex.getErrorCode() == 0);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。