Details
- 
        Type: Improvement Improvement
- 
        Status: Closed
- 
            Priority: Major 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 ICE-5043
        Have the dataExporter use the converted value for the table cell values-           
- Closed
 
-         
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
| Issue Type | Bug [ 1 ] | Improvement [ 4 ] | 
| Salesforce Case | [] | |
| Fix Version/s | 1.8.2-EE-GA_P03 [ 10251 ] | 
| 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 ] | 
| Salesforce Case | [] | |
| Fix Version/s | EE-2.0.0.GA_P01 [ 10271 ] | |
| Fix Version/s | 2.0.2 [ 10273 ] | 
| Assignee Priority | P2 | P1 | 
| Status | Open [ 1 ] | In Progress [ 3 ] | 
| Status | In Progress [ 3 ] | Resolved [ 5 ] | 
| Resolution | Fixed [ 1 ] | 
| Fix Version/s | 2.1-Beta [ 10291 ] | |
| Fix Version/s | 2.1 [ 10241 ] | 
| Fix Version/s | 3.0 [ 10241 ] | 
| Status | Resolved [ 5 ] | Closed [ 6 ] |