ICEfaces
  1. ICEfaces
  2. ICE-4304

Bug in outputChart if paintArray was previously defined

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8RC2
    • Fix Version/s: 1.8
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      -

      Description

      A customer has reported the following issue with the outputChart component. If you have 2 datasets and then add a third (through a button click), a validation error will occur. I was not able to reproduce the issue in my test case but the customer has supplied us with the following description and proposed solution:

      The problem below is that if paintArray has been calculated previously and now a data change causes the count to change then returning the previous paintArray will result in a validation error hence it is necessary to add additional rows if more data than before is being displayed or use a subset of previous paints if less data is displayed.

      This bug only occur if outputChart.getColors() is null and paintArray was previously defined and stored in the openChart component object between 2 requests. In that case if the number of datasets increases, you have enough entries in paint array..
       
      i.e:
      if (obj == null && paintArray == null) {
      return paintArray = TestDataGenerator.getRandomPaints(count);
      } else if (obj == null && paintArray != null) {

      .... This condition

      You will see that in this condition you are returning the existing paint array. But the problem is you actually need to generate the additional paints and return that or only return a subset since the number of paints you return here has to match the data.
      I don't know if the other bugs i've generated recently (components losing state) are related to why you're not seeing issue.
      But following code flow you can probably see that there is a bug if paintArray state is maintained between requests.
       
      I had observed this but in DR2 and I can't confirm if it works or not in RC1 or 2 because of previous reported issues.
       
      The fix for this condition is:
       
              //garpinc fix if last paintArray is too small or if there is more in paint array
               //than is required for count
               if (paintArray.length < count) {
                return paintArray = TestDataGenerator.getRandomPaints(count);
               } else {
                Paint[] subsetOfPaints = new Paint[count];
                System.arraycopy(paintArray, 0, subsetOfPaints, 0, count);
                return subsetOfPaints;
               }

        Activity

        Hide
        Adnan Durrani added a comment -

        Changes made to use the cache data only when there isn't any dynamic change.

        If any of the following attribute being changed dynamically then all has to have a corrosponding values:

        • data
        • colors
        • labels

        Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AbstractChart.java
        Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AxisChart.java
        Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AbstractChart.java
        Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AxisChart.java
        Completed: At revision: 18706

        Show
        Adnan Durrani added a comment - Changes made to use the cache data only when there isn't any dynamic change. If any of the following attribute being changed dynamically then all has to have a corrosponding values: data colors labels Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AbstractChart.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AxisChart.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AbstractChart.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputchart\AxisChart.java Completed: At revision: 18706

          People

          • Assignee:
            Unassigned
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: