commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dan Tarkenton <tarken...@gmail.com>
Subject [Digester] Why aren't SAXExceptions thrown?
Date Fri, 02 Jul 2004 21:32:48 GMT
Hello, I'm as confused as possible.  I'm using Digester 1.5 binaries.

Below is a snippet of cod from my TestResultsHandler class:

public static void parse(String document) throws TestResultsException {
		
        Digester digester = initializeParser();

        TestResultsHandler resultsParser = null;
        try {
        
        //resultsParser = (TestResultsHandler)digester.parse(new
StringReader(document));
        resultsParser = 
        	(TestResultsHandler)digester.parse(new
File("/usr/local/projects/BOMAnalysis/web/xml/TestResults.xml"));
        } catch (SAXParseException saxe) {
	    	String msg = MessageUtil.formatMessage(MSG_TEST_RESULTS_PARSER_FAILURE);
	    	throw new TestResultsException(msg, saxe);
    	} catch (SAXException saxe) {
	    	String msg = MessageUtil.formatMessage(MSG_TEST_RESULTS_PARSER_FAILURE);
	    	throw new TestResultsException(msg, saxe);
    	} catch (IOException ioe) {
	    	String msg = MessageUtil.formatMessage(MSG_TEST_RESULTS_IO_FAILURE);
	    	throw new TestResultsException(msg, ioe);
	    	 
    	}
    }

Now, I intentionally try and break my TestResults.xml so that it will
throw a SAXParseException.  I'm trying to test for this case.  Below
is part of my log file:

2004-07-02 17:18:42,587: ERROR : Parse Error at line 30 column -1:
Element "TestResult" does not allow text.
org.xml.sax.SAXParseException: Element "TestResult" does not allow text.
	at org.apache.crimson.parser.Parser2.error(Parser2.java:3354)
	at org.apache.crimson.parser.ValidatingParser$ChildrenValidator.text(ValidatingParser.java:355)
	at org.apache.crimson.parser.InputEntity.parsedContent(InputEntity.java:597)
	at org.apache.crimson.parser.Parser2.content(Parser2.java:2010)
	at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
	at org.apache.crimson.parser.Parser2.content(Parser2.java:1963)
	at org.apache.crimson.parser.Parser2.maybeElement(Parser2.java:1691)
	at org.apache.crimson.parser.Parser2.parseInternal(Parser2.java:667)
	at org.apache.crimson.parser.Parser2.parse(Parser2.java:337)
	at org.apache.crimson.parser.XMLReaderImpl.parse(XMLReaderImpl.java:448)
	at org.apache.commons.digester.Digester.parse(Digester.java:1532)
	at com.titan.bat.gui.testresults.TestResultsHandler.parse(Unknown Source)
	at detailedReport_2._jspService(detailedReport_2.java:86)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
	at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
	at org.apache.tomcat.core.Handler.service(Handler.java:235)
	at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
	at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
	at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
	at java.lang.Thread.run(Thread.java:534)

What gives here?  It certainly is running into a SAXParseException,
but it doesn't seem to be throwing it. I.e.  i never get a
TestResultsException.

Do I need to configure something else?  I looked at the API and I
thought I had this set to validate against my DTD.  I'm in desparate
need of help!

TIA.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message