forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r390198 - /forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java
Date Thu, 30 Mar 2006 18:05:17 GMT
Author: thorsten
Date: Thu Mar 30 10:05:15 2006
New Revision: 390198

URL: http://svn.apache.org/viewcvs?rev=390198&view=rev
Log:
Testing whether the source exists rather to throw an exception. One should not throw/catch
exception that are predictable.

Modified:
    forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java

Modified: forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java
URL: http://svn.apache.org/viewcvs/forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java?rev=390198&r1=390197&r2=390198&view=diff
==============================================================================
--- forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java (original)
+++ forrest/trunk/main/java/org/apache/forrest/sourcetype/SourceTypeAction.java Thu Mar 30
10:05:15 2006
@@ -61,10 +61,10 @@
             throw new Exception("SourceTypeAction: src attribute should be defined and non-empty.");
         Source source = sourceResolver.resolveURI(src);
         XMLPullParser parser = new Xerces2();
-        try {
-          InputStream is = source.getInputStream();
-          parser.setInputSource(new XMLInputSource(null, src, null, is, null));
-        } catch (SourceNotFoundException e) {
+        if (source.exists()) {
+            InputStream is = source.getInputStream();
+            parser.setInputSource(new XMLInputSource(null, src, null, is, null));
+        } else {
           getLogger().warn("Source '"+source+"' not found");
           return null;
         }



Mime
View raw message