Skip to content

Commit 7f64b48

Browse files
committed
1 parent 178e7c2 commit 7f64b48

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

src/main/java/org/primefaces/behavior/base/AbstractBehaviorHandler.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,16 @@ public void apply(FaceletContext faceletContext, UIComponent parent) throws IOEx
8888
}
8989

9090
boolean supportedEvent = false;
91-
for (int i = 0; i < targetList.size(); i++) {
92-
AttachedObjectTarget target = targetList.get(i);
93-
if (target instanceof BehaviorHolderAttachedObjectTarget) {
94-
BehaviorHolderAttachedObjectTarget behaviorTarget = (BehaviorHolderAttachedObjectTarget) target;
95-
if ((null != eventName && eventName.equals(behaviorTarget.getName()))
96-
|| (null == eventName && behaviorTarget.isDefaultEvent())) {
97-
supportedEvent = true;
98-
break;
91+
if (targetList != null) {
92+
for (int i = 0; i < targetList.size(); i++) {
93+
AttachedObjectTarget target = targetList.get(i);
94+
if (target instanceof BehaviorHolderAttachedObjectTarget) {
95+
BehaviorHolderAttachedObjectTarget behaviorTarget = (BehaviorHolderAttachedObjectTarget) target;
96+
if ((null != eventName && eventName.equals(behaviorTarget.getName()))
97+
|| (null == eventName && behaviorTarget.isDefaultEvent())) {
98+
supportedEvent = true;
99+
break;
100+
}
99101
}
100102
}
101103
}

src/main/java/org/primefaces/component/autocomplete/AutoCompleteRenderer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ protected void encodeHiddenSelect(FacesContext context, AutoComplete ac, String
299299
writer.writeAttribute("disabled", "disabled", "disabled");
300300
}
301301

302-
for (String value : values) {
302+
for (int i = 0; i < values.size(); i++) {
303+
String value = values.get(i);
303304
writer.startElement("option", null);
304305
writer.writeAttribute("value", value, null);
305306
writer.writeAttribute("selected", "selected", null);

src/main/java/org/primefaces/util/CompositeUtils.java

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -43,34 +43,37 @@ public static void invokeOnDeepestEditableValueHolder(FacesContext context, UICo
4343
List<AttachedObjectTarget> targets = (List<AttachedObjectTarget>) info.getBeanDescriptor()
4444
.getValue(AttachedObjectTarget.ATTACHED_OBJECT_TARGETS_KEY);
4545

46-
for (AttachedObjectTarget target : targets) {
47-
if (target instanceof EditableValueHolderAttachedObjectTarget) {
46+
if (targets != null) {
47+
for (int i = 0; i < targets.size(); i++) {
48+
AttachedObjectTarget target = targets.get(i);
49+
if (target instanceof EditableValueHolderAttachedObjectTarget) {
4850

49-
List<UIComponent> childs = target.getTargets(composite);
50-
if (childs == null || childs.isEmpty()) {
51-
throw new FacesException(
52-
"Cannot not resolve editableValueHolder target in composite component with id: \""
53-
+ composite.getClientId() + "\"");
54-
}
51+
List<UIComponent> childs = target.getTargets(composite);
52+
if (childs == null || childs.isEmpty()) {
53+
throw new FacesException(
54+
"Cannot not resolve editableValueHolder target in composite component with id: \""
55+
+ composite.getClientId() + "\"");
56+
}
5557

56-
if (childs.size() > 1) {
57-
throw new FacesException(
58-
"Only a single editableValueHolder target is supported in composite component with id: \""
59-
+ composite.getClientId() + "\"");
60-
}
58+
if (childs.size() > 1) {
59+
throw new FacesException(
60+
"Only a single editableValueHolder target is supported in composite component with id: \""
61+
+ composite.getClientId() + "\"");
62+
}
6163

62-
final UIComponent child = childs.get(0);
64+
final UIComponent child = childs.get(0);
6365

64-
composite.invokeOnComponent(context, composite.getClientId(context), new ContextCallback() {
65-
public void invokeContextCallback(FacesContext context, UIComponent target) {
66-
if (isComposite(child)) {
67-
invokeOnDeepestEditableValueHolder(context, child, callback);
66+
composite.invokeOnComponent(context, composite.getClientId(context), new ContextCallback() {
67+
public void invokeContextCallback(FacesContext context, UIComponent target) {
68+
if (isComposite(child)) {
69+
invokeOnDeepestEditableValueHolder(context, child, callback);
70+
}
71+
else {
72+
callback.invokeContextCallback(context, child);
73+
}
6874
}
69-
else {
70-
callback.invokeContextCallback(context, child);
71-
}
72-
}
73-
});
75+
});
76+
}
7477
}
7578
}
7679
}

0 commit comments

Comments
 (0)