Author: thorsten
Date: Fri Aug 4 00:22:39 2006
New Revision: 428652
URL: http://svn.apache.org/viewvc?rev=428652&view=rev
Log:
Testing whether the source exist before processing. That will get rid of
exceptions (will not get thrown)
Modified:
forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java
Modified: forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java
URL:
http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java?rev=428652&r1=428651&r2=428652&view=diff
==============================================================================
--- forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java
(original)
+++ forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java Fri
Aug 4 00:22:39 2006
@@ -256,24 +256,26 @@
InputStream in = null;
try {
source = m_resolver.resolveURI(propertiesStringURI);
- if (debugging())
- debug("Searching for forrest.properties.xml in " +
source.getURI());
+ if (source.exists()){
+ if (debugging())
+ debug("Searching for forrest.properties.xml in " +
source.getURI());
- DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document document = builder.parse(source.getURI());
+ DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ Document document = builder.parse(source.getURI());
- NodeList nl = document.getElementsByTagName("property");
- if (nl != null && nl.getLength() > 0) {
- for (int i = 0; i < nl.getLength(); i++) {
- Element el = (Element) nl.item(i);
- filteringProperties.setProperty(el.getAttribute("name"), el
- .getAttribute("value"));
+ NodeList nl = document.getElementsByTagName("property");
+ if (nl != null && nl.getLength() > 0) {
+ for (int i = 0; i < nl.getLength(); i++) {
+ Element el = (Element) nl.item(i);
+
filteringProperties.setProperty(el.getAttribute("name"), el
+ .getAttribute("value"));
+ }
}
- }
- if (debugging())
- debug("Loaded:" + propertiesStringURI +
filteringProperties.toString());
+ if (debugging())
+ debug("Loaded:" + propertiesStringURI +
filteringProperties.toString());
+ }
} finally {
if (source != null) {