Details
-
Type: Improvement
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 1.8.2
-
Fix Version/s: EE-1.8.2.GA_P03, 2.1-Beta, 3.0, EE-2.0.0.GA_P01
-
Component/s: ICE-Components
-
Labels:None
-
Environment:Ubuntu, Tomcat 6.0.18, Spring, Icefaces 1.8.2
-
Assignee Priority:P1
-
Affects:Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration
Description
The method DataExporter.encodeParentAndChildrenAsString(FacesContext fc, UIComponent uic) indirectly calls the toString method of a value instead of using a converter.
The problem is situated at this line: str.append(value).
Current implementation:
private String encodeParentAndChildrenAsString(FacesContext fc,
UIComponent uic) {
StringBuffer str = new StringBuffer();
Object value = uic.getAttributes().get("value");
if (value != null)
str.append(value);
else {
ValueBinding vb = uic.getValueBinding("value");
if (vb != null)
str.append(vb.getValue(fc));
}
if (uic.getChildCount() > 0) {
Iterator iter = uic.getChildren().iterator();
while (iter.hasNext()) {
UIComponent child = (UIComponent) iter.next();
str.append(encodeParentAndChildrenAsString(fc, child));
}
}
return str.toString();
}
I think that it would be necessary to change this method with an implementation like this:
private String encodeParentAndChildrenAsString(FacesContext fc,
UIComponent uic) {
StringBuffer str = new StringBuffer();
Object value = uic.getAttributes().get("value");
if (value != null) {
Converter converter = null;
if(uic instanceof UIOutput) {
converter = ((UIOutput)uic).getConverter();
}
if(converter == null) {
converter = FacesContext.getCurrentInstance().getApplication().createConverter(value.getClass());
}
if(converter != null) {
str.append(converter.getAsString(FacesContext.getCurrentInstance(), uic, value));
} else {
str.append(value);
}
}
else {
ValueBinding vb = uic.getValueBinding("value");
if (vb != null)
str.append(vb.getValue(fc));
}
if (uic.getChildCount() > 0) {
Iterator iter = uic.getChildren().iterator();
while (iter.hasNext()) {
UIComponent child = (UIComponent) iter.next();
str.append(encodeParentAndChildrenAsString(fc, child));
}
}
return str.toString();
}
The problem is situated at this line: str.append(value).
Current implementation:
private String encodeParentAndChildrenAsString(FacesContext fc,
UIComponent uic) {
StringBuffer str = new StringBuffer();
Object value = uic.getAttributes().get("value");
if (value != null)
str.append(value);
else {
ValueBinding vb = uic.getValueBinding("value");
if (vb != null)
str.append(vb.getValue(fc));
}
if (uic.getChildCount() > 0) {
Iterator iter = uic.getChildren().iterator();
while (iter.hasNext()) {
UIComponent child = (UIComponent) iter.next();
str.append(encodeParentAndChildrenAsString(fc, child));
}
}
return str.toString();
}
I think that it would be necessary to change this method with an implementation like this:
private String encodeParentAndChildrenAsString(FacesContext fc,
UIComponent uic) {
StringBuffer str = new StringBuffer();
Object value = uic.getAttributes().get("value");
if (value != null) {
Converter converter = null;
if(uic instanceof UIOutput) {
converter = ((UIOutput)uic).getConverter();
}
if(converter == null) {
converter = FacesContext.getCurrentInstance().getApplication().createConverter(value.getClass());
}
if(converter != null) {
str.append(converter.getAsString(FacesContext.getCurrentInstance(), uic, value));
} else {
str.append(value);
}
}
else {
ValueBinding vb = uic.getValueBinding("value");
if (vb != null)
str.append(vb.getValue(fc));
}
if (uic.getChildCount() > 0) {
Iterator iter = uic.getChildren().iterator();
while (iter.hasNext()) {
UIComponent child = (UIComponent) iter.next();
str.append(encodeParentAndChildrenAsString(fc, child));
}
}
return str.toString();
}
Issue Links
- duplicates
-
ICE-5043 Have the dataExporter use the converted value for the table cell values
- Closed
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
Christophe Rodriguez
created issue -
Christophe Rodriguez
made changes -
Ken Fyten
made changes -
Issue Type | Bug [ 1 ] | Improvement [ 4 ] |
Salesforce Case | [] | |
Fix Version/s | 1.8.2-EE-GA_P03 [ 10251 ] |
Ken Fyten
made changes -
Salesforce Case | [] | |
Fix Version/s | 2.0.2 [ 10273 ] | |
Fix Version/s | 2.1 [ 10241 ] | |
Affects | [Documentation (User Guide, Ref. Guide, etc.), Compatibility/Configuration] | |
Assignee Priority | P2 | |
Assignee | Adnan Durrani [ adnan.durrani ] |
Ken Fyten
made changes -
Salesforce Case | [] | |
Fix Version/s | EE-2.0.0.GA_P01 [ 10271 ] | |
Fix Version/s | 2.0.2 [ 10273 ] |
Ken Fyten
made changes -
Assignee Priority | P2 | P1 |
Adnan Durrani
made changes -
Status | Open [ 1 ] | In Progress [ 3 ] |
Adnan Durrani
made changes -
Status | In Progress [ 3 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] |
Ken Fyten
made changes -
Fix Version/s | 2.1-Beta [ 10291 ] | |
Fix Version/s | 2.1 [ 10241 ] |
Ken Fyten
made changes -
Fix Version/s | 3.0 [ 10241 ] |
Ken Fyten
made changes -
Status | Resolved [ 5 ] | Closed [ 6 ] |