ICEfaces
  1. ICEfaces
  2. ICE-5051

DataExporter doesn't use Converters to export data

    Details

    • 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();
          }

        Issue Links

          Activity

          Christophe Rodriguez created issue -
          Christophe Rodriguez made changes -
          Field Original Value New Value
          Link This issue duplicates ICE-5043 [ ICE-5043 ]
          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 ]

            People

            • Assignee:
              Adnan Durrani
              Reporter:
              Christophe Rodriguez
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: