Java Code Examples for java.sql.SQLWarning#getCause()
The following examples show how to use
java.sql.SQLWarning#getCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SQLWarningTests.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 2
Source File: SQLWarningTests.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 3
Source File: SQLWarningTests.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 4
Source File: SQLWarningTests.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 5
Source File: SQLWarningTests.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 6
Source File: SQLWarningTests.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 7
Source File: SQLWarningTests.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 8
Source File: SQLWarningTests.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 9
Source File: SQLWarningTests.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Validate that the ordering of the returned SQLWarning is correct using * traditional while loop */ @Test public void test14() { SQLWarning ex = new SQLWarning("Warning 1", t1); SQLWarning ex1 = new SQLWarning("Warning 2"); SQLWarning ex2 = new SQLWarning("Warning 3", t2); ex.setNextWarning(ex1); ex.setNextWarning(ex2); int num = 0; SQLWarning sqe = ex; while (sqe != null) { assertTrue(warnings[num++].equals(sqe.getMessage())); Throwable c = sqe.getCause(); while (c != null) { assertTrue(msgs[num++].equals(c.getMessage())); c = c.getCause(); } sqe = sqe.getNextWarning(); } }
Example 10
Source File: JdbcUtil.java From iaf with Apache License 2.0 | 6 votes |
public static void warningsToXml(SQLWarning warnings, SaxElementBuilder parent) throws SAXException { if (warnings!=null) { try (SaxElementBuilder elementBuilder = parent.startElement("warnings")) { while (warnings!=null) { try (SaxElementBuilder warning = elementBuilder.startElement("warning")) { warning.addAttribute("errorCode",""+warnings.getErrorCode()); warning.addAttribute("sqlState",""+warnings.getSQLState()); String message=warnings.getMessage(); Throwable cause=warnings.getCause(); if (cause!=null) { warning.addAttribute("cause",cause.getClass().getName()); if (message==null) { message=cause.getMessage(); } else { message=message+": "+cause.getMessage(); } } warning.addAttribute("message",message); } } } } }
Example 11
Source File: JdbcUtil.java From iaf with Apache License 2.0 | 5 votes |
@Deprecated public static XmlBuilder warningsToXmlBuilder(SQLWarning warnings) { if (warnings!=null) { XmlBuilder warningsElem = new XmlBuilder("warnings"); while (warnings!=null) { XmlBuilder warningElem = new XmlBuilder("warning"); warningElem.addAttribute("errorCode",""+warnings.getErrorCode()); warningElem.addAttribute("sqlState",""+warnings.getSQLState()); String message=warnings.getMessage(); // getCause() geeft unresolvedCompilationProblem (bij Peter Leeuwenburgh?) Throwable cause=warnings.getCause(); if (cause!=null) { warningElem.addAttribute("cause",cause.getClass().getName()); if (message==null) { message=cause.getMessage(); } else { message=message+": "+cause.getMessage(); } } warningElem.addAttribute("message",message); warningsElem.addSubElement(warningElem); warnings=warnings.getNextWarning(); } return warningsElem; } return null; }