You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Wido Hillmann <wi...@epost.de> on 2002/01/23 11:32:04 UTC

Proposal: ResourceNotFoundException on FileResourceLoader

I know its a hack, but so it would be easier for the user to remember
the velocity rules, because who remembers always that:

 file.vm
./file.vm
 /file.vm
 
would try to load file.vm on the same place.

ResourceManager.java
Line 436:     if (resource.getData() == null)
                {
                    if (-1 !=
resourceLoader.getClassName().indexOf("FileResourceLoader"))
                    {
                    //tell the user that we always start from the
TemplateRootPath
                    throw new ResourceNotFoundException(
                        "Unable to find resource <TemplateRootPath>'" +
resourceName + "'");
                    }
                    else
                    throw new ResourceNotFoundException(
                        "Unable to find resource '" + resourceName +
"'");
                }

-wido

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Proposal: ResourceNotFoundException on FileResourceLoader

Posted by Wido Hillmann <wi...@epost.de>.
Because the <TemplateRootPath> var applys only to file and jar loaders,
and for now i have no experience with jar loaders. Maybe someone know if
this makes also sense to jar loaders.

-wido

Carsten Burghardt wrote:
> 
> On Wednesday 23 January 2002 11:32, you wrote:
> > I know its a hack, but so it would be easier for the user to remember
> > the velocity rules, because who remembers always that:
> 
> That's really a hack ;-)
> Why not print the resource-loader that is used together with the exception?
> 
> >  file.vm
> > ./file.vm
> >  /file.vm
> >
> > would try to load file.vm on the same place.
> >
> > ResourceManager.java
> > Line 436:     if (resource.getData() == null)
> >                 {
> >                     if (-1 !=
> > resourceLoader.getClassName().indexOf("FileResourceLoader"))
> >                     {
> >                     //tell the user that we always start from the
> > TemplateRootPath
> >                     throw new ResourceNotFoundException(
> >                         "Unable to find resource <TemplateRootPath>'" +
> > resourceName + "'");
> >                     }
> >                     else
> >                     throw new ResourceNotFoundException(
> >                         "Unable to find resource '" + resourceName +
> > "'");
> >                 }
> >
> > -wido
> --
> Carsten Burghardt
> email: cb@magic-shop.de
> WWW: http://www.magic-shop.de
> PGP: http://www.magic-shop.de/Carsten_Burghardt.asc
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Proposal: ResourceNotFoundException on FileResourceLoader

Posted by Carsten Burghardt <cb...@magic-shop.de>.
On Wednesday 23 January 2002 11:32, you wrote:
> I know its a hack, but so it would be easier for the user to remember
> the velocity rules, because who remembers always that:

That's really a hack ;-)
Why not print the resource-loader that is used together with the exception?

>  file.vm
> ./file.vm
>  /file.vm
>
> would try to load file.vm on the same place.
>
> ResourceManager.java
> Line 436:     if (resource.getData() == null)
>                 {
>                     if (-1 !=
> resourceLoader.getClassName().indexOf("FileResourceLoader"))
>                     {
>                     //tell the user that we always start from the
> TemplateRootPath
>                     throw new ResourceNotFoundException(
>                         "Unable to find resource <TemplateRootPath>'" +
> resourceName + "'");
>                     }
>                     else
>                     throw new ResourceNotFoundException(
>                         "Unable to find resource '" + resourceName +
> "'");
>                 }
>
> -wido
-- 
Carsten Burghardt
email: cb@magic-shop.de
WWW: http://www.magic-shop.de
PGP: http://www.magic-shop.de/Carsten_Burghardt.asc


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>