fix #809 avoid ignored NPE

This commit is contained in:
Greg Wilkins 2016-08-05 11:46:19 +10:00
parent ee3163bad8
commit 144ac3dcea
1 changed files with 30 additions and 29 deletions

View File

@ -510,6 +510,9 @@ public class WebInfConfiguration extends AbstractConfiguration
// Set dir or WAR
resource = context.newResource(context.getWar());
}
if (resource.getURI().getPath()!=null)
{
String tmp = URIUtil.decodePath(resource.getURI().getPath());
if (tmp.endsWith("/"))
tmp = tmp.substring(0, tmp.length()-1);
@ -518,11 +521,12 @@ public class WebInfConfiguration extends AbstractConfiguration
//get just the last part which is the filename
int i = tmp.lastIndexOf("/");
canonicalName.append(tmp.substring(i+1, tmp.length()));
}
canonicalName.append("-");
}
catch (Exception e)
{
LOG.warn("Can't generate resourceBase as part of webapp tmp dir name: " + e);
LOG.warn("Can't generate resourceBase as part of webapp tmp dir name "+e);
LOG.debug(e);
}
@ -552,7 +556,4 @@ public class WebInfConfiguration extends AbstractConfiguration
return canonicalName.toString();
}
}