Skip to content

Commit

Permalink
feat(fabric8io#1382): Adds NPE check and throw an exception in case o…
Browse files Browse the repository at this point in the history
…f error
  • Loading branch information
lordofthejars committed Oct 2, 2018
1 parent 8e0a22c commit 5509b99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public String[] getFilenamesAsArray() {
}

public boolean isValid() {
return kind != null && filenameTypes.length() > 0;
return kind != null && filenameTypes != null && filenameTypes.length() > 0;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,9 @@ private void updateKindFilenameMappings() {
for(MappingConfig mappingConfig : this.mappings) {
if (mappingConfig.isValid()) {
mappingKindFilename.put(mappingConfig.getKind(), Arrays.asList(mappingConfig.getFilenamesAsArray()));
} else {
throw new IllegalArgumentException(String.format("Invalid mapping for Kind %s and Filename Types %s",
mappingConfig.getKind(), mappingConfig.getFilenameTypes()));
}
}
KubernetesResourceUtil.updateKindFilenameMapper(mappingKindFilename);
Expand Down

0 comments on commit 5509b99

Please sign in to comment.