[jboss-cvs] jboss-seam/src/main/org/jboss/seam/util ...
Gavin King
gavin.king at jboss.com
Wed Jun 20 22:29:39 EDT 2007
User: gavin
Date: 07/06/20 22:29:39
Modified: src/main/org/jboss/seam/util DTDEntityResolver.java
Log:
use the correct classloader for loading descriptors
Revision Changes Path
1.5 +30 -17 jboss-seam/src/main/org/jboss/seam/util/DTDEntityResolver.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DTDEntityResolver.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/util/DTDEntityResolver.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- DTDEntityResolver.java 23 Jan 2007 10:37:41 -0000 1.4
+++ DTDEntityResolver.java 21 Jun 2007 02:29:39 -0000 1.5
@@ -1,4 +1,4 @@
-//$Id: DTDEntityResolver.java,v 1.4 2007/01/23 10:37:41 cbauer Exp $
+//$Id: DTDEntityResolver.java,v 1.5 2007/06/21 02:29:39 gavin Exp $
//Contributed by Markus Meissner
package org.jboss.seam.util;
@@ -26,7 +26,8 @@
* rules result in returning null, which should force the SAX reader to
* handle the entity reference in its default manner.
*/
-public class DTDEntityResolver implements EntityResolver, Serializable {
+public class DTDEntityResolver implements EntityResolver, Serializable
+{
private static final long serialVersionUID = -4553926061006790714L;
@@ -35,17 +36,22 @@
private static final String SEAM_NAMESPACE = "http://jboss.com/products/seam/";
private static final String USER_NAMESPACE = "classpath://";
- public InputSource resolveEntity(String publicId, String systemId) {
- if ( systemId != null ) {
+ public InputSource resolveEntity(String publicId, String systemId)
+ {
+ if ( systemId != null )
+ {
log.debug( "trying to resolve system-id [" + systemId + "]" );
- if ( systemId.startsWith( SEAM_NAMESPACE) ) {
+ if ( systemId.startsWith( SEAM_NAMESPACE) )
+ {
log.debug( "recognized Seam namespace; attempting to resolve on classpath under org/jboss/seam/" );
String path = "org/jboss/seam/" + systemId.substring( SEAM_NAMESPACE.length() );
- InputStream dtdStream = resolveInSeamNamespace( path );
- if ( dtdStream == null ) {
+ InputStream dtdStream = resolveInSeamNamespace(path);
+ if ( dtdStream == null )
+ {
log.debug( "unable to locate [" + systemId + "] on classpath" );
}
- else {
+ else
+ {
log.debug( "located [" + systemId + "] in classpath" );
InputSource source = new InputSource( dtdStream );
source.setPublicId( publicId );
@@ -53,14 +59,17 @@
return source;
}
}
- else if ( systemId.startsWith( USER_NAMESPACE ) ) {
+ else if ( systemId.startsWith( USER_NAMESPACE ) )
+ {
log.debug( "recognized local namespace; attempting to resolve on classpath" );
String path = systemId.substring( USER_NAMESPACE.length() );
InputStream stream = resolveInLocalNamespace( path );
- if ( stream == null ) {
+ if ( stream == null )
+ {
log.debug( "unable to locate [" + systemId + "] on classpath" );
}
- else {
+ else
+ {
log.debug( "located [" + systemId + "] in classpath" );
InputSource source = new InputSource( stream );
source.setPublicId( publicId );
@@ -73,15 +82,19 @@
return null;
}
- protected InputStream resolveInSeamNamespace(String path) {
- return this.getClass().getClassLoader().getResourceAsStream( path );
+ protected InputStream resolveInSeamNamespace(String path)
+ {
+ return this.getClass().getClassLoader().getResourceAsStream(path);
}
- protected InputStream resolveInLocalNamespace(String path) {
- try {
- return Resources.getResourceAsStream( path );
+ protected InputStream resolveInLocalNamespace(String path)
+ {
+ try
+ {
+ return Resources.getResourceAsStream(path);
}
- catch( Throwable t ) {
+ catch( Throwable t )
+ {
return null;
}
}
More information about the jboss-cvs-commits
mailing list