Strabon
changeset 1083:0944a501d988
added UnsupportedExtensionFunctionException (just extends QueryEvaluationException) which is thrown in GeneralDBEvaluation when no extension function is found. Added also a catch case for this kind of exceptions in monetdb.QueryOp and postgis.QueryOp. Afterall, we should not throw any exceptions to the end-user. An ERROR is sufficient enough. Exceptions should only be thrown only in cases of bugs.
author | Babis Nikolaou <charnik@di.uoa.gr> |
---|---|
date | Fri Apr 26 19:48:06 2013 +0300 (2013-04-26) |
parents | 95c7633544ad |
children | c8f7bc3e7c1c |
files | generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java generaldb/src/main/java/org/openrdf/sail/generaldb/exceptions/UnsupportedExtensionFunctionException.java runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryOp.java runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java |
line diff
1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Mon Apr 15 18:39:56 2013 +0300 1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java Fri Apr 26 19:48:06 2013 +0300 1.3 @@ -92,6 +92,7 @@ 1.4 import org.openrdf.sail.generaldb.algebra.GeneralDBSqlSpatialProperty; 1.5 import org.openrdf.sail.generaldb.algebra.GeneralDBURIColumn; 1.6 import org.openrdf.sail.generaldb.algebra.base.GeneralDBSqlExpr; 1.7 +import org.openrdf.sail.generaldb.exceptions.UnsupportedExtensionFunctionException; 1.8 import org.openrdf.sail.generaldb.model.GeneralDBPolyhedron; 1.9 import org.openrdf.sail.generaldb.schema.IdSequence; 1.10 import org.openrdf.sail.generaldb.util.StSPARQLValueComparator; 1.11 @@ -246,8 +247,7 @@ 1.12 Function function = FunctionRegistry.getInstance().get(fc.getURI()); 1.13 1.14 if (function == null) { 1.15 - logger.warn("[Strabon.evaluation(FunctionCall)] Extension function <{}> is not supported.", fc.getURI()); 1.16 - return null; 1.17 + throw new UnsupportedExtensionFunctionException("Extension function " + fc.getURI()+ " is not supported."); 1.18 } 1.19 1.20 // get the first argument of the function call
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/exceptions/UnsupportedExtensionFunctionException.java Fri Apr 26 19:48:06 2013 +0300 2.3 @@ -0,0 +1,30 @@ 2.4 +/** 2.5 + * This Source Code Form is subject to the terms of the Mozilla Public 2.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 2.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 2.8 + * 2.9 + * Copyright (C) 2013, Pyravlos Team 2.10 + * 2.11 + * http://www.strabon.di.uoa.gr/ 2.12 + */ 2.13 +package org.openrdf.sail.generaldb.exceptions; 2.14 + 2.15 +import org.openrdf.query.QueryEvaluationException; 2.16 + 2.17 +/** 2.18 + * This exception is raised when a SPARQL query contains an 2.19 + * extension function that is not supported by Strabon. 2.20 + * 2.21 + * @author Charalampos Nikolaou <charnik@di.uoa.gr> 2.22 + */ 2.23 +public class UnsupportedExtensionFunctionException extends QueryEvaluationException { 2.24 + private static final long serialVersionUID = -5926890463141193859L; 2.25 + 2.26 + public UnsupportedExtensionFunctionException() { 2.27 + super(); 2.28 + } 2.29 + 2.30 + public UnsupportedExtensionFunctionException(String msg) { 2.31 + super(msg); 2.32 + } 2.33 +}
3.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryOp.java Mon Apr 15 18:39:56 2013 +0300 3.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/monetdb/QueryOp.java Fri Apr 26 19:48:06 2013 +0300 3.3 @@ -11,6 +11,7 @@ 3.4 3.5 import eu.earthobservatory.utils.Format; 3.6 3.7 +import org.openrdf.sail.generaldb.exceptions.UnsupportedExtensionFunctionException; 3.8 import org.slf4j.Logger; 3.9 import org.slf4j.LoggerFactory; 3.10 3.11 @@ -54,6 +55,9 @@ 3.12 strabon = new Strabon(db, user, passwd, port, host, forceDelete); 3.13 strabon.query(queryString, Format.fromString(resultsFormat), strabon.getSailRepoConnection(), System.out); 3.14 3.15 + } catch (UnsupportedExtensionFunctionException e) { 3.16 + logger.error("[Strabon.QueryOp] {}", e.getMessage()); 3.17 + 3.18 } catch (Exception e) { 3.19 logger.error("[Strabon.QueryOp] Error during execution of SPARQL query.", e); 3.20
4.1 --- a/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java Mon Apr 15 18:39:56 2013 +0300 4.2 +++ b/runtime/src/main/java/eu/earthobservatory/runtime/postgis/QueryOp.java Fri Apr 26 19:48:06 2013 +0300 4.3 @@ -11,6 +11,7 @@ 4.4 4.5 import eu.earthobservatory.utils.Format; 4.6 4.7 +import org.openrdf.sail.generaldb.exceptions.UnsupportedExtensionFunctionException; 4.8 import org.slf4j.Logger; 4.9 import org.slf4j.LoggerFactory; 4.10 4.11 @@ -54,6 +55,9 @@ 4.12 strabon = new Strabon(db, user, passwd, port, host, forceDelete); 4.13 strabon.query(queryString, Format.fromString(resultsFormat), strabon.getSailRepoConnection(), System.out); 4.14 4.15 + } catch (UnsupportedExtensionFunctionException e) { 4.16 + logger.error("[Strabon.QueryOp] {}", e.getMessage()); 4.17 + 4.18 } catch (Exception e) { 4.19 logger.error("[Strabon.QueryOp] Error during execution of SPARQL query.", e); 4.20