mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-10-29 11:47:01 +00:00
Avoid NPE on getResourceAsStream() calls
When the resource i.g. properties file is not available the getResourceAsStream() returns null and this cuauses unhandled NPE.
This commit is contained in:
parent
5349f7b519
commit
9c888f4fef
@ -40,7 +40,9 @@ public class ConfigurationRes {
|
||||
try
|
||||
{
|
||||
InputStream resourceAsStream = cl.getResourceAsStream( "configuration.properties" );
|
||||
prb.load( resourceAsStream );
|
||||
if (resourceAsStream != null) {
|
||||
prb.load( resourceAsStream );
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
||||
@ -155,7 +155,9 @@ public class Default {
|
||||
try
|
||||
{
|
||||
InputStream resourceAsStream = cl.getResourceAsStream( "default.properties" );
|
||||
prb.load( resourceAsStream );
|
||||
if (resourceAsStream != null) {
|
||||
prb.load( resourceAsStream );
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
||||
@ -37,7 +37,9 @@ public class SoundsRes {
|
||||
try
|
||||
{
|
||||
InputStream resourceAsStream = cl.getResourceAsStream( "sounds.properties" );
|
||||
prb.load( resourceAsStream );
|
||||
if (resourceAsStream != null) {
|
||||
prb.load( resourceAsStream );
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
||||
@ -338,7 +338,9 @@ public class SparkRes {
|
||||
prb = new Properties();
|
||||
try {
|
||||
InputStream resourceAsStream = cl.getResourceAsStream("spark.properties");
|
||||
prb.load(resourceAsStream);
|
||||
if (resourceAsStream != null) {
|
||||
prb.load(resourceAsStream);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user