Here you can find the source of mergeSQLExceptionMsg(final StringBuilder msgBuilder, final SQLException e, final String prefix)
Parameter | Description |
---|---|
msgBuilder | message builder |
e | exception |
prefix | space prefix for each line. |
private static void mergeSQLExceptionMsg(final StringBuilder msgBuilder, final SQLException e, final String prefix)
//package com.java2s; //License from project: Open Source License import java.sql.SQLException; public class Main { /**/*www.j a v a 2s . c o m*/ * @param msgBuilder message builder * @param e exception * @param prefix space prefix for each line. * */ private static void mergeSQLExceptionMsg(final StringBuilder msgBuilder, final SQLException e, final String prefix) { msgBuilder.append(prefix + "ErrorCode: "); msgBuilder.append(e.getErrorCode()); msgBuilder.append(", SQLState: "); msgBuilder.append(e.getSQLState()); msgBuilder.append(", Msg: "); String m = e.getMessage(); if (m != null) { msgBuilder.append(prefix + m.replaceAll("\n", "\n" + prefix)); } if (e.getNextException() != null) { msgBuilder.append("\n"); mergeSQLExceptionMsg(msgBuilder, e.getNextException(), prefix + " "); } } }