AtlasOfLivingAustralia / biocache-service

Occurrence & mapping webservices
https://biocache-ws.ala.org.au/ws/
Other
9 stars 26 forks source link

ArrayIndexOutOfBoundsException in ProcessDownload when doing remote analysis layer intersections #731

Closed djtfmartin closed 6 months ago

djtfmartin commented 2 years ago

Problem is in this section of code

    private void recordCoordinates(Tuple tuple) {
        try {
            Object lon = null;
            Object lat = null;
            if ((lon = tuple.get("sensitive_decimalLongitude")) == null || (lat = tuple.get("sensitive_decimalLatitude")) == null) {
                lon = tuple.get("decimalLongitude");
                lat = tuple.get("decimalLatitude");
            }
            if (lon == null || lat == null) {
                // set as invalid longitude
                points[batch.size()][0] = Integer.MIN_VALUE;
                points[batch.size()][1] = Integer.MIN_VALUE;
            } else {
                points[batch.size()][0] = (Double) lon;
                points[batch.size()][1] = (Double) lat;
            }
        } catch (Exception e) {
            // set the coordinates of the point to something that is invalid
            points[batch.size()][0] = Integer.MIN_VALUE;
            points[batch.size()][1] = Integer.MIN_VALUE;
        }
    }

ArrayIndexOutOfBoundsException caused by batch.size > points.length

adam-collins commented 11 months ago

https://github.com/AtlasOfLivingAustralia/biocache-service/pull/864

peggynewman commented 7 months ago

This can be tested in SP by creating an analysis layer and using the ID of the analysis as a field. Perhaps this test case should be added to the SP functional tests @kylie-m ?

adam-collins commented 6 months ago

Added to spatial-hub functional tests