List of usage examples for java.sql SQLWarning getCause
public synchronized Throwable getCause()
From source file:nl.nn.adapterframework.util.JdbcUtil.java
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(); }/*from ww w.j a v a2 s . c o m*/ } warningElem.addAttribute("message", message); warningsElem.addSubElement(warningElem); warnings = warnings.getNextWarning(); } return warningsElem; } return null; }
From source file:org.apache.ddlutils.platform.PlatformImplBase.java
/** * Logs any warnings associated to the given connection. Note that the connection needs * to be open for this.// w ww .j ava 2 s .co m * * @param connection The open connection */ protected void logWarnings(Connection connection) throws SQLException { SQLWarning warning = connection.getWarnings(); while (warning != null) { getLog().warn(warning.getLocalizedMessage(), warning.getCause()); warning = warning.getNextWarning(); } }