Author: vitold
Date: 2009-03-24 09:27:28 -0400 (Tue, 24 Mar 2009)
New Revision: 2180
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
Log:
minor changes
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24
12:54:58 UTC (rev 2179)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-03-24
13:27:28 UTC (rev 2180)
@@ -117,14 +117,14 @@
if (attrVal.startsWith(XmlConstants.URN_PREFIX))
{
urn = attrVal;
- URL namespaceFile = environment.loadFileByUrn(urn,
XmlConstants.NAMESPACE_FILE_NAME);
+ URL namespaceFile = loadFile(urn, XmlConstants.NAMESPACE_FILE_NAME);
if (namespaceFile == null)
throw new DefinitionException("Could not find '" +
XmlConstants.NAMESPACE_FILE_NAME + "' file according to specified URN '"
+ urn + "'");
packagesSet.addAll(parseNamespaceFile(namespaceFile));
}
if (attribute.getName().equalsIgnoreCase(XmlConstants.SCHEMA_LOCATION)
&& attrVal.startsWith(XmlConstants.HTTP_PREFIX) && urn.trim().length()
> 0)
{
- URL schemaFile = environment.loadFileByUrn(urn,
XmlConstants.SCHEMA_FILE_NAME);
+ URL schemaFile = loadFile(urn, XmlConstants.SCHEMA_FILE_NAME);
if (schemaFile == null)
throw new DefinitionException("Could not find '" +
XmlConstants.SCHEMA_FILE_NAME + "' file according to specified URN '" +
urn + "'");
}
@@ -146,7 +146,7 @@
{
Set<String> packagesSet = new HashSet<String>();
- URL namespaceFile = environment.loadFileByUrn(uri,
XmlConstants.NAMESPACE_FILE_NAME);
+ URL namespaceFile = loadFile(uri, XmlConstants.NAMESPACE_FILE_NAME);
if (namespaceFile != null)
{
packagesSet.addAll(parseNamespaceFile(namespaceFile));
@@ -241,4 +241,14 @@
packagesMap.put(prefix, packagesSet);
}
}
+
+ private static URL loadFile(String urn, String fileName)
+ {
+ char separator = '/';
+ String packageName = urn.replaceFirst(XmlConstants.URN_PREFIX, "");
+ String path = packageName.replace('.', separator);
+ String filePath = separator + path + separator + fileName;
+ URL namespaceFile = ParseXmlHelper.class.getResource(filePath);
+ return namespaceFile;
+ }
}
Show replies by date