Skip to content

Commit

Permalink
prevent NullPointerException #1612 #2290
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jan 24, 2017
1 parent ad1cc68 commit a8275f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public List<String> getDataFileTags(){
private void loadParamsFromJson(String jsonData) throws DataFileTagException{

msgt("jsonData: " + jsonData);
if (jsonData == null){
if (jsonData == null || jsonData.isEmpty()){
return;
// logger.log(Level.SEVERE, "jsonData is null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,27 @@ public void test_09_unusedParamsGood() throws DataFileTagException {
assertFalse(instance.hasFileDataTags());

}



@Test
public void test_10_emptyString() throws DataFileTagException {

msgt("test_10_emptyString");

String jsonParams = "";

OptionalFileParams instance = new OptionalFileParams(jsonParams);

assertNull(instance.getDescription());
assertFalse(instance.hasDescription());

assertNull(instance.getCategories());
assertFalse(instance.hasCategories());

assertNull(instance.getDataFileTags());
assertFalse(instance.hasFileDataTags());

}

private void msg(String s){
System.out.println(s);
}
Expand Down

0 comments on commit a8275f1

Please sign in to comment.