Strabon

changeset 1447:47a6ec31f27c

added more checks in the arguments of the spatial functions.
author Stella Giannakopoulou <sgian@di.uoa.gr>
date Thu Dec 18 17:56:55 2014 +0200 (2014-12-18)
parents 51f12bbf8cda
children 3776ff96efea
files generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java
line diff
     1.1 --- a/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Dec 04 13:22:59 2014 +0200
     1.2 +++ b/generaldb/src/main/java/org/openrdf/sail/generaldb/evaluation/GeneralDBEvaluation.java	Thu Dec 18 17:56:55 2014 +0200
     1.3 @@ -341,6 +341,9 @@
     1.4  				
     1.5  				if(function instanceof AreaFunc)
     1.6  				{
     1.7 +					// check required number of arguments
     1.8 +					checkArgs(leftResult, rightResult, thirdResult, 1);
     1.9 +					
    1.10  					funcResult = leftGeom.getArea();
    1.11  				} 
    1.12  				else if(function instanceof DistanceFunc)
    1.13 @@ -559,10 +562,17 @@
    1.14  				throw new NoSuchMethodException("expecting a third argument.");
    1.15  				
    1.16  			}
    1.17 -			
    1.18 +
    1.19  			if (size > 3) {
    1.20  				throw new NoSuchMethodException("too many arguments.");
    1.21  			}
    1.22 +
    1.23 +			if (size == 1 && (rightResult !=null || thirdResult != null) ) {
    1.24 +				throw new NoSuchMethodException("too many arguments.");
    1.25 +			}
    1.26 +			if (size == 2 && thirdResult != null) {
    1.27 +				throw new NoSuchMethodException("too many arguments.");
    1.28 +			}
    1.29  		}
    1.30  	}
    1.31