/** * Stringify the given exception. */ public static String toString(ExceptionInfo e) { int type = e.getType(); StringBuffer buf = new StringBuffer(); buf.append("<"). append(OpenJPAVersion.VERSION_ID). append(' '). append(e.isFatal() ? "fatal " : "nonfatal "). append (type == ExceptionInfo.GENERAL ? "general error" : type == ExceptionInfo.INTERNAL ? "internal error" : type == ExceptionInfo.STORE ? "store error" : type == ExceptionInfo.UNSUPPORTED ? "unsupported error" : type == ExceptionInfo.USER ? "user error" : (type + " error")). append("> "); buf.append(e.getClass().getName()).append(": "). append(e.getMessage()); Object failed = e.getFailedObject(); if (failed != null) buf.append(SEP).append("FailedObject: "). append(toString(failed)); return buf.toString(); }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintStream out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
public void commit() { try { _broker.commit(); } catch (RollbackException e) { throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { // Per JPA 2.0 spec, if the exception was due to a JSR-303 // constraint violation, the ConstraintViolationException should be // thrown. Since JSR-303 is optional, the cast to RuntimeException // prevents the introduction of a runtime dependency on the BV API. if (ValidationUtils.isConstraintViolationException(e)) throw (RuntimeException)e; // RollbackExceptions are special and aren't handled by the // normal exception translator, since the spec says they // should be thrown whenever the commit fails for any reason at // all, wheras the exception translator handles exceptions that // are caused for specific reasons // pass along the failed object if one is available. Object failedObject = null; if (e instanceof ExceptionInfo){ failedObject = ((ExceptionInfo)e).getFailedObject(); } throw new RollbackException(e).setFailedObject(failedObject); } }
public void commit() { try { _broker.commit(); } catch (RollbackException e) { throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { // Per JPA 2.0 spec, if the exception was due to a JSR-303 // constraint violation, the ConstraintViolationException should be // thrown. Since JSR-303 is optional, the cast to RuntimeException // prevents the introduction of a runtime dependency on the BV API. if (ValidationUtils.isConstraintViolationException(e)) throw (RuntimeException)e; // RollbackExceptions are special and aren't handled by the // normal exception translator, since the spec says they // should be thrown whenever the commit fails for any reason at // all, wheras the exception translator handles exceptions that // are caused for specific reasons // pass along the failed object if one is available. Object failedObject = null; if (e instanceof ExceptionInfo){ failedObject = ((ExceptionInfo)e).getFailedObject(); } throw new RollbackException(e).setFailedObject(failedObject); } }
/** * Stringify the given exception. */ public static String toString(ExceptionInfo e) { int type = e.getType(); StringBuilder buf = new StringBuilder(); buf.append("<"). append(OpenJPAVersion.VERSION_ID). append(' '). append(e.isFatal() ? "fatal " : "nonfatal "). append (type == ExceptionInfo.GENERAL ? "general error" : type == ExceptionInfo.INTERNAL ? "internal error" : type == ExceptionInfo.STORE ? "store error" : type == ExceptionInfo.UNSUPPORTED ? "unsupported error" : type == ExceptionInfo.USER ? "user error" : (type + " error")). append("> "); buf.append(e.getClass().getName()).append(": "). append(e.getMessage()); Object failed = e.getFailedObject(); if (failed != null) buf.append(SEP).append("FailedObject: "). append(toString(failed)); return buf.toString(); }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintStream out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
public void commit() { try { _broker.commit(); } catch (RollbackException e) { throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { // Per JPA 2.0 spec, if the exception was due to a JSR-303 // constraint violation, the ConstraintViolationException should be // thrown. Since JSR-303 is optional, the cast to RuntimeException // prevents the introduction of a runtime dependency on the BV API. if (ValidationUtils.isConstraintViolationException(e)) throw (RuntimeException)e; // RollbackExceptions are special and aren't handled by the // normal exception translator, since the spec says they // should be thrown whenever the commit fails for any reason at // all, wheras the exception translator handles exceptions that // are caused for specific reasons // pass along the failed object if one is available. Object failedObject = null; if (e instanceof ExceptionInfo){ failedObject = ((ExceptionInfo)e).getFailedObject(); } throw new RollbackException(e).setFailedObject(failedObject); } }
/** * Stringify the given exception. */ public static String toString(ExceptionInfo e) { int type = e.getType(); StringBuilder buf = new StringBuilder(); buf.append("<"). append(OpenJPAVersion.VERSION_ID). append(' '). append(e.isFatal() ? "fatal " : "nonfatal "). append (type == ExceptionInfo.GENERAL ? "general error" : type == ExceptionInfo.INTERNAL ? "internal error" : type == ExceptionInfo.STORE ? "store error" : type == ExceptionInfo.UNSUPPORTED ? "unsupported error" : type == ExceptionInfo.USER ? "user error" : (type + " error")). append("> "); buf.append(e.getClass().getName()).append(": "). append(e.getMessage()); Object failed = e.getFailedObject(); if (failed != null) buf.append(SEP).append("FailedObject: "). append(toString(failed)); return buf.toString(); }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintStream out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
public void commit() { try { _broker.commit(); } catch (RollbackException e) { throw e; } catch (IllegalStateException e) { throw e; } catch (Exception e) { // Per JPA 2.0 spec, if the exception was due to a JSR-303 // constraint violation, the ConstraintViolationException should be // thrown. Since JSR-303 is optional, the cast to RuntimeException // prevents the introduction of a runtime dependency on the BV API. if (ValidationUtils.isConstraintViolationException(e)) throw (RuntimeException)e; // RollbackExceptions are special and aren't handled by the // normal exception translator, since the spec says they // should be thrown whenever the commit fails for any reason at // all, wheras the exception translator handles exceptions that // are caused for specific reasons // pass along the failed object if one is available. Object failedObject = null; if (e instanceof ExceptionInfo){ failedObject = ((ExceptionInfo)e).getFailedObject(); } throw new RollbackException(e).setFailedObject(failedObject); } }
/** * Stringify the given exception. */ public static String toString(ExceptionInfo e) { int type = e.getType(); StringBuilder buf = new StringBuilder(); buf.append("<"). append(OpenJPAVersion.VERSION_ID). append(' '). append(e.isFatal() ? "fatal " : "nonfatal "). append (type == ExceptionInfo.GENERAL ? "general error" : type == ExceptionInfo.INTERNAL ? "internal error" : type == ExceptionInfo.STORE ? "store error" : type == ExceptionInfo.UNSUPPORTED ? "unsupported error" : type == ExceptionInfo.USER ? "user error" : (type + " error")). append("> "); buf.append(e.getClass().getName()).append(": "). append(e.getMessage()); Object failed = e.getFailedObject(); if (failed != null) buf.append(SEP).append("FailedObject: "). append(toString(failed)); return buf.toString(); }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintWriter out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
/** * Stringify the given exception. */ public static String toString(ExceptionInfo e) { int type = e.getType(); StringBuilder buf = new StringBuilder(); buf.append("<"). append(OpenJPAVersion.VERSION_ID). append(' '). append(e.isFatal() ? "fatal " : "nonfatal "). append (type == ExceptionInfo.GENERAL ? "general error" : type == ExceptionInfo.INTERNAL ? "internal error" : type == ExceptionInfo.STORE ? "store error" : type == ExceptionInfo.UNSUPPORTED ? "unsupported error" : type == ExceptionInfo.USER ? "user error" : (type + " error")). append("> "); buf.append(e.getClass().getName()).append(": "). append(e.getMessage()); Object failed = e.getFailedObject(); if (failed != null) buf.append(SEP).append("FailedObject: "). append(toString(failed)); return buf.toString(); }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintWriter out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintWriter out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintStream out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintWriter out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintStream out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }
/** * Print the stack trace of the exception's nested throwables. */ public static void printNestedThrowables(ExceptionInfo e, PrintWriter out) { // if this is Java 1.4 and there is exactly a single // exception, then defer to 1.4's behavior of printing // out the result of getCause(). This deferral happens in // the calling code. Throwable[] nested = e.getNestedThrowables(); int i = (JavaVersions.VERSION >= 4) ? 1 : 0; if (i < nested.length) { out.println("NestedThrowables:"); for (; i < nested.length; i++) // guard against a nasty null in the array if (nested[i] != null) nested[i].printStackTrace(out); } }