当前位置: 首页>>代码示例>>Java>>正文


Java SQLException.getNextException方法代码示例

本文整理汇总了Java中java.sql.SQLException.getNextException方法的典型用法代码示例。如果您正苦于以下问题:Java SQLException.getNextException方法的具体用法?Java SQLException.getNextException怎么用?Java SQLException.getNextException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.sql.SQLException的用法示例。


在下文中一共展示了SQLException.getNextException方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLSyntaxErrorException ex = new SQLSyntaxErrorException("Exception 1", t1);
    SQLSyntaxErrorException ex1 = new SQLSyntaxErrorException("Exception 2");
    SQLSyntaxErrorException ex2 = new SQLSyntaxErrorException("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();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:SQLSyntaxErrorExceptionTests.java

示例2: test04

import java.sql.SQLException; //导入方法依赖的package包/类
@Test
public void test04() {
    SQLException ex = new SerialException("Exception 1");
    ex.initCause(t1);
    SerialException ex1 = new SerialException("Exception 2");
    SerialException ex2 = new SerialException("Exception 3");
    ex2.initCause(t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    while (ex != null) {
        assertTrue(msgs[num++].equals(ex.getMessage()));
        Throwable c = ex.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        ex = ex.getNextException();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:SerialExceptionTests.java

示例3: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLNonTransientConnectionException ex =
            new SQLNonTransientConnectionException("Exception 1", t1);
    SQLNonTransientConnectionException ex1 =
            new SQLNonTransientConnectionException("Exception 2");
    SQLNonTransientConnectionException ex2 =
            new SQLNonTransientConnectionException("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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:SQLNonTransientConnectionExceptionTests.java

示例4: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLException ex = new SQLException("Exception 1", t1);
    SQLException ex1 = new SQLException("Exception 2");
    SQLException ex2 = new SQLException("Exception 3", t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    while (ex != null) {
        assertTrue(msgs[num++].equals(ex.getMessage()));
        Throwable c = ex.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        ex = ex.getNextException();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:SQLExceptionTests.java

示例5: test06

import java.sql.SQLException; //导入方法依赖的package包/类
@Test
public void test06() {
    SQLException ex = new SyncProviderException("Exception 1");
    ex.initCause(t1);
    SyncProviderException ex1 = new SyncProviderException("Exception 2");
    SyncProviderException ex2 = new SyncProviderException("Exception 3");
    ex2.initCause(t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    while (ex != null) {
        assertTrue(msgs[num++].equals(ex.getMessage()));
        Throwable c = ex.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        ex = ex.getNextException();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:SyncProviderExceptionTests.java

示例6: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLDataException ex = new SQLDataException("Exception 1", t1);
    SQLDataException ex1 = new SQLDataException("Exception 2");
    SQLDataException ex2 = new SQLDataException("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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:SQLDataExceptionTests.java

示例7: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Validate that the ordering of the returned Exceptions is correct using
 * traditional while loop
 */
@Test
public void test12() {
    SQLInvalidAuthorizationSpecException ex
            = new SQLInvalidAuthorizationSpecException("Exception 1", t1);
    SQLInvalidAuthorizationSpecException ex1
            = new SQLInvalidAuthorizationSpecException("Exception 2");
    SQLInvalidAuthorizationSpecException ex2
            = new SQLInvalidAuthorizationSpecException("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();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:SQLInvalidAuthorizationSpecExceptionTests.java

示例8: addNestedSqlTrace

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Adds single SQLException details and returns reference to the nested one
 * @param sqle
 * @param sb
 * @return
 */
private static SQLException addNestedSqlTrace(
                                               SQLException sqle,
                                               StringBuilder sb ) {

    sb.append("SQL Exception:");
    sb.append("\n\tMessage: ").append(sqle.getMessage());
    sb.append("\n\tSQL state: ").append(sqle.getSQLState());
    sb.append("\n\tVendor code: ").append(sqle.getErrorCode());
    StringWriter stringWriter = new StringWriter();
    sqle.printStackTrace(new PrintWriter(stringWriter));
    sb.append(stringWriter.toString());
    sb.append("\n----------------------------------------\n");

    return sqle.getNextException();
}
 
开发者ID:Axway,项目名称:ats-framework,代码行数:22,代码来源:DbUtils.java

示例9: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLTransientConnectionException ex =
            new SQLTransientConnectionException("Exception 1", t1);
    SQLTransientConnectionException ex1 =
            new SQLTransientConnectionException("Exception 2");
    SQLTransientConnectionException ex2 =
            new SQLTransientConnectionException("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();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:SQLTransientConnectionExceptionTests.java

示例10: test04

import java.sql.SQLException; //导入方法依赖的package包/类
@Test
public void test04() {
    SQLException ex = new SyncFactoryException("Exception 1");
    ex.initCause(t1);
    SyncFactoryException ex1 = new SyncFactoryException("Exception 2");
    SyncFactoryException ex2 = new SyncFactoryException("Exception 3");
    ex2.initCause(t2);
    ex.setNextException(ex1);
    ex.setNextException(ex2);
    int num = 0;
    while (ex != null) {
        assertTrue(msgs[num++].equals(ex.getMessage()));
        Throwable c = ex.getCause();
        while (c != null) {
            assertTrue(msgs[num++].equals(c.getMessage()));
            c = c.getCause();
        }
        ex = ex.getNextException();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:21,代码来源:SyncFactoryExceptionTests.java

示例11: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * 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();
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:SQLWarningTests.java

示例12: test12

import java.sql.SQLException; //导入方法依赖的package包/类
/**
 * Validate that the ordering of the returned Exceptions is correct
 * using traditional while loop
 */
@Test
public void test12() {
    SQLIntegrityConstraintViolationException ex =
            new SQLIntegrityConstraintViolationException("Exception 1", t1);
    SQLIntegrityConstraintViolationException ex1 =
            new SQLIntegrityConstraintViolationException("Exception 2");
    SQLIntegrityConstraintViolationException ex2 =
            new SQLIntegrityConstraintViolationException("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();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:SQLIntegrityConstraintViolationExceptionTests.java

示例13: toStackTraces

import java.sql.SQLException; //导入方法依赖的package包/类
static List<String> toStackTraces(Exception e) {
  List<String> stackTraces = new ArrayList<>();
  stackTraces.add(toString(e));
  if (e instanceof SQLException) {
    SQLException next = ((SQLException) e).getNextException();
    while (null != next) {
      stackTraces.add(toString(next));
      next = next.getNextException();
    }
  }
  return stackTraces;
}
 
开发者ID:apache,项目名称:calcite-avatica,代码行数:13,代码来源:Service.java

示例14: logAll

import java.sql.SQLException; //导入方法依赖的package包/类
public static void logAll(Logger log, String message, SQLException e) {
  log.error(message == null ? "Top level exception: " : message, e);
  e = e.getNextException();
  int indx = 1;
  while (e != null) {
    log.error("Chained exception " + indx + ": ", e);
    e = e.getNextException();
    indx++;
  }
}
 
开发者ID:BriData,项目名称:DBus,代码行数:11,代码来源:LoggingUtils.java

示例15: printStackTrace

import java.sql.SQLException; //导入方法依赖的package包/类
private SQLException printStackTrace( SQLException sqle ) {

        log.error("SQL Exception:\nMessage: " + sqle.getMessage() + "\nSQL state: "
                  + sqle.getSQLState() + "\nVendor code: " + sqle.getErrorCode());
        sqle.printStackTrace();
        log.error("------------------------------------------------");

        return sqle.getNextException();
    }
 
开发者ID:Axway,项目名称:ats-framework,代码行数:10,代码来源:DatabaseAccessException.java


注:本文中的java.sql.SQLException.getNextException方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。