Java Mailing List Archive

http://www.ant-tasks.com/

Apache Ant Archive

» Ant Users List
» Ant Developers List
ANT task to process properties-files into static class

ANT task to process properties-files into static class

2007-01-02       - By Scot P. Floess
Reply:     1     2     3     4     5     6     7     8     9     10     >>  

If a property does not exist, why is a null pointer thrown?  I assume
you mean java.util.Properties?  If so, that does not raise a null
pointer exception.

Rapthor wrote:
> Hi,
>
> I think this problem is very interesting. I have a web application that
> needs various configuration. I'm using a properties file that is loaded into
> a Properties-class.
>
> The problem arrises when runtime exceptions are thrown
> (NullPointerException) by using:
>
> String value = props.getProperty("myProp");
>
> (In this case the entry "myProp" is not available.)
>
> The solution would be to process the properties file and put all keys and
> values into a class with public static attributes:
>
> class Props {
> public static String myProp = "123";
> .....
> }
>
> This processing should be done with ANT! It shall create a JAVA file before
> the general compilation task. This would be great and runtime exceptions
> concerning a lack of propertie-keys are extinguished forever.
>
> Is there any tool for ANT that helps?
>
> Thanks in advance.
>  

--
Scot P. Floess
27 Lake Royale
Louisburg, NC  27549

252-478-8087 (Home)
919-754-4592 (Work)

Chief Architect JPlate  http://sourceforge.net/projects/jplate
Chief Architect JavaPIM http://sourceforge.net/projects/javapim


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


©2008 ant-tasks.com - Jax Systems, LLC, U.S.A.