Author: norman.richards(a)jboss.com
Date: 2008-02-06 22:06:44 -0500 (Wed, 06 Feb 2008)
New Revision: 7389
Modified:
trunk/src/main/org/jboss/seam/init/Initialization.java
trunk/src/main/org/jboss/seam/util/DTDEntityResolver.java
Log:
JBSEAM-2046
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-02-06 20:08:42 UTC (rev
7388)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-02-07 03:06:44 UTC (rev
7389)
@@ -215,7 +215,7 @@
NamespaceDescriptor nsInfo = namespaceMap.get(ns);
if (nsInfo == null )
{
- if ( ns!=null &&
!ns.equals("http://jboss.com/products/seam/components") )
+ if ( ns!=null && ns.length()>0 &&
!ns.equals("http://jboss.com/products/seam/components") )
{
log.warn("namespace declared in components.xml does not resolve to a
package annotated @Namespace: " + ns);
}
Modified: trunk/src/main/org/jboss/seam/util/DTDEntityResolver.java
===================================================================
--- trunk/src/main/org/jboss/seam/util/DTDEntityResolver.java 2008-02-06 20:08:42 UTC (rev
7388)
+++ trunk/src/main/org/jboss/seam/util/DTDEntityResolver.java 2008-02-07 03:06:44 UTC (rev
7389)
@@ -30,73 +30,62 @@
public class DTDEntityResolver implements EntityResolver, Serializable
{
- private static final long serialVersionUID = -4553926061006790714L;
+ private static final long serialVersionUID = -4553926061006790714L;
- private static final LogProvider log = Logging.getLogProvider(DTDEntityResolver.class
);
+ private static final LogProvider log =
Logging.getLogProvider(DTDEntityResolver.class);
- private static final String SEAM_NAMESPACE =
"http://jboss.com/products/seam/";
- private static final String USER_NAMESPACE = "classpath://";
+ 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 )
- {
- log.debug( "trying to resolve system-id [" + systemId + "]" );
- 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 )
- {
- log.debug( "unable to locate [" + systemId + "] on classpath"
);
- }
- else
- {
- log.debug( "located [" + systemId + "] in classpath" );
- InputSource source = new InputSource( dtdStream );
- source.setPublicId( publicId );
- source.setSystemId( systemId );
- return source;
- }
- }
- 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 )
- {
- log.debug( "unable to locate [" + systemId + "] on classpath"
);
- }
- else
- {
- log.debug( "located [" + systemId + "] in classpath" );
- InputSource source = new InputSource( stream );
- source.setPublicId( publicId );
- source.setSystemId( systemId );
- return source;
- }
- }
- }
- // use default behavior
- return null;
- }
+ public InputSource resolveEntity(String publicId, String systemId)
+ {
+ if (systemId != null) {
+ log.debug("trying to resolve system-id [" + systemId +
"]");
+ 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) {
+ log.warn("unable to locate [" + systemId + "] on
classpath");
+ } else {
+ log.debug("located [" + systemId + "] in
classpath");
+ InputSource source = new InputSource(dtdStream);
+ source.setPublicId(publicId);
+ source.setSystemId(systemId);
+ return source;
+ }
+ } 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) {
+ log.warn("unable to locate [" + systemId + "] on
classpath");
+ } else {
+ log.debug("located [" + systemId + "] in
classpath");
+ InputSource source = new InputSource(stream);
+ source.setPublicId(publicId);
+ source.setSystemId(systemId);
+ return source;
+ }
+ }
+ }
+ // use default behavior
+ 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, ServletLifecycle.getServletContext() );
- }
- catch (Throwable t)
- {
- return null;
- }
- }
+ protected InputStream resolveInLocalNamespace(String path)
+ {
+ try {
+ return Resources.getResourceAsStream(path,
ServletLifecycle.getServletContext());
+ } catch (Throwable t) {
+ return null;
+ }
+ }
}
Show replies by date