Skip to content

Commit

Permalink
added an NPE fix for #579
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Oct 31, 2013
1 parent 73f1734 commit 6912693
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions hawtio-embedded/src/main/java/io/hawt/embedded/Main.java
Expand Up @@ -125,24 +125,26 @@ public void run(boolean join) throws Exception {
protected String findWar(String... paths) {
if (paths != null) {
for (String path : paths) {
File file = new File(path);
if (file.exists()) {
if (file.isFile()) {
String name = file.getName();
if (isWarFileName(name)) {
return file.getPath();
if (path != null) {
File file = new File(path);
if (file.exists()) {
if (file.isFile()) {
String name = file.getName();
if (isWarFileName(name)) {
return file.getPath();
}
}
}
if (file.isDirectory()) {
// lets look for a war in this directory
File[] wars = file.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return isWarFileName(name);
if (file.isDirectory()) {
// lets look for a war in this directory
File[] wars = file.listFiles(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return isWarFileName(name);
}
});
if (wars != null && wars.length > 0) {
return wars[0].getPath();
}
});
if (wars != null && wars.length > 0) {
return wars[0].getPath();
}
}
}
Expand Down

0 comments on commit 6912693

Please sign in to comment.