Strabon

changeset 1402:1f2f22747854

fixes bug #69: better error handling
author Babis Nikolaou <charnik@di.uoa.gr>
date Sat Sep 20 15:08:58 2014 +0300 (2014-09-20)
parents 7b5fe3164aab
children 66958cde6661
files evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java
line diff
     1.1 --- a/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Fri Sep 19 14:54:54 2014 +0300
     1.2 +++ b/evaluation/src/main/java/org/openrdf/query/algebra/evaluation/function/spatial/StrabonPolyhedron.java	Sat Sep 20 15:08:58 2014 +0300
     1.3 @@ -112,7 +112,7 @@
     1.4  	 * @param representation
     1.5  	 * @throws Exception
     1.6  	 */
     1.7 -	public StrabonPolyhedron(String representation) throws IllegalArgumentException {
     1.8 +	public StrabonPolyhedron(String representation) throws ParseException {
     1.9  		try {
    1.10  			// try first as WKT
    1.11  			geometry = jts.WKTread(representation);
    1.12 @@ -123,7 +123,7 @@
    1.13  				geometry = jts.GMLread(representation);
    1.14  				
    1.15  			} catch (Exception e1) {
    1.16 -				throw new IllegalArgumentException(e1);
    1.17 +				throw new ParseException("The given WKT/GML representation is not valid.");
    1.18  			}
    1.19  		}
    1.20  	}
     2.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Fri Sep 19 14:54:54 2014 +0300
     2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBQueryBuilder.java	Sat Sep 20 15:08:58 2014 +0300
     2.3 @@ -1172,7 +1172,7 @@
     2.4  		}
     2.5  	}
     2.6  
     2.7 -	protected abstract String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter);
     2.8 +	protected abstract String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException;
     2.9  
    2.10  	protected void appendConstructFunction(GeneralDBSqlExpr constr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException
    2.11  	{
     3.1 --- a/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Fri Sep 19 14:54:54 2014 +0300
     3.2 +++ b/postgis/src/main/java/org/openrdf/sail/postgis/evaluation/PostGISQueryBuilder.java	Sat Sep 20 15:08:58 2014 +0300
     3.3 @@ -986,9 +986,10 @@
     3.4  
     3.5  	/**
     3.6  	 * 'helper' functions
     3.7 +	 * @throws UnsupportedRdbmsOperatorException 
     3.8  	 */
     3.9  	@Override
    3.10 -	protected String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter)
    3.11 +	protected String appendWKT(GeneralDBSqlExpr expr, GeneralDBSqlExprBuilder filter) throws UnsupportedRdbmsOperatorException
    3.12  	{
    3.13  		GeneralDBStringValue arg = (GeneralDBStringValue) expr;
    3.14  		String raw = arg.getValue();
    3.15 @@ -1003,7 +1004,7 @@
    3.16  			filter.append(" ST_GeomFromText('"+poly.toWKT() +"',"+String.valueOf(wkt.getSRID())+")");
    3.17  			
    3.18  		} catch (Exception e) {
    3.19 -			e.printStackTrace();
    3.20 +			throw new UnsupportedRdbmsOperatorException(e.getMessage());
    3.21  		}
    3.22  
    3.23  		return raw;
     4.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java	Fri Sep 19 14:54:54 2014 +0300
     4.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java	Sat Sep 20 15:08:58 2014 +0300
     4.3 @@ -11,6 +11,7 @@
     4.4  
     4.5  import org.openrdf.query.MalformedQueryException;
     4.6  import org.openrdf.sail.generaldb.exceptions.UnsupportedExtensionFunctionException;
     4.7 +import org.openrdf.sail.rdbms.exceptions.UnsupportedRdbmsOperatorException;
     4.8  import org.slf4j.Logger;
     4.9  import org.slf4j.LoggerFactory;
    4.10  
    4.11 @@ -60,7 +61,10 @@
    4.12  			logger.error("[Strabon.QueryOp] {}", e.getMessage());
    4.13  			
    4.14  		} catch (MalformedQueryException e) {
    4.15 -			logger.error("[Strabon.QueryOp] {}", e.getMessage());
    4.16 +			logger.error("[Strabon.QueryOp] Malformed query: {}", e.getMessage());
    4.17 +		
    4.18 +		} catch (UnsupportedRdbmsOperatorException e) {
    4.19 +			logger.error("[Strabon.QueryOp] Error during execution of SPARQL query: {}", e.getMessage());
    4.20  			
    4.21  		} catch (Exception e) {
    4.22  			logger.error("[Strabon.QueryOp] Error during execution of SPARQL query.", e);