%@ page language="java" %>
<%@ page import="org.apache.xerces.parsers.SAXParser,
org.apache.xerces.framework.XMLParser,
org.xml.sax.InputSource,
java.io.StringReader,
org.jboss.mx.loading.ClassLoaderUtils" %>
Use Case Testing Legacy XML Parser
This web application is used to test if isolation of JBOSS xerces version is succesfull.
The jboss-web.xml file has java2ClassLoadingCompliance=false
<%
// run test
try
{
// Create the legacy parser instance
Object parser = new org.apache.xerces.parsers.SAXParser();
StringBuffer info = new StringBuffer("Legacy SAXParser info: ");
ClassLoaderUtils.displayClassInfo(parser.getClass(), info);
out.println("");
out.println(info);
out.println("
");
if (parser instanceof org.apache.xerces.framework.XMLParser)
{
out.println("Test Successfull!!");
out.println("
Was able to create a instance of SAXParser that extends XMLParser (this class doesn't exist in Jboss version of Xerces). class="+ parser.getClass());
out.println("Test Successfull!!");
}
else
{
out.println("Test failed. The SAXParser that was created wasn't a subclass of XMLParser. This means that the Isolation from Jboss's newer xerces parser was not succesfull (newer SAXParser class doesn't extend XMLParser).");
throw new ServletException("SAXParser was not a org.apache.xerces.framework.XMLParser, "+info);
}
}
catch (java.lang.VerifyError e)
{
out.println("Test failed. VerifyError has occured. Isolation from Jboss's newer xerces parser was not succesfull. Exception = "+ e);
throw new ServletException("Test failed with VerifyError", e);
}
catch (Throwable e)
{
out.println("Test failed. Not sure why! Error = "+ e);
throw new ServletException("Test failed with VerifyError", e);
}
%>