Histogram Op and RGB images
---------------------------

                 Key: GEOT-2780
                 URL: http://jira.codehaus.org/browse/GEOT-2780
             Project: GeoTools
          Issue Type: Bug
          Components: core coverage
            Reporter: Michael Bedward
            Assignee: Michael Bedward
             Fix For: 2.6.0


Reported by Gabriel...

I've been trying to use the
org.geotools.coverage.processing.operation.Histogram operation against
the sample geoserver coverages and the only one it works for the DEM.
Problem being an NPE thrown at

java.lang.ClassCastException: [Ljava.lang.Object;
       at
org.geotools.coverage.processing.OperationJAI.deriveSampleDimension(OperationJAI.java:781)
       at
org.geotools.coverage.processing.OperationJAI.deriveGridCoverage(OperationJAI.java:580)
..

This is due to the coverage not defining any geophysics category and
OperationJAI checking for null category list but not for an empty one.
The following patch seems to solve the problem. Do you think it's
alright? I might be missing something fundamental, as I only tried what
seemed obvious.

Index: src/main/java/org/geotools/coverage/processing/OperationJAI.java
===================================================================
--- src/main/java/org/geotools/coverage/processing/OperationJAI.java
(revision 34115)
+++ src/main/java/org/geotools/coverage/processing/OperationJAI.java
(working copy)
@@ -774,7 +774,7 @@
                 sampleDim = allBands[allBands.length == 1 ? 0 : numBands];
                 final List<Category> categories =
sampleDim.getCategories();
                 // GridSampleDimension may contain no categories
-                if (categories == null) {
+                if (categories == null || categories.size() == 0) {
                     result[numBands] = sampleDim;
                     continue;
                 }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to