You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Daniel Rall <dl...@finemaltcoding.com> on 2002/10/10 19:57:48 UTC
Re: [PATCH] Less messages from ContentResource
Ilkka Priha <ip...@surfeu.fi> writes:
> 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, I committed the following:
dlr 2002/10/10 10:53:33
Modified: src/java/org/apache/velocity/runtime/resource
ContentResource.java
Log:
Changed spurred by Ilkka Priha's <ip...@surfeu.fi> patch for "Less
messages from ContentResource":
"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 suggested returning false (which is valid), but re-throwing the
ResourceNotFoundException is more in line with what the Template class
does.
Revision Changes Path
1.10 +16 -2 jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ContentResource.java
Index: ContentResource.java
===================================================================
RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ContentResource.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- ContentResource.java 10 Oct 2002 17:28:09 -0000 1.9
+++ ContentResource.java 10 Oct 2002 17:53:33 -0000 1.10
@@ -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 sources.
@@ -76,8 +78,14 @@
{
}
- /** Pull in static content and store it */
+ /**
+ * Pull in static content and store it.
+ *
+ * @exception ResourceNotFoundException Resource could not be
+ * found.
+ */
public boolean process()
+ throws ResourceNotFoundException
{
BufferedReader reader = null;
@@ -98,6 +106,12 @@
setData(sw.toString());
return true;
+ }
+ catch ( ResourceNotFoundException e )
+ {
+ // Tell the ContentManager to continue to look through any
+ // remaining configured ResourceLoaders.
+ throw e;
}
catch ( Exception e )
{
--
Daniel Rall <dl...@finemaltcoding.com>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [PATCH] Less messages from ContentResource
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Ilkka Priha <ip...@surfeu.fi> writes:
> Dan,
>
> This is better, thanks :-)
You're welcome, thanks for the patch! I'd actually been wondering
about those error messages myself, but hadn't had a chance to
investigate. Your patch gave me a great excuse. ;-)
--
Daniel Rall <dl...@finemaltcoding.com>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: [PATCH] Less messages from ContentResource
Posted by Ilkka Priha <ip...@surfeu.fi>.
Dan,
This is better, thanks :-)
-- Ilkka
Daniel Rall wrote:
> Ilkka Priha <ip...@surfeu.fi> writes:
>
>
>>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, I committed the following:
>
>
> dlr 2002/10/10 10:53:33
>
> Modified: src/java/org/apache/velocity/runtime/resource
> ContentResource.java
> Log:
> Changed spurred by Ilkka Priha's <ip...@surfeu.fi> patch for "Less
> messages from ContentResource":
>
> "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 suggested returning false (which is valid), but re-throwing the
> ResourceNotFoundException is more in line with what the Template class
> does.
>
> Revision Changes Path
> 1.10 +16 -2 jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ContentResource.java
>
> Index: ContentResource.java
> ===================================================================
> RCS file: /home/cvs/jakarta-velocity/src/java/org/apache/velocity/runtime/resource/ContentResource.java,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -u -r1.9 -r1.10
> --- ContentResource.java 10 Oct 2002 17:28:09 -0000 1.9
> +++ ContentResource.java 10 Oct 2002 17:53:33 -0000 1.10
> @@ -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 sources.
> @@ -76,8 +78,14 @@
> {
> }
>
> - /** Pull in static content and store it */
> + /**
> + * Pull in static content and store it.
> + *
> + * @exception ResourceNotFoundException Resource could not be
> + * found.
> + */
> public boolean process()
> + throws ResourceNotFoundException
> {
> BufferedReader reader = null;
>
> @@ -98,6 +106,12 @@
> setData(sw.toString());
>
> return true;
> + }
> + catch ( ResourceNotFoundException e )
> + {
> + // Tell the ContentManager to continue to look through any
> + // remaining configured ResourceLoaders.
> + throw e;
> }
> catch ( Exception e )
> {
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>