/** * INTERNAL: */ public String toString() { return getIndentationString() + ExceptionMessageGenerator.getHeader("ExceptionHeader") + getErrorCode() + "] (" + org.eclipse.persistence.sessions.DatabaseLogin.getVersion() + "): " + getClass().getName() + getMessage(); } }
/** * PUBLIC: * Print both the normal and internal stack traces. */ public void printStackTrace(PrintWriter writer) { writer.write(ExceptionMessageGenerator.getHeader("LocalExceptionStackHeader")); writer.write(cr()); super.printStackTrace(writer); if ((getInternalException() != null) && shouldPrintInternalException()) { writer.write(ExceptionMessageGenerator.getHeader("InternalExceptionStackHeader")); writer.write(cr()); getInternalException().printStackTrace(writer); if ((getInternalException() instanceof java.lang.reflect.InvocationTargetException) && ((((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException()) != null)) { writer.write(ExceptionMessageGenerator.getHeader("TargetInvocationExceptionStackHeader")); writer.write(cr()); ((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException().printStackTrace(writer); } } writer.flush(); }
/** * PUBLIC: * Allow any WARNING level exceptions that occur within EclipseLink to be logged and handled by the exception handler. */ public Object handleException(RuntimeException exception) throws RuntimeException { if ((exception instanceof EclipseLinkException)) { EclipseLinkException eclipseLinkException = (EclipseLinkException)exception; if (eclipseLinkException.getSession() == null) { eclipseLinkException.setSession(this); } //Bug#3559280 Avoid logging an exception twice if (!eclipseLinkException.hasBeenLogged()) { logThrowable(SessionLog.WARNING, null, exception); eclipseLinkException.setHasBeenLogged(true); } } else { logThrowable(SessionLog.WARNING, null, exception); } if (hasExceptionHandler()) { return getExceptionHandler().handleException(exception); } else { throw exception; } }
/** * PUBLIC: * Return the exception error message. * EclipseLink error messages are multi-line so that detail descriptions of the exception are given. */ public String getMessage() { StringWriter writer = new StringWriter(100); // Avoid printing internal exception error message twice. if ((getInternalException() == null) || ((super.getMessage() != null) && !super.getMessage().equals(getInternalException().toString()))) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("DescriptionHeader")); writer.write(super.getMessage()); } if (getInternalException() != null) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("InternalExceptionHeader")); writer.write(getInternalException().toString()); if ((getInternalException() instanceof java.lang.reflect.InvocationTargetException) && ((((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException()) != null)) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("TargetInvocationExceptionHeader")); writer.write(((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException().toString()); } } return writer.toString(); }
/** * PUBLIC: * Print both the normal and internal stack traces. */ public void printStackTrace() { printStackTrace(System.err); }
/** * PUBLIC: * This is the database error number. * Since it is possible to have no internal exception the errorCode will be zero in this case. */ public int getDatabaseErrorCode() { if (getInternalException() == null) { return super.getErrorCode(); } return ((SQLException)getInternalException()).getErrorCode(); }
if (!(exception instanceof EclipseLinkException && ((EclipseLinkException)exception).hasBeenLogged())) { uow.logThrowable(SessionLog.WARNING, SessionLog.TRANSACTION, exception);
return super.getMessage(); } else { StringWriter writer = new StringWriter(); writer.write(super.getMessage()); writer.write(cr()); writer.write(getIndentationString());
if ((exception instanceof EclipseLinkException)) { EclipseLinkException eclipseLinkException = (EclipseLinkException)exception; if (eclipseLinkException.getSession() == null) { eclipseLinkException.setSession(this); if (!eclipseLinkException.hasBeenLogged()) { logThrowable(SessionLog.WARNING, null, exception); eclipseLinkException.setHasBeenLogged(true);
/** * PUBLIC: * Return the exception error message. * EclipseLink error messages are multi-line so that detail descriptions of the exception are given. */ public String getMessage() { StringWriter writer = new StringWriter(100); // Avoid printing internal exception error message twice. if ((getInternalException() == null) || ((super.getMessage() != null) && !super.getMessage().equals(getInternalException().toString()))) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("DescriptionHeader")); writer.write(super.getMessage()); } if (getInternalException() != null) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("InternalExceptionHeader")); writer.write(getInternalException().toString()); if ((getInternalException() instanceof java.lang.reflect.InvocationTargetException) && ((((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException()) != null)) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("TargetInvocationExceptionHeader")); writer.write(((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException().toString()); } } return writer.toString(); }
/** * PUBLIC: * Print both the normal and internal stack traces. */ public void printStackTrace() { printStackTrace(System.err); }
/** * PUBLIC: * This is the database error number. * Since it is possible to have no internal exception the errorCode will be zero in this case. */ public int getDatabaseErrorCode() { if (getInternalException() == null) { return super.getErrorCode(); } return ((SQLException)getInternalException()).getErrorCode(); }
if (!(exception instanceof EclipseLinkException && ((EclipseLinkException)exception).hasBeenLogged())) { uow.logThrowable(SessionLog.WARNING, SessionLog.TRANSACTION, exception);
return super.getMessage(); } else { StringWriter writer = new StringWriter(); writer.write(super.getMessage()); writer.write(cr()); writer.write(getIndentationString());
if ((exception instanceof EclipseLinkException)) { EclipseLinkException eclipseLinkException = (EclipseLinkException)exception; if (eclipseLinkException.getSession() == null) { eclipseLinkException.setSession(this); if (!eclipseLinkException.hasBeenLogged()) { logThrowable(SessionLog.WARNING, null, exception); eclipseLinkException.setHasBeenLogged(true);
/** * INTERNAL: */ public String toString() { return getIndentationString() + ExceptionMessageGenerator.getHeader("ExceptionHeader") + getErrorCode() + "] (" + org.eclipse.persistence.sessions.DatabaseLogin.getVersion() + "): " + getClass().getName() + getMessage(); }
/** * PUBLIC: * Print both the normal and internal stack traces. */ public void printStackTrace(PrintWriter writer) { writer.write(ExceptionMessageGenerator.getHeader("LocalExceptionStackHeader")); writer.write(cr()); super.printStackTrace(writer); if ((getInternalException() != null) && shouldPrintInternalException()) { writer.write(ExceptionMessageGenerator.getHeader("InternalExceptionStackHeader")); writer.write(cr()); getInternalException().printStackTrace(writer); if ((getInternalException() instanceof java.lang.reflect.InvocationTargetException) && ((((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException()) != null)) { writer.write(ExceptionMessageGenerator.getHeader("TargetInvocationExceptionStackHeader")); writer.write(cr()); ((java.lang.reflect.InvocationTargetException) getInternalException()).getTargetException().printStackTrace(writer); } } writer.flush(); }
/** * PUBLIC: * Return the exception error message. * EclipseLink error messages are multi-line so that detail descriptions of the exception are given. */ public String getMessage() { StringWriter writer = new StringWriter(100); // Avoid printing internal exception error message twice. if ((getInternalException() == null) || ((super.getMessage() != null) && !super.getMessage().equals(getInternalException().toString()))) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("DescriptionHeader")); writer.write(super.getMessage()); } if (getInternalException() != null) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("InternalExceptionHeader")); writer.write(getInternalException().toString()); if ((getInternalException() instanceof java.lang.reflect.InvocationTargetException) && ((((java.lang.reflect.InvocationTargetException)getInternalException()).getTargetException()) != null)) { writer.write(cr()); writer.write(getIndentationString()); writer.write(ExceptionMessageGenerator.getHeader("TargetInvocationExceptionHeader")); writer.write(((java.lang.reflect.InvocationTargetException)getInternalException()).getTargetException().toString()); } } return writer.toString(); }