Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] Style is on trunk; but we found a GeoTools bug

Hi again Cory - I traced the problem into the implementation of QuantileFunction.calcualteNonNumerical( List[] bin )...

    private Object calculateNonNumerical(List[] bin) {
        int classNum = bin.length;
        // it's a string.. leave it be (just copy the values)
Set[] values = new Set[classNum]; for (int i = 0; i < classNum; i++) {
            Iterator iterator = bin[i].iterator();
            while (iterator.hasNext()) {
values[i].add(iterator.next()); // THIS IS A NPE becausevalues[i] has never been set
            }
        }
        return new ExplicitClassifier(values);
    }
I added a statement to create: values[i] = new HashSet();
And wrote a test case to verify the fix, I will ask for your review tomorrow before I commit. I also found a mistake in EqualIntervalFunction that is keeping it from working on non numeric values.

Cheers,
Jody
Thanks Cory you rock - the Style Editor compiles; and runs and .... found an error in GeoTools.

This line:
classifier = (Classifier) classifierFunc.evaluate(collection);
I supposed to call a classifier function on a feature collection, when we use it with a QuantileFunction it returns us back a big fat null.

So time to write a test case in GeoTools - thanks for the hard work;
Jody
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top