Author: dan.j.allen
Date: 2010-04-02 16:53:40 -0400 (Fri, 02 Apr 2010)
New Revision: 12374
Modified:
modules/xml/trunk/core/src/main/java/org/jboss/seam/xml/bootstrap/ClassPathXmlDocumentProvider.java
Log:
use context class loader to load resource
don't break iterator on first empty file, rather continue
Modified:
modules/xml/trunk/core/src/main/java/org/jboss/seam/xml/bootstrap/ClassPathXmlDocumentProvider.java
===================================================================
---
modules/xml/trunk/core/src/main/java/org/jboss/seam/xml/bootstrap/ClassPathXmlDocumentProvider.java 2010-04-02
17:57:34 UTC (rev 12373)
+++
modules/xml/trunk/core/src/main/java/org/jboss/seam/xml/bootstrap/ClassPathXmlDocumentProvider.java 2010-04-02
20:53:40 UTC (rev 12374)
@@ -27,7 +27,7 @@
public class ClassPathXmlDocumentProvider implements XmlDocumentProvider
{
- static final String[] DEFAULT_RESOURCES = { "seam-beans.xml",
"META-INF/seam-beans.xml", "WEB-INF/seam-beans.xml" ,
"META-INF/beans.xml", "WEB-INF/beans.xml"};
+ static final String[] DEFAULT_RESOURCES = { "seam-beans.xml",
"META-INF/seam-beans.xml", "META-INF/beans.xml"};
final String[] resources;
@@ -52,7 +52,6 @@
public void open()
{
-
factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
factory.setIgnoringComments(true);
@@ -66,11 +65,16 @@
throw new RuntimeException(e1);
}
docs = new ArrayList<URL>();
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ {
+ cl = getClass().getClassLoader();
+ }
for (String i : resources)
{
try
{
- Enumeration<URL> e = getClass().getClassLoader().getResources(i);
+ Enumeration<URL> e = cl.getResources(i);
while (e.hasMoreElements())
{
docs.add(e.nextElement());
@@ -126,7 +130,7 @@
test = url.openStream();
if(test.available() == 0)
{
- break;
+ continue;
}
}
finally
Show replies by date