JETTY-1465 NPE in ContextHandler.toString

This commit is contained in:
Jan Bartel 2011-12-21 12:57:33 +11:00
parent a606529710
commit 2028bbb444
1 changed files with 9 additions and 6 deletions

View File

@ -1381,14 +1381,17 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
StringBuilder b = new StringBuilder();
String p = getClass().getPackage().getName();
if (p != null && p.length() > 0)
Package pkg = getClass().getPackage();
if (pkg != null)
{
String[] ss = p.split("\\.");
for (String s : ss)
b.append(s.charAt(0)).append('.');
String p = pkg.getName();
if (p != null && p.length() > 0)
{
String[] ss = p.split("\\.");
for (String s : ss)
b.append(s.charAt(0)).append('.');
}
}
b.append(getClass().getSimpleName());
b.append('{').append(getContextPath()).append(',').append(getBaseResource());