[prev in list] [next in list] [prev in thread] [next in thread] 

List:       velocity-dev
Subject:    [PATCH] Less messages from ContentResource
From:       Ilkka Priha <ipriha () surfeu ! fi>
Date:       2002-09-20 7:16:19
[Download RAW message or body]

Hello

The #include directive generates some unnecessary noice when searching 
for content via several resource loaders (unlike #parse). The source 
seems to be org.apache.velocity.runtime.resource.ContentResource.java 
not catching ResourceNotFoundExceptions.

-- Ilkka


--- ContentResource.old	Fri Sep 20 09:53:33 2002
+++ ContentResource.new	Fri Sep 20 09:57:34 2002
@@ -58,6 +58,8 @@
  import java.io.BufferedReader;
  import java.io.InputStreamReader;

+import org.apache.velocity.exception.ResourceNotFoundException;
+
  /**
   * This class represent a general text resource that
   * may have been retrieved from any number of possible
@@ -94,6 +96,11 @@

              return true;
          }
+        catch ( ResourceNotFounException e )
+        {
+            // Don't report as some other resource loader may find it.
+            return false;
+        }
          catch ( Exception e )
          {
              rsvc.error("Cannot process content resource : " + 
e.toString() );




--
To unsubscribe, e-mail:   <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-dev-help@jakarta.apache.org>

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic