Refactored the code to fix defects reported by Coverity. The list of defects below doesn't tell much if there is no access to Coverity, but the list is there just to give context on what needed fixing. The PR is still merely about refactoring the code to be more secure and clean.
Coverity defects that should be solved by this:
467201 CT: Constructor throws
456623 Dm: Dubious method used
456622 Dm: Dubious method used
456284 Dm: Dubious method used
452921 SS: Unread field should be static (not actually changing to static, but changing it to a local variable)
452920 WMI: Inefficient Map Iterator
452918 Dm: Dubious method used
As you can see, 4 of them are "Dubious method used". These were about using default charsets for example in a FileReader call. I wasn't quite sure with charset to use, but the default for me locally was UTF-8, so I went with that. This is probably going to need input from the architect whether that is correct.
Two defects are not solved, because I think solving them would introduce code that is not in the spirit of Elegant Objects or otherwise weird:
467200 PI: Do not reuse public identifiers from Java Standard Library (This one suggests not naming the Main class Main)
461131 Dereference null return value (This one suggests adding a null check to a return value from an object that is built by us, EO would say not to worry about nulls, our own code isn't supposed to return null)
NOTE:
The PR includes ConfigTests for the reason that I had to refactor the Exception throwing out of the constructor. I wanted to make sure I didn't break it in the process.
Related to #69.
Refactored the code to fix defects reported by Coverity. The list of defects below doesn't tell much if there is no access to Coverity, but the list is there just to give context on what needed fixing. The PR is still merely about refactoring the code to be more secure and clean.
Coverity defects that should be solved by this: 467201 CT: Constructor throws 456623 Dm: Dubious method used 456622 Dm: Dubious method used 456284 Dm: Dubious method used 452921 SS: Unread field should be static (not actually changing to static, but changing it to a local variable) 452920 WMI: Inefficient Map Iterator 452918 Dm: Dubious method used
As you can see, 4 of them are "Dubious method used". These were about using default charsets for example in a FileReader call. I wasn't quite sure with charset to use, but the default for me locally was UTF-8, so I went with that. This is probably going to need input from the architect whether that is correct.
Two defects are not solved, because I think solving them would introduce code that is not in the spirit of Elegant Objects or otherwise weird:
NOTE: The PR includes ConfigTests for the reason that I had to refactor the Exception throwing out of the constructor. I wanted to make sure I didn't break it in the process.