public static SessionLoaderException unexpectedValueOfTag(String nodeValue, String parentNode) { Object[] args = { nodeValue, parentNode }; SessionLoaderException sessionLoaderException = new SessionLoaderException(ExceptionMessageGenerator.buildMessage(SessionLoaderException.class, UN_EXPECTED_VALUE_OF_TAG, args)); sessionLoaderException.setErrorCode(UN_EXPECTED_VALUE_OF_TAG); return sessionLoaderException; }
public String toString() { if (getErrorCode() == FINAL_EXCEPTION) { StringBuffer buffer = new StringBuffer(); buffer.append(getMessage()); buffer.append(cr()); Iterator<Throwable> exceptionList = getExceptionList().iterator(); while (exceptionList.hasNext()) { buffer.append("***"); buffer.append(cr()); buffer.append(exceptionList.next().toString()); buffer.append(cr()); } return buffer.toString(); } else { return super.toString(); } } }
public static SessionLoaderException finalException(Vector exceptionList) { Object[] args = { Integer.valueOf(exceptionList.size()) }; SessionLoaderException sessionLoaderException = new SessionLoaderException(ExceptionMessageGenerator.buildMessage(SessionLoaderException.class, FINAL_EXCEPTION, args)); sessionLoaderException.setErrorCode(FINAL_EXCEPTION); sessionLoaderException.setExceptionList(exceptionList); return sessionLoaderException; }
throw SessionLoaderException.failedToLoadProjectClass(projectString, exception); throw SessionLoaderException.failedToLoadProjectXml(projectString, validationException); throw SessionLoaderException. failedToParseXML(projectString, validationException);
throw SessionLoaderException.failedToLoadTag("struct-converter", converterClassName, exception);
throw SessionLoaderException.failedToLoadProjectClass(projectString, exception); project = XMLProjectReader.read(projectString); } catch (Exception e) { throw SessionLoaderException.failedToLoadProjectXml(projectString, validationException); throw SessionLoaderException.failedToLoadProjectXml(projectString, validationException);
/** * PUBLIC: * Iterate through the exception list printing out the stack traces. */ public void printStackTrace(PrintWriter writer) { super.printStackTrace(writer); if (getExceptionList() != null) { writer.println("SessionLoaderExceptions:"); Iterator<Throwable> exceptionList = getExceptionList().iterator(); while (exceptionList.hasNext()) { writer.write("***"); writer.write(cr()); exceptionList.next().printStackTrace(writer); writer.write(cr()); } } writer.flush(); }
}else{ throw SessionLoaderException.InvalidSessionXML(); }else{ throw SessionLoaderException.finalException(getExceptionStore());
throw SessionLoaderException.failedToParseXML("Server platform class is invalid: " + serverClassName, e); throw SessionLoaderException.serverPlatformNoLongerSupported(serverClassName);
public void warning(SAXParseException e) throws SAXException { getExceptionStore().add(SessionLoaderException.failedToParseXML(ExceptionLocalization.buildMessage("parsing_warning"), e.getLineNumber(), e.getColumnNumber(), e)); }
/** * INTERNAL: * This method instantiates the parser and builds the document based on the * schema. If the document is loaded without errors, then the configs are * converted to sessions and stored on the session manager and true is * returned to indicate success. */ public boolean load(SessionManager sessionManager, ClassLoader loader) { Document document = loadDocument(loader); if(getExceptionStore().isEmpty()){ if (document.getDocumentElement().getTagName().equals("sessions")) { return buildSessionConfigs(sessionManager,loader,document,getProject()); } }else{ //upon this time, we knew this could be either toplink sessions.xml or invalid eclipse session.xml. if(document.getDocumentElement().getTagName().equals("toplink-sessions")){ return buildSessionConfigs(sessionManager,loader,document,new XMLSessionConfigToplinkProject()); }else{ // Throw the exceptions we encountered throw SessionLoaderException.finalException(getExceptionStore()); } } // 9.0.4 session.xml, return false to indicate we should load with the XMLLoader return false; }
throw SessionLoaderException.failedToLoadProjectClass(projectString, exception); throw SessionLoaderException.failedToLoadProjectXml(projectString, validationException); throw SessionLoaderException. failedToParseXML(projectString, validationException);
public static SessionLoaderException finalException(Vector exceptionList) { Object[] args = { new Integer(exceptionList.size()) }; SessionLoaderException sessionLoaderException = new SessionLoaderException(ExceptionMessageGenerator.buildMessage(SessionLoaderException.class, FINAL_EXCEPTION, args)); sessionLoaderException.setErrorCode(FINAL_EXCEPTION); sessionLoaderException.setExceptionList(exceptionList); return sessionLoaderException; }
throw SessionLoaderException.failedToLoadTag("struct-converter", converterClassName, exception);
throw SessionLoaderException.failedToLoadProjectClass(projectString, exception); project = XMLProjectReader.read(projectString); } catch (Exception e) { throw SessionLoaderException.failedToLoadProjectXml(projectString, validationException); throw SessionLoaderException.failedToLoadProjectXml(projectString, validationException);
/** * PUBLIC: * Iterate through the exception list printing out the stack traces. */ public void printStackTrace(PrintWriter writer) { super.printStackTrace(writer); if (getExceptionList() != null) { writer.println("SessionLoaderExceptions:"); Iterator exceptionList = getExceptionList().iterator(); while (exceptionList.hasNext()) { writer.write("***"); writer.write(cr()); ((Throwable)exceptionList.next()).printStackTrace(writer); writer.write(cr()); } } writer.flush(); }
}else{ throw SessionLoaderException.InvalidSessionXML(); }else{ throw SessionLoaderException.finalException(getExceptionStore());
public void warning(SAXParseException e) throws SAXException { getExceptionStore().add(SessionLoaderException.failedToParseXML(ExceptionLocalization.buildMessage("parsing_warning"), e.getLineNumber(), e.getColumnNumber(), e)); }
/** * INTERNAL: * This method instantiates the parser and builds the document based on the * schema. If the document is loaded without errors, then the configs are * converted to sessions and stored on the session manager and true is * returned to indicate success. */ public boolean load(SessionManager sessionManager, ClassLoader loader) { Document document = loadDocument(loader); if(getExceptionStore().isEmpty()){ if (document.getDocumentElement().getTagName().equals("sessions")) { return buildSessionConfigs(sessionManager,loader,document,getProject()); } }else{ //upon this time, we knew this could be either toplink sessions.xml or invalid eclipse session.xml. if(document.getDocumentElement().getTagName().equals("toplink-sessions")){ return buildSessionConfigs(sessionManager,loader,document,new XMLSessionConfigToplinkProject()); }else{ // Throw the exceptions we encountered throw SessionLoaderException.finalException(getExceptionStore()); } } // 9.0.4 session.xml, return false to indicate we should load with the XMLLoader return false; }
public static SessionLoaderException unknownAttributeOfTag(String nodeName) { Object[] args = { nodeName }; SessionLoaderException sessionLoaderException = new SessionLoaderException(ExceptionMessageGenerator.buildMessage(SessionLoaderException.class, UNKNOWN_ATTRIBUTE_OF_TAG, args)); sessionLoaderException.setErrorCode(UNKNOWN_ATTRIBUTE_OF_TAG); return sessionLoaderException; }