Skip to content

Commit 99e9275

Browse files
authored
Refactor Neo4jSpatialFeatureReader to use ECQL instead of CQL and improve error handling to prevent CQL requires a PropertyName Error (#453)
1 parent 83d58dc commit 99e9275

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

server-plugin/src/main/java/org/geotools/data/neo4j/Neo4jSpatialFeatureReader.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@
2727
import java.util.Map;
2828
import java.util.NoSuchElementException;
2929
import java.util.Optional;
30-
import java.util.logging.Logger;
3130
import org.geotools.api.data.Query;
3231
import org.geotools.api.data.SimpleFeatureReader;
3332
import org.geotools.api.data.Transaction;
3433
import org.geotools.api.feature.simple.SimpleFeature;
3534
import org.geotools.api.feature.simple.SimpleFeatureType;
3635
import org.geotools.api.feature.type.AttributeDescriptor;
3736
import org.geotools.feature.simple.SimpleFeatureBuilder;
38-
import org.geotools.filter.text.cql2.CQL;
37+
import org.geotools.filter.text.ecql.ECQL;
3938
import org.locationtech.jts.geom.Coordinate;
4039
import org.locationtech.jts.geom.Geometry;
4140
import org.locationtech.jts.geom.GeometryFactory;
@@ -51,7 +50,6 @@
5150

5251
public class Neo4jSpatialFeatureReader implements SimpleFeatureReader {
5352

54-
private static final Logger LOGGER = org.geotools.util.logging.Logging.getLogger(Neo4jSpatialFeatureReader.class);
5553
private static final String GEOMETRY = "geom";
5654
private static final String ATTRIBUTES = "attributes";
5755
private static final String NODE = "node";
@@ -103,7 +101,7 @@ protected void initialize() {
103101
Statement statement = Cypher.call("spatial.cql")
104102
.withArgs(
105103
layerParam,
106-
Cypher.parameter("cql", CQL.toCQL(query.getFilter()))
104+
Cypher.parameter("cql", ECQL.toCQL(query.getFilter()))
107105
)
108106
.yield(node)
109107
.returning(
@@ -123,9 +121,9 @@ protected void initialize() {
123121
.build();
124122
this.result = dataStore.executeQuery(statement, transaction).iterator();
125123

126-
} catch (Exception e) {
127-
LOGGER.warning(e.getMessage());
124+
} catch (RuntimeException e) {
128125
close();
126+
throw new IllegalStateException("Error initializing feature reader", e);
129127
}
130128
}
131129

0 commit comments

Comments
 (0)