You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2003/03/31 05:02:07 UTC
cvs commit: maven/src/plugins-build/j2ee/src/main/org/apache/maven/j2ee J2EEEntityResolver.java
dion 2003/03/30 19:02:07
Modified: src/plugins-build/j2ee/src/main/org/apache/maven/j2ee
J2EEEntityResolver.java
Log:
Test case for failing j2ee plugin when proxies cache a bad DTD.
The entities weren't being resolved locally.
Refactor and fix bad resource name
Revision Changes Path
1.4 +25 -19 maven/src/plugins-build/j2ee/src/main/org/apache/maven/j2ee/J2EEEntityResolver.java
Index: J2EEEntityResolver.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/j2ee/src/main/org/apache/maven/j2ee/J2EEEntityResolver.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- J2EEEntityResolver.java 23 Feb 2003 11:29:29 -0000 1.3
+++ J2EEEntityResolver.java 31 Mar 2003 03:02:07 -0000 1.4
@@ -81,27 +81,30 @@
/** log for debug output */
private static final Log LOG = LogFactory.getLog(J2EEEntityResolver.class);
+ /** list of j2ee dtds that are being made available */
+ public static final String[] J2EE_DTDS = new String[] {
+ "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN",
+ "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN",
+ "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN",
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN",
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",
+ "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
+ };
+ public static final String[] J2EE_RESOURCES = new String[] {
+ "/plugin-resources/application-client_1_3.dtd",
+ "/plugin-resources/application_1_3.dtd",
+ "/plugin-resources/ejb-jar_2_0.dtd",
+ "/plugin-resources/web-app_2.2.dtd",
+ "/plugin-resources/web-app_2_3.dtd",
+ "/plugin-resources/web-jsptaglibrary_1_2.dtd"
+ };
+
/** Creates a new instance of EntityResolver */
public J2EEEntityResolver()
{
- idToResource.put(
- "-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN",
- "/plugin-resources/application-client_1_3.dtd");
- idToResource.put(
- "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN",
- "/plugin-resources/application_1_3.dtd");
- idToResource.put(
- "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN",
- "/plugin-resources/ejb-jar_2_0.dtd");
- idToResource.put(
- "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN",
- "/plugin-resources/web-app_2_2.dtd");
- idToResource.put(
- "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN",
- "/plugin-resources/web-app_2_3.dtd");
- idToResource.put(
- "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN",
- "/plugin-resources/web-jsptaglibrary_1_2.dtd");
+ for (int i = 0; i < J2EE_DTDS.length; i++) {
+ idToResource.put(J2EE_DTDS[i], J2EE_RESOURCES[i]);
+ }
}
/** resolve the entity given by the provided Ids
@@ -114,12 +117,15 @@
public InputSource resolveEntity(String publicId, String systemId) throws
SAXException, IOException
{
+ LOG.debug("resolving entity with publicId='" + publicId + ", systemId='" + systemId + "'");
if (publicId != null)
{
String resource = (String) idToResource.get(publicId);
+ LOG.debug("resource found in map ='" + resource + "'" );
if (resource != null)
{
InputStream in = getClass().getResourceAsStream(resource);
+ LOG.debug("input stream ='" + in + "'" );
if (in != null)
{
return new InputSource(in);
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org