You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2014/11/20 00:14:31 UTC
svn commit: r1640640 - in /myfaces/tobago/branches/tobago-3.0.x: ./
tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java
Author: lofwyr
Date: Wed Nov 19 23:14:30 2014
New Revision: 1640640
URL: http://svn.apache.org/r1640640
Log:
Merged from trunk
fixing NPE when there is no UITreeSelect [from revision 1640548]
Modified:
myfaces/tobago/branches/tobago-3.0.x/ (props changed)
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java
Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk:r1640548
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java?rev=1640640&r1=1640639&r2=1640640&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/TreeListboxRenderer.java Wed Nov 19 23:14:30 2014
@@ -20,6 +20,7 @@
package org.apache.myfaces.tobago.renderkit.html.standard.standard.tag;
import org.apache.myfaces.tobago.component.RendererTypes;
+import org.apache.myfaces.tobago.component.UITreeLabel;
import org.apache.myfaces.tobago.component.UITreeNode;
import org.apache.myfaces.tobago.component.UITreeSelect;
import org.apache.myfaces.tobago.internal.component.AbstractUITree;
@@ -174,11 +175,21 @@ public class TreeListboxRenderer extends
writer.writeAttribute(HtmlAttributes.SIZE, 9); // must be > 1, but the real size comes from the layout
// writer.writeAttribute(HtmlAttributes.MULTIPLE, siblingMode);
- final UITreeSelect label = ComponentUtils.findDescendant(tree, UITreeSelect.class);
- final Object labelValue = label.getLabel();
+ final UITreeSelect select = ComponentUtils.findDescendant(tree, UITreeSelect.class);
+ final String labelValue;
+ if (select != null) {
+ labelValue = select.getLabel();
+ } else {
+ final UITreeLabel label = ComponentUtils.findDescendant(tree, UITreeLabel.class);
+ if (label != null) {
+ labelValue = label.getLabel();
+ } else {
+ labelValue = null;
+ }
+ }
if (labelValue != null) {
writer.startElement(HtmlElements.OPTGROUP, tree);
- writer.writeAttribute(HtmlAttributes.LABEL, labelValue.toString(), true);
+ writer.writeAttribute(HtmlAttributes.LABEL, labelValue, true);
writer.endElement(HtmlElements.OPTGROUP);
}