jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [02/11] jena git commit: Add the error conditions.
Date Fri, 10 Jun 2016 12:52:55 GMT


Add the error conditions.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/807d50fe
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/807d50fe
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/807d50fe

Branch: refs/heads/master
Commit: 807d50feff9b300e81253e3306778863f78444c1
Parents: da73e96
Author: ales004 <cicerone54@hotmail.com>
Authored: Sun May 29 19:33:42 2016 +0200
Committer: ales004 <cicerone54@hotmail.com>
Committed: Sun May 29 19:33:42 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java   | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/807d50fe/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
index 8b31d92..037b160 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/XSDFuncOp.java
@@ -1590,6 +1590,11 @@ public class XSDFuncOp
             }
             Duration tzDuration = nv2.getDuration();
             tzOffset = tzDuration.getSign()*(tzDuration.getMinutes() + 60*tzDuration.getHours());
+            if(tzDuration.getSeconds() > 0)
+                throw new ExprEvalException("The timezone duration should be an integral
number of minutes");
+            int absTzOffset = java.lang.Math.abs(tzOffset);
+            if(absTzOffset > 14*60)
+                throw new ExprEvalException("The timezone should be a duration between -PT14H
and PT14H.");
         }
         String tzSign = (tzOffset-inputOffset) > 0 ? "" : "-";
         Duration durToAdd = NodeValue.makeDuration(tzSign+"PT"+java.lang.Math.abs(tzOffset-inputOffset)+"M").getDuration();


Mime
View raw message