I have a properties file that is used to control specific variables within my application. All but one of the keys I am using work perfectly fine as the application has been working.
The structure of the ini file is:
JDBC_DRIVER=com.mysql.jdbc.Driver
DB_URL=localhost/tempTables
EmailList=foo@bar.com
sender=foo_bar@tempfoo.com
host=<sanitised>
port=25
USER=root
PASS=Fo0b4R
path=C:/Users/foo/Desktop/profile_admin_
logLevel=2
TimerControl=2
The specific key I am having issues with is "logLevel". This is to be read as a string (using the Properties Class) and then parsed to an int. The key "port" follows this suit fine so I'm wondering if it is the keyname, or whether there is a limit to the number of keys.
Each key is read as follows:
FileInputStream propFile = new FileInputStream("config.ini");
Properties config = new Properties(System.getProperties());
config.load(propFile);
String level = config.getProperty("logLevel");
System.out.println("Purely for testing. Key \"logLevel\" is :"+level);
int levelLogger = Integer.parseInt(level);
System.out.println("Parsed to integer, printed for integrity: "+levelLogger);
//output
Purely for testing. Key "logLevel" is : null
Exception in thread "main"
java.lang.NumberFormatException: nu;;
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at package.myClass.main(myClass.java:63)