Strabon

changeset 395:e34f3de6c128

moved checks for null geometry after WKT.read() inside JTSWrapper.WKTread()
author Babis Nikolaou <charnik@di.uoa.gr>
date Thu Jun 28 15:02:52 2012 +0300 (2012-06-28)
parents 4cb6a34a8877
children f3b936097b91
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Thu Jun 28 01:08:23 2012 +0300
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Thu Jun 28 15:02:52 2012 +0300
     1.3 @@ -102,14 +102,6 @@
     1.4  			// try first as WKT
     1.5  			geometry = jts.WKTread(representation);
     1.6  			
     1.7 -			/**
     1.8 -			 * SPECIAL NOTICE: When <tt>representation</tt> is in GML,
     1.9 -			 * WKTReader does not throw any ParseException! It silently
    1.10 -			 * returns NULL. That's why we have the following check. 
    1.11 -			 */
    1.12 -			if (geometry == null) {
    1.13 -				throw new ParseException("Invalid WKT.");
    1.14 -			}
    1.15  		} catch (ParseException e) {
    1.16  			try {
    1.17  				// try as GML
     2.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java	Thu Jun 28 01:08:23 2012 +0300
     2.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/util/JTSWrapper.java	Thu Jun 28 15:02:52 2012 +0300
     2.3 @@ -76,8 +76,16 @@
     2.4  		return instance;
     2.5  	}
     2.6  	
     2.7 -	public synchronized Geometry WKTread(String wkt) throws ParseException {		
     2.8 -		return wktr.read(wkt);
     2.9 +	public synchronized Geometry WKTread(String wkt) throws ParseException {
    2.10 +		Geometry geometry = wktr.read(wkt);
    2.11 +		
    2.12 +		 /* SPECIAL NOTICE: When <tt>wkt</tt> is in GML,
    2.13 +		  *  WKTReader does not throw any ParseException! It silently
    2.14 +		  *  returns NULL. That's why we have the following check.    */
    2.15 +		if (geometry == null) {
    2.16 +			throw new ParseException("Invalid WKT.");
    2.17 +		}
    2.18 +		return geometry;
    2.19  	}
    2.20  	
    2.21  	public synchronized String WKTwrite(Geometry geom) {
     3.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java	Thu Jun 28 01:08:23 2012 +0300
     3.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/schema/LiteralTable.java	Thu Jun 28 15:02:52 2012 +0300
     3.3 @@ -202,10 +202,6 @@
     3.4  	{
     3.5  		try {
     3.6  			Geometry geom = JTSWrapper.getInstance().WKTread(label);
     3.7 -			if (geom == null) {
     3.8 -				throw new IllegalArgumentException("Invalid WKT.");
     3.9 -				
    3.10 -			}
    3.11  			geoSpatialTable.insert(id, WKTHelper.getSRID(label),/* start,end,*/ JTSWrapper.getInstance().WKBwrite(geom));
    3.12  			
    3.13  		} catch (ParseException e) {