Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-1478

AbstractChartParam.java throws InvalidArgumentException when date contains more than 1 colon.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • Major
    • None
    • None
    • Chart
    • AbstractChartParam InvalidArgumentException Date colon
    • Low
    • N/A
    • N/A

    Description

      I should be able to create a chart with x-axis data points at each minute of the day. Instead an exception is thrown:

      Charting exception: Error number 0 in 5: You are attempting to add an observation for the time period 11-February-2001 but the series already contains an observation for that time period. Duplicates are not permitted.

      See: http://sandbox.xwiki.org/xwiki/bin/view/Main/ChartTest

      The exception is thrown because String[] split = args[i].split(":") results in split.length != 2 in AbstractChartParam.java

      My ugly fix was to replace:
      if (split.length != 2)

      { throw new InvalidArgumentException("Invalid value for the parameter " +getName()+": " + "name" + MAP_ASSIGNMENT + "value \"" + MAP_SEPARATOR + "\"-separated list expected"); }

      result.put(split[0].trim(), split[1].trim());
      with:
      if (split.length != 2 && !args[i].startsWith("pattern") && !args[i].startsWith("value"))

      { throw new InvalidArgumentException("Invalid value for the parameter " +getName()+": " + "name" + MAP_ASSIGNMENT + "value \"" + MAP_SEPARATOR + "\"-separated list expected"); }

      if (args[i].startsWith("pattern") || args[i].startsWith("value"))
      result.put(split[0].trim(), args[i].substring(args[i].indexOf(MAP_ASSIGNMENT)+1));
      else
      result.put(split[0].trim(), split[1].trim());

      This required jcommon-1.0.10.jar and jfreechart-1.0.6.jar

      There must be a better way.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            cardenizen Dennis Carroll
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: