Browse files

Merge branch 'develop' of github.com:adamretter/exist into develop

  • Loading branch information...
2 parents 66446dc + d2e57d6 commit fc005c79467d9383ad416daa159a9e4db2964ae0 @adamretter adamretter committed Sep 5, 2013
View
BIN extensions/exquery/restxq/lib/exquery-restxq-api-1.0-SNAPSHOT.jar
Binary file not shown.
View
37 ...txq/src/main/java/org/exist/extensions/exquery/restxq/impl/adapters/EXQueryErrorCode.java
@@ -0,0 +1,37 @@
+/*
+Copyright (c) 2013, Adam Retter
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Adam Retter Consulting nor the
+ names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL Adam Retter BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.exist.extensions.exquery.restxq.impl.adapters;
+
+import org.exist.dom.QName;
+import org.exist.xquery.ErrorCodes.ErrorCode;
+
+public class EXQueryErrorCode extends ErrorCode {
+
+ public EXQueryErrorCode(final org.exquery.ErrorCodes.ErrorCode errorCode) {
+ super(new QName(errorCode.getErrorQName().getLocalPart(), errorCode.getErrorQName().getNamespaceURI(), errorCode.getErrorQName().getPrefix()), errorCode.getDescription());
+ }
+}
View
10 ...ry/restxq/src/main/java/org/exist/extensions/exquery/restxq/impl/xquery/UriFunctions.java
@@ -28,6 +28,7 @@
import org.exist.dom.QName;
import org.exist.extensions.exquery.restxq.impl.ResourceFunctionExecutorImpl;
+import org.exist.extensions.exquery.restxq.impl.adapters.EXQueryErrorCode;
import org.exist.xquery.BasicFunction;
import org.exist.xquery.Cardinality;
import org.exist.xquery.FunctionSignature;
@@ -37,6 +38,7 @@
import org.exist.xquery.value.FunctionReturnSequenceType;
import org.exist.xquery.value.Sequence;
import org.exist.xquery.value.Type;
+import org.exquery.restxq.RestXqErrorCodes;
/**
*
@@ -75,7 +77,11 @@ public Sequence eval(final Sequence[] args, final Sequence contextSequence) thro
} else {
var = context.resolveVariable(ResourceFunctionExecutorImpl.XQ_VAR_URI);
}
-
- return var.getValue();
+
+ if(var == null) {
+ throw new XPathException(new EXQueryErrorCode(RestXqErrorCodes.RQDY0101), getLine(), getColumn());
+ } else {
+ return var.getValue();
+ }
}
}

0 comments on commit fc005c7

Please sign in to comment.