incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r722886 - /incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Date Wed, 03 Dec 2008 13:55:31 GMT
Author: fmeschbe
Date: Wed Dec  3 05:55:31 2008
New Revision: 722886

URL: http://svn.apache.org/viewvc?rev=722886&view=rev
Log:
SLING-752 Compliance with modified JavaDoc:
  - do not declare RuntimeException in method declaration
  - throw NPE if path to resolve(String) is null
  - fail resolution for relative paths

Modified:
    incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java

Modified: incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java?rev=722886&r1=722885&r2=722886&view=diff
==============================================================================
--- incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
(original)
+++ incubator/sling/trunk/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrResourceResolver.java
Wed Dec  3 05:55:31 2008
@@ -76,12 +76,11 @@
 
     // ---------- ResourceResolver interface ----------------------------------
 
-    public Resource resolve(HttpServletRequest request) throws SlingException {
+    public Resource resolve(HttpServletRequest request) {
         return resolve(request, request.getPathInfo());
     }
 
-    public Resource resolve(HttpServletRequest request, String absPath)
-            throws SlingException {
+    public Resource resolve(HttpServletRequest request, String absPath) {
 
         // servlet directly address, so there is no path info, use "/" then
         if (absPath == null) {
@@ -102,8 +101,16 @@
         return result;
     }
 
-    public Resource resolve(String uri) throws SlingException {
+    public Resource resolve(String uri) {
 
+        // check argument
+        if (uri == null) {
+            throw new NullPointerException("uri");
+        } else if (!uri.startsWith("/")) {
+            log.info("resolve: Cannot resolve relative URI {}", uri);
+            return null;
+        }
+        
         // resolve virtual uri
         String realUrl = factory.virtualToRealUri(uri);
         if (realUrl != null) {



Mime
View raw message