Commit 7b529ef9 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Fix for NPE when nav item has no children.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9845 b35dd754-fafc-0310-a699-88a17e54d16e
parent 503387d2
...@@ -148,7 +148,6 @@ public class SubnavTag extends BodyTagSupport { ...@@ -148,7 +148,6 @@ public class SubnavTag extends BodyTagSupport {
subnav = current.getParent(); subnav = current.getParent();
} }
} }
Log.debug("\n\n\nXXXFFINDXXX\npageID = "+pageID+"\nsubPageID = "+subPageID+"\ncurrent = "+current+"\nsubcurrent = "+subcurrent+"\nsubnav = "+subnav+"\n\n\n");
Element currentTab = (Element)AdminConsole.getModel().selectSingleNode( Element currentTab = (Element)AdminConsole.getModel().selectSingleNode(
"//*[@id='" + pageID + "']/ancestor::tab"); "//*[@id='" + pageID + "']/ancestor::tab");
...@@ -160,28 +159,30 @@ public class SubnavTag extends BodyTagSupport { ...@@ -160,28 +159,30 @@ public class SubnavTag extends BodyTagSupport {
buf.append("<ul>"); buf.append("<ul>");
for (Object itemObj : items) { for (Object itemObj : items) {
Element item = (Element) itemObj; Element item = (Element) itemObj;
Element firstSubItem = (Element)item.elements().get(0); if (item.elements().size() > 0) {
String pluginName = item.attributeValue("plugin"); Element firstSubItem = (Element)item.elements().get(0);
String subitemID = item.attributeValue("id"); String pluginName = item.attributeValue("plugin");
String subitemName = item.attributeValue("name"); String subitemID = item.attributeValue("id");
String subitemURL = firstSubItem.attributeValue("url"); String subitemName = item.attributeValue("name");
String subitemDescr = item.attributeValue("description"); String subitemURL = firstSubItem.attributeValue("url");
String value = getBodyContent().getString(); String subitemDescr = item.attributeValue("description");
if (value != null) { String value = getBodyContent().getString();
value = StringUtils.replace(value, "[id]", clean(subitemID)); if (value != null) {
value = StringUtils.replace(value, "[name]", value = StringUtils.replace(value, "[id]", clean(subitemID));
clean(AdminConsole.getAdminText(subitemName, pluginName))); value = StringUtils.replace(value, "[name]",
value = StringUtils.replace(value, "[description]", clean(AdminConsole.getAdminText(subitemName, pluginName)));
clean(AdminConsole.getAdminText(subitemDescr, pluginName))); value = StringUtils.replace(value, "[description]",
value = StringUtils.replace(value, "[url]", clean(AdminConsole.getAdminText(subitemDescr, pluginName)));
request.getContextPath() + "/" + clean(subitemURL)); value = StringUtils.replace(value, "[url]",
request.getContextPath() + "/" + clean(subitemURL));
}
String css = getCss();
boolean isCurrent = subnav != null && item.equals(subnav);
if (isCurrent) {
css = getCurrentcss();
}
buf.append("<li class=\"").append(css).append("\">").append(value).append("</li>");
} }
String css = getCss();
boolean isCurrent = subnav != null && item.equals(subnav);
if (isCurrent) {
css = getCurrentcss();
}
buf.append("<li class=\"").append(css).append("\">").append(value).append("</li>");
} }
buf.append("</ul>"); buf.append("</ul>");
try { try {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment