[MOBY-guts] biomoby commit
Paul Gordon
gordonp at dev.open-bio.org
Tue Oct 31 20:25:56 UTC 2006
gordonp
Tue Oct 31 15:25:55 EST 2006
Update of /home/repository/moby/moby-live/Java/src/Clients
In directory dev.open-bio.org:/tmp/cvs-serv29244/src/Clients
Modified Files:
ServletTester.java
Log Message:
Better error reporting if the provided 'web.xml' file is not syntactically correct
moby-live/Java/src/Clients ServletTester.java,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/Clients/ServletTester.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Java/src/Clients/ServletTester.java 2006/10/25 02:33:22 1.1
+++ /home/repository/moby/moby-live/Java/src/Clients/ServletTester.java 2006/10/31 20:25:55 1.2
@@ -33,7 +33,7 @@
ServletTester tester = new ServletTester();
// Open the web.xml file to determine the service name and inputs/outputs.
- java.net.URL webXmlURL = tester.getClass().getClassLoader().getResource("WEB-INF/web.xml");
+ java.net.URL webXmlURL = tester.getClass().getClassLoader().getResource("WEB-INF/web.xml");
if(webXmlURL == null){
System.err.println("Could not find \"WEB-INF/web.xml\", aborting!");
System.exit(1);
@@ -48,10 +48,18 @@
dbf.setNamespaceAware(false);
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
- Element docRoot = docBuilder.parse(webXmlURL.openStream()).getDocumentElement();
- if(docRoot == null || !docRoot.getNodeName().equals("web-app")){
- System.err.println("Could not find /web-app tag in " +
- webXmlURL + ", aborting!");
+ Element docRoot = null;
+ try{
+ docRoot = docBuilder.parse(webXmlURL.openStream()).getDocumentElement();
+ if(docRoot == null || !docRoot.getNodeName().equals("web-app")){
+ System.err.println("Could not find /web-app tag in " +
+ webXmlURL + ", aborting!");
+ System.exit(1);
+ }
+ } catch(Exception e){
+ System.err.println("There appears to be a problem with the \"WEB-INF/web.xml\" file (XML syntax?)." +
+ "While parsing it I encountered the error: " + e);
+ e.printStackTrace();
System.exit(1);
}
Element servlet = getChildElement(docRoot, "servlet");
More information about the MOBY-guts
mailing list