Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Validate.isTrue() calls #8

Closed
GoogleCodeExporter opened this issue Mar 30, 2015 · 7 comments
Closed

Wrong Validate.isTrue() calls #8

GoogleCodeExporter opened this issue Mar 30, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Issue 11 has been merged into this issue.

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Issue 17 has been merged into this issue.

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

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

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

  • Changed state: Fixed
  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant