Well, that's a good point. In that case something like line.split(",", 2)
should be used provided we don't use thousands separator for the first
long-type field (that shouldn't happen as Long.toString method is used in
AbstractProblemStatistic.writeCsvStatisticFile to obtain the value). The
question is to what extent other, user-defined formatting, should be
supported.


2014/1/6 Geoffrey De Smet <notifications@github.com>

> In
> optaplanner-benchmark/src/main/java/org/optaplanner/benchmark/impl/statistic/bestscore/BestScoreProblemStatistic.java:
>
> > @@ -67,6 +72,31 @@ public SingleStatistic createSingleStatistic() {
> >          return graphFilePathList;
> >      }
> >
> > +    public SingleStatistic readSingleStatistic(File file, ScoreDefinition scoreDefinition) {
> > +        List<BestScoreSingleStatisticPoint> pointList = new ArrayList<BestScoreSingleStatisticPoint>
> ();
> > +        try {
> > +            BufferedReader br = new BufferedReader(new FileReader(file));
> > +            String pattern = "\\d+,\"\\S+\"";
> > +            for (String line = br.readLine(); line != null; line = br.readLine()) {
> > +                if (!line.matches(pattern)) {
> > +                    throw new IllegalArgumentException("Error while reading statistic file - invalid format "
> > +                            + "for line " + line + ".");
> > +                }
> > +                String[] values = line.split(",");
>
> Pretty sure this will fail on a CSV entry such as: 100, "1,000.00"
> That should have only 2 tokens.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/droolsjbpm/optaplanner/pull/33/files#r8667218>
> .
>