struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lukasz Lenart <lukaszlen...@apache.org>
Subject Re: Diagnosing problem loading "theme.properties" on JBoss 7 with Struts 2.3.16
Date Sun, 15 Dec 2013 12:21:59 GMT
Hi,

I see the problem,

BaseTemplateEngine#getThemeProps(Template template) doesn't use
ServletContext to resolve possible paths where theme.properties can be
found.

The solution is easy - move theme.properties under classpath and the
reset can lay where it is right now. The second option is to modify
BaseTemplateEngine to use also ServletContext (or somehow tell
BaseTemplateEngine to use ServletContext)


Regards
-- 
Ɓukasz
+ 48 606 323 122 http://www.lenart.org.pl/

2013/12/12 rgm <struts@rgm.nu>:
> I'm trying to figure out why "theme.properties" isn't loaded from the
> filesystem on my JBoss 7 system and believe that this is a useful change to
> BaseTemplateEngine.java:
>
>     private InputStream createFileInputStream(File propFile) throws
> FileNotFoundException {
>         InputStream is = null;
>         if (propFile.exists()) {
>             is = new FileInputStream(propFile);
> +        } else {
> +          throw new FileNotFoundException(propFile.toString());
> +        }
>         return is;
>     }
>
> This change allows the following message to be seen from the calling method:
>   LOG.warn("Unable to find file in filesystem [" +
> propFile.getAbsolutePath() + "]");
>
> Without this change, no warning is printed (unless there's a problem
> creating the FileInputStream).
>
> Alternately, one could remove the check for "propFile.exists()" entirely
> and allow the constructor for FileInputStream to throw the exception itself.
>
> -rgm

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message