metteo / javageomodel

Automatically exported from code.google.com/p/javageomodel
0 stars 0 forks source link

Wrong Validate.isTrue() calls #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I get runtime error when using javageomode:

HTTP ERROR 500

Problem accessing /set_mark. Reason:

    Latitude must be in [-90, 90] but was 2.0
Caused by:

java.lang.IllegalArgumentException: Latitude must be in [-90, 90] but was 
2.0
    at org.apache.commons.lang.Validate.isTrue(Validate.java:130)
    at com.beoui.geocell.model.Point.<init>(Point.java:29)
    at test.Test_gae_1Servlet.doGet(Test_gae_1Servlet.java:55)
...

Looking at the source code com.beoui.geocell.model.Point I see 
    public Point(double lat, double lon) {
        Validate.isTrue(lat > 90.0 || lat < -90.0, "Latitude must be in [-
90, 90] but was ", lat);
        Validate.isTrue(lon > 180.0 || lon < -180.0, "Longitude must be in 
[-180, 180] but was ", lon);
        this.lat = lat;
        this.lon = lon;
    }

According to Validate.isTrue() javadoc:
"Validate an argument, throwing IllegalArgumentException if the test result 
is false."

I'm brand new with GAE, so I wonder if I'm doing something wrong or it is a   
plan error in code? How did you run the code then, cutting somehow Validate 
calls or what? 

Original issue reported on code.google.com by gmi...@gmail.com on 11 May 2010 at 1:26

GoogleCodeExporter commented 9 years ago
The validation is wrong it needs to be something like:

        Validate.isTrue(!(lat > 90.0 || lat < -90.0), "Latitude must be in [-90, 90] 
but was ", lat);
        Validate.isTrue(!(lon > 180.0 || lon < -180.0), "Longitude must be in [-180, 
180] but was ", lon);

Original comment by vidarsv...@gmail.com on 13 May 2010 at 2:53

GoogleCodeExporter commented 9 years ago
yep, I already fixed it myself in exactly the same way ))
I wonder how the code could work before - is it a working code? I have some 
issues 
with bounding box queries, and I'm uncertain if it is my problem or problem in 
geomodel code. Probably I'll submit other issue.

Original comment by gmi...@gmail.com on 13 May 2010 at 3:15

GoogleCodeExporter commented 9 years ago
I think it is also wrong when it validates maxGeocellResolution:

     Validate.isTrue(maxGeocellResolution > GeocellManager.MAX_GEOCELL_RESOLUTION,
                "Invalid max resolution parameter. Must be inferior to ", GeocellManager.MAX_GEOCELL_RESOLUTION);

Just reading through the code today. How come the proximity doesn't work on 
bounding boxes?

Original comment by vidarsv...@gmail.com on 13 May 2010 at 9:59

GoogleCodeExporter commented 9 years ago
I haven't tried proximity yet, only bbox. I can't understand it: I added a point
44.838611,-0.578333 which generated geocells [6, 6b, 6bf, 6bff, 6bff5, 6bff5c, 
6bff5ca, 6bff5ca6, 6bff5ca66, 6bff5ca669, 6bff5ca669f, 6bff5ca669fe, 
6bff5ca669fe7]
but when I filter with BBOX=44.8,-1,44.9,1 (which should include the point in 
my 
opinion) - I do not get the point. Why?
GeocellManager.bestBboxSearchCells returns [8a, 8b, 8e, 8f, 9a, 9b, 9e, 9f, ca, 
cb, 
ce, cf, da, db, de, df] for the given bbox.
Does it work for you?

Original comment by gmi...@gmail.com on 13 May 2010 at 10:21

GoogleCodeExporter commented 9 years ago
Issue 11 has been merged into this issue.

Original comment by edgar.da...@gmail.com on 5 Nov 2010 at 10:12

GoogleCodeExporter commented 9 years ago
Issue 17 has been merged into this issue.

Original comment by edgar.da...@gmail.com on 5 Nov 2010 at 10:13

GoogleCodeExporter commented 9 years ago

Original comment by alexandr...@gmail.com on 10 Nov 2010 at 6:20