Repository: marmotta
Updated Branches:
  refs/heads/develop 7d18b0303 -> 713669d1b


MARMOTTA-563: Added some additional error checks


Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/713669d1
Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/713669d1
Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/713669d1

Branch: refs/heads/develop
Commit: 713669d1beef10ba71fccc5822c7260dfd4124eb
Parents: 7d18b03
Author: Jakob Frank <[email protected]>
Authored: Thu Nov 6 19:03:02 2014 +0100
Committer: Jakob Frank <[email protected]>
Committed: Thu Nov 6 19:04:10 2014 +0100

----------------------------------------------------------------------
 .../marmotta/commons/sesame/repository/ResourceUtils.java     | 6 +++---
 .../platform/ldpath/webservices/LDPathWebService.java         | 7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/marmotta/blob/713669d1/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/repository/ResourceUtils.java
----------------------------------------------------------------------
diff --git 
a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/repository/ResourceUtils.java
 
b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/repository/ResourceUtils.java
index 3f79ea4..3c276e0 100644
--- 
a/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/repository/ResourceUtils.java
+++ 
b/commons/marmotta-commons/src/main/java/org/apache/marmotta/commons/sesame/repository/ResourceUtils.java
@@ -54,12 +54,12 @@ public class ResourceUtils {
     /**
      * Check whenever the uri actually exists. 
      * Existence of a URI (Resource) is bound to the existence of a
-     * Statement referencing the Resource, so this method simply delegates to 
{@link #isUsed(RepositoryConnection, String)}.
+     * Statement referencing the Resource, so this method simply delegates to 
{@link #isUsed(RepositoryConnection, Resource)}.
      *
      * @param conn connection with the repository
      * @param uri uri of the resource to check
      * @return resource exists or not
-     * @deprecated the name of this method is missleading. use {@link 
#isUsed(RepositoryConnection, String)}.
+     * @deprecated the name of this method is missleading. use {@link 
#isUsed(RepositoryConnection, Resource)}.
      */
     @Deprecated
     public static boolean existsResource(RepositoryConnection conn, String 
uri) {
@@ -79,7 +79,7 @@ public class ResourceUtils {
     /**
      * Check whether the {@link Resource} is ever used as subject. 
      * @param conn connection with the repository
-     * @param uri the {@link Resource} to check
+     * @param rsc the {@link Resource} to check
      * @return true if the {@link Resource} is ever used as subject.
      */
     public static boolean isSubject(RepositoryConnection conn, final Resource 
rsc) {

http://git-wip-us.apache.org/repos/asf/marmotta/blob/713669d1/platform/marmotta-ldpath/src/main/java/org/apache/marmotta/platform/ldpath/webservices/LDPathWebService.java
----------------------------------------------------------------------
diff --git 
a/platform/marmotta-ldpath/src/main/java/org/apache/marmotta/platform/ldpath/webservices/LDPathWebService.java
 
b/platform/marmotta-ldpath/src/main/java/org/apache/marmotta/platform/ldpath/webservices/LDPathWebService.java
index 00a3beb..ca19692 100644
--- 
a/platform/marmotta-ldpath/src/main/java/org/apache/marmotta/platform/ldpath/webservices/LDPathWebService.java
+++ 
b/platform/marmotta-ldpath/src/main/java/org/apache/marmotta/platform/ldpath/webservices/LDPathWebService.java
@@ -18,6 +18,7 @@
 package org.apache.marmotta.platform.ldpath.webservices;
 
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.marmotta.commons.sesame.repository.ResourceUtils;
 import org.apache.marmotta.commons.util.JSONUtils;
 import org.apache.marmotta.ldpath.api.functions.SelectorFunction;
@@ -148,6 +149,12 @@ public class LDPathWebService {
     @Produces("application/json")
     public Response evaluateProgramQuery(@QueryParam("program") String 
program, @QueryParam("uri") String resourceUri) {
         //Preconditions.checkArgument(urlValidator.isValid(resourceUri));
+        if (StringUtils.isBlank(program)) {
+            return Response.status(Status.BAD_REQUEST).entity("ldpath program 
must be provided").build();
+        }
+        if (StringUtils.isBlank(resourceUri)) {
+            return Response.status(Status.BAD_REQUEST).entity("context 'uri' 
to start ldpath evaluation must be provided").build();
+        }
 
         try {
             RepositoryConnection con = sesameService.getConnection();

Reply via email to