Probably one of the gemoetry attributes was just (for instance 0) so that it 
got encoded as a property with an integer type not a "double" as expected.

Probably the SimplePointEncoder should be a bit more forgiving and use 
Number.doubleValue() on the actual value it gets back.

so changing decodeGeometry to:

        public Geometry decodeGeometry(PropertyContainer container) {
                double x = ((Number) 
container.getProperty(xProperty)).doubleValue();
                double y = ((Number) 
container.getProperty(yProperty)).doubleValue();
                Coordinate coordinate = new Coordinate(x, y);
                return getGeometryFactory().createPoint(coordinate);
        }

Michael

Am 07.08.2011 um 22:19 schrieb Boris Kizelshteyn:

> When one of my nodes is selected by a findgeometriesinlayer query the plugin
> throws the following error. I can't tell what's different about this node.
> Any ideas where I should look? BTW, I tried to remove the relationship to
> the rtree index and then re-attach, but that doesn't help. Other nodes come
> back just fine.
> 
> Any ideas?
> 
> Many thanks!
> 
> 
>   - ==> 500 Internal Server Error
>   - ==> {
>   -
>   ==>   "message" : "java.lang.Integer cannot be cast to java.lang.Double",
>   -
>   ==>   "exception" : "java.lang.ClassCastException:
> java.lang.Integer cannot be cast to java.lang.Double",
>   -
>   ==>   "stacktrace" : [
> "org.neo4j.gis.spatial.encoders.SimplePointEncoder.decodeGeometry(SimplePointEncoder.java:55)",
> "org.neo4j.gis.spatial.AbstractSearch.decode(AbstractSearch.java:83)",
> "org.neo4j.gis.spatial.query.SearchWithin.onEnvelopeIntersection(SearchWithin.java:44)",
> "org.neo4j.gis.spatial.query.AbstractSearchIntersection.onIndexReference(AbstractSearchIntersection.java:45)",
> "org.neo4j.gis.spatial.RTreeIndex.visit(RTreeIndex.java:276)",
> "org.neo4j.gis.spatial.RTreeIndex.executeSearch(RTreeIndex.java:231)",
> "org.neo4j.gis.spatial.server.plugin.SpatialPlugin.findGeometriesInLayer(SpatialPlugin.java:175)",
> "sun.reflect.GeneratedMethodAccessor1133.invoke(Unknown Source)",
> "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
> "java.lang.reflect.Method.invoke(Method.java:616)",
> "org.neo4j.server.plugins.PluginMethod.invoke(PluginMethod.java:57)",
> "org.neo4j.server.plugins.PluginManager.invoke(PluginManager.java:153)",
> "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:275)",
> "org.neo4j.server.rest.web.ExtensionService.invokeGraphDatabaseExtension(ExtensionService.java:121)",
> "sun.reflect.GeneratedMethodAccessor107.invoke(Unknown Source)",
> "sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
> "java.lang.reflect.Method.invoke(Method.java:616)",
> "com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:184)",
> "com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)",
> "com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:276)",
> "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)",
> "com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)",
> "com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)",
> "com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1171)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1103)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1053)",
> "com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1043)",
> "com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:406)",
> "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:477)",
> "com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:662)",
> "javax.servlet.http.HttpServlet.service(HttpServlet.java:820)",
> "org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)",
> "org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)",
> "org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)",
> "org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)",
> "org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)",
> "org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)",
> "org.mortbay.jetty.Server.handle(Server.java:326)",
> "org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)",
> "org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:943)",
> "org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)",
> "org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)",
> "org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)",
> "org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)",
> "org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)"
> ]
>   - ==> }
> _______________________________________________
> Neo4j mailing list
> [email protected]
> https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to