Menu

#2 NullPointerException in Config.getProperties

open
nobody
None
5
2011-08-05
2011-08-05
Jan Ploski
No

In com.temesoft.security.Config you have

static public final String CONFIG_FILE_CLASSPATH = "/com/temesoft/security/skewpassimage.properties";

You are using it like so:

InputStream stream = Config.class.getClassLoader().getResourceAsStream(CONFIG_FILE_CLASSPATH);
_properties.load(stream);

At least in some environments this can cause a NullPointerException (which is propagated into Encrypter's constructor, for example). When retrieving resources through a ClassLoader you shouldn't be using a leading slash (see http://stackoverflow.com/questions/1464291/how-to-really-read-text-file-from-classpath-in-java\). To fix this problem, change CONFIG_FILE_CLASSPATH to "com/temesoft/security/skewpassimage.properties",

Discussion


Log in to post a comment.

MongoDB Logo MongoDB