java.sql.SQLWarning#setNextException ( )源码实例Demo

下面列出了java.sql.SQLWarning#setNextException ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码2 项目: TencentKona-8   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码3 项目: jdk8u60   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码4 项目: openjdk-jdk8u-backup   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码5 项目: openjdk-jdk9   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码6 项目: jdk8u-jdk   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码7 项目: hottub   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码8 项目: jdk8u_jdk   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("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();
    }
}
 
源代码9 项目: dragonwell8_jdk   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码10 项目: TencentKona-8   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码11 项目: jdk8u60   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码12 项目: openjdk-jdk8u   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码13 项目: spliceengine   文件: SqlWarning.java
/**
 * Get the java.sql.SQLWarning for this SqlWarning
 */
public SQLWarning getSQLWarning()
{
    if (wrappedException_ != null) {
        return (SQLWarning) wrappedException_;
    }

    SQLWarning sqlw = new SQLWarning(getMessage(), getSQLState(), 
        getErrorCode());

    sqlw.initCause(this);

    // Set up the nextException chain
    if ( nextWarning_ != null )
    {
        // The exception chain gets constructed automatically through 
        // the beautiful power of recursion
        //
        // We have to use the right method to convert the next exception
        // depending upon its type.  Luckily with all the other subclasses
        // of SQLException we don't have to make our own matching 
        // subclasses because 
        sqlw.setNextException(
            nextException_ instanceof SqlWarning ?
                ((SqlWarning)nextException_).getSQLWarning() :
                nextException_.getSQLException());
    }
    
    return sqlw;
    
}
 
源代码14 项目: openjdk-jdk8u-backup   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码15 项目: openjdk-jdk9   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码16 项目: jdk8u-jdk   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码17 项目: hottub   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码18 项目: jdk8u_jdk   文件: SQLWarningTests.java
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * for-each loop
 */
@Test
public void test11() {
    SQLWarning ex = new SQLWarning("Exception 1", t1);
    SQLWarning ex1 = new SQLWarning("Exception 2");
    SQLWarning ex2 = new SQLWarning("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    for (Throwable e : ex) {
        assertTrue(msgs[num++].equals(e.getMessage()));
    }
}
 
源代码19 项目: gemfirexd-oss   文件: SqlWarning.java
/**
     * Get the java.sql.SQLWarning for this SqlWarning
     */
// GemStone changes BEGIN
    public SQLWarning getSQLWarning(final Agent agent) {
        final String message;
        final String sqlState = getSQLState();
        final int errorCode = getErrorCode();
        // fetching exception should not change inUnitOfWork (#44311)
        Connection conn = null;
        boolean savedInUnitOfWork = false;
        if (agent != null) {
          if ((conn = agent.connection_) != null) {
            savedInUnitOfWork = conn.inUnitOfWork_;
          }
          message = getMessage() + " (SQLState=" + sqlState + ",Severity="
              + errorCode + ",Server=" + agent.getServerLocation() + ')';
        }
        else {
          message = getMessage();
        }
        SQLWarning sqlw = new SQLWarning(message, sqlState,
            errorCode);
    /* (original code)
    public SQLWarning getSQLWarning()
    {
        SQLWarning sqlw = new SQLWarning(getMessage(), getSQLState(), 
            getErrorCode());
    */
// GemStone changes END

        sqlw.initCause(this);

        // Set up the nextException chain
        if ( nextWarning_ != null )
        {
            // The exception chain gets constructed automatically through 
            // the beautiful power of recursion
            //
            // We have to use the right method to convert the next exception
            // depending upon its type.  Luckily with all the other subclasses
            // of SQLException we don't have to make our own matching 
            // subclasses because 
            sqlw.setNextException(
                nextException_ instanceof SqlWarning ?
                    ((SqlWarning)nextException_).getSQLWarning(null /* GemStoneAddition */) :
                    nextException_.getSQLException(null /* GemStoneAddition */));
        }
// GemStone changes BEGIN
        // restore inUnitOfWork
        if (conn != null) {
          conn.setInUnitOfWork(savedInUnitOfWork);
        }
// GemStone changes END
        
        return sqlw;
        
    }
 
源代码20 项目: gemfirexd-oss   文件: SqlWarning.java
/**
     * Get the java.sql.SQLWarning for this SqlWarning
     */
// GemStone changes BEGIN
    public SQLWarning getSQLWarning(final Agent agent) {
        final String message;
        final String sqlState = getSQLState();
        final int errorCode = getErrorCode();
        // fetching exception should not change inUnitOfWork (#44311)
        Connection conn = null;
        boolean savedInUnitOfWork = false;
        if (agent != null) {
          if ((conn = agent.connection_) != null) {
            savedInUnitOfWork = conn.inUnitOfWork_;
          }
          message = getMessage() + " (SQLState=" + sqlState + ",Severity="
              + errorCode + ",Server=" + agent.getServerLocation() + ')';
        }
        else {
          message = getMessage();
        }
        SQLWarning sqlw = new SQLWarning(message, sqlState,
            errorCode);
    /* (original code)
    public SQLWarning getSQLWarning()
    {
        SQLWarning sqlw = new SQLWarning(getMessage(), getSQLState(), 
            getErrorCode());
    */
// GemStone changes END

        sqlw.initCause(this);

        // Set up the nextException chain
        if ( nextWarning_ != null )
        {
            // The exception chain gets constructed automatically through 
            // the beautiful power of recursion
            //
            // We have to use the right method to convert the next exception
            // depending upon its type.  Luckily with all the other subclasses
            // of SQLException we don't have to make our own matching 
            // subclasses because 
            sqlw.setNextException(
                nextException_ instanceof SqlWarning ?
                    ((SqlWarning)nextException_).getSQLWarning(null /* GemStoneAddition */) :
                    nextException_.getSQLException(null /* GemStoneAddition */));
        }
// GemStone changes BEGIN
        // restore inUnitOfWork
        if (conn != null) {
          conn.setInUnitOfWork(savedInUnitOfWork);
        }
// GemStone changes END
        
        return sqlw;
        
    }