[jboss-cvs] JBossAS SVN: r62025 - trunk/server/src/main/org/jboss/metadata.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 3 08:15:11 EDT 2007
Author: thomas.diesler at jboss.com
Date: 2007-04-03 08:15:10 -0400 (Tue, 03 Apr 2007)
New Revision: 62025
Modified:
trunk/server/src/main/org/jboss/metadata/XmlFileLoader.java
Log:
[JBCOMMON-23] JBossEntityResolver does not register jboss-app_5_0.dtd
Modified: trunk/server/src/main/org/jboss/metadata/XmlFileLoader.java
===================================================================
--- trunk/server/src/main/org/jboss/metadata/XmlFileLoader.java 2007-04-03 12:05:44 UTC (rev 62024)
+++ trunk/server/src/main/org/jboss/metadata/XmlFileLoader.java 2007-04-03 12:15:10 UTC (rev 62025)
@@ -299,8 +299,7 @@
* only for error reporting.
* @return Document
*/
- public Document getDocument(InputSource is, String inPath)
- throws DeploymentException
+ public Document getDocument(InputSource is, String inPath) throws DeploymentException
{
try
{
@@ -319,25 +318,30 @@
//docBuilderFactory.setAttribute
// ("http://java.sun.com/xml/jaxp/properties/schemaLanguage","http://www.w3.org/2001/XMLSchema");
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
- JBossEntityResolver lr = new JBossEntityResolver();
- LocalErrorHandler eh = new LocalErrorHandler( inPath, lr );
- docBuilder.setEntityResolver(lr);
- docBuilder.setErrorHandler(eh );
+ // [JBCOMMON-23] JBossEntityResolver does not register jboss-app_5_0.dtd
+ JBossEntityResolver entityResolver = new JBossEntityResolver();
+ JBossEntityResolver.registerEntity("-//JBoss//DTD Java EE Application 4.2///EN", "jboss-app_4_2.dtd");
+ JBossEntityResolver.registerEntity("-//JBoss//DTD Java EE Application 5.0///EN", "jboss-app_5_0.dtd");
+
+ LocalErrorHandler errorHandler = new LocalErrorHandler(inPath, entityResolver);
+ docBuilder.setEntityResolver(entityResolver);
+ docBuilder.setErrorHandler(errorHandler);
+
Document doc = docBuilder.parse(is);
- if(validateDTDs && eh.hadError())
+ if (validateDTDs && errorHandler.hadError())
{
- throw new DeploymentException("Invalid XML: file=" + inPath, eh.getException());
+ throw new DeploymentException("Invalid XML: file=" + inPath, errorHandler.getException());
}
return doc;
}
- catch (DeploymentException e)
+ catch (DeploymentException e)
{
throw e;
}
catch (SAXParseException e)
{
- String msg = "Invalid XML: file=" + inPath+"@"+e.getColumnNumber()+":"+e.getLineNumber();
+ String msg = "Invalid XML: file=" + inPath + "@" + e.getColumnNumber() + ":" + e.getLineNumber();
throw new DeploymentException(msg, e);
}
catch (SAXException e)
More information about the jboss-cvs-commits
mailing list