Changeset 4544


Ignore:
Timestamp:
Feb 13, 2014, 1:58:44 PM (10 years ago)
Author:
Fredrik Levander
Message:

Refs #823. Avoiding null pointer exception if connection properties file missing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/api/core/src/org/proteios/ConnectionPropertiesFile.java

    r4542 r4544  
    3030import java.io.IOException;
    3131import java.io.InputStream;
     32import java.net.URL;
    3233import java.util.Properties;
    3334
     
    4849    try
    4950    {
    50       InputStream is = ConnectionPropertiesFile.class.getResource(
    51         "/connection.properties").openStream();
    52       super.load(is);
     51      // Will return null if file does not exist
     52      URL url = ConnectionPropertiesFile.class.getResource(
     53          "/connection.properties");
     54      if (url!=null)
     55      {
     56        InputStream is = url.openStream();
     57        super.load(is);
     58      }
    5359    }
    5460    catch (IOException e)
Note: See TracChangeset for help on using the changeset viewer.