Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#2 Exception in P6Util.loadProperties()

open
nobody
None
5
2013-10-12
2002-11-12
Adriano Labate
No

When spy.properties is not found, I receive the
following message (version 1.0 beta):

Warning: Can't find spy.properties, java.class.path
= <...my class path...>
Exception in thread "main"
java.lang.ExceptionInInitializerError:
java.lang.NullPointerException
at
com.p6spy.engine.common.P6Util.loadProperties
(P6Util.java:238)
at
com.p6spy.engine.common.P6SpyOptions.setValues
(P6SpyOptions.java:489)

etc...

At line 212 of P6Util.java, BufferedReader reader is
initialized to null.
Then at line 238, there's reader.close() and that
throws a NullPointerException !!

You have to test (lines 238 and 239):

if (reader != null) reader.close();
if (in != null) in.close();

or catch Exception instead of only IOException.

Best regards,
Adriano Labate

Discussion