You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/09/23 08:55:43 UTC

[sling-org-apache-sling-api] branch master updated: SLING-7510 : UriProvider throws unchecked IllegalArgumentException that must be handled by consumers

This is an automated email from the ASF dual-hosted git repository.

cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git


The following commit(s) were added to refs/heads/master by this push:
     new e78f68f  SLING-7510 : UriProvider throws unchecked IllegalArgumentException that must be handled by consumers
e78f68f is described below

commit e78f68f0ce2572d823105e4631a1d087f15a46ff
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Sep 23 10:55:19 2020 +0200

    SLING-7510 : UriProvider throws unchecked IllegalArgumentException that must be handled by consumers
---
 .../sling/api/resource/external/ExternalizableInputStream.java   | 4 +++-
 .../java/org/apache/sling/api/resource/external/URIProvider.java | 9 +++++----
 .../org/apache/sling/api/resource/external/package-info.java     | 2 +-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/apache/sling/api/resource/external/ExternalizableInputStream.java b/src/main/java/org/apache/sling/api/resource/external/ExternalizableInputStream.java
index b7d5f53..fc175cd 100644
--- a/src/main/java/org/apache/sling/api/resource/external/ExternalizableInputStream.java
+++ b/src/main/java/org/apache/sling/api/resource/external/ExternalizableInputStream.java
@@ -21,6 +21,8 @@ package org.apache.sling.api.resource.external;
 
 import java.net.URI;
 
+import org.jetbrains.annotations.NotNull;
+
 /**
  * This interface is normally used to extend an InputStream to indicate that it has a URI form that could
  * be used in place of the InputStream if desired. It is used in situations where the internal of a ResourceProvider
@@ -37,6 +39,6 @@ public interface ExternalizableInputStream {
      * directly and not this interface.
      * @return a URI intended for any network context.
      */
-    URI getURI();
+    @NotNull URI getURI();
 
 }
diff --git a/src/main/java/org/apache/sling/api/resource/external/URIProvider.java b/src/main/java/org/apache/sling/api/resource/external/URIProvider.java
index 692b683..ebafa66 100644
--- a/src/main/java/org/apache/sling/api/resource/external/URIProvider.java
+++ b/src/main/java/org/apache/sling/api/resource/external/URIProvider.java
@@ -19,11 +19,12 @@
 
 package org.apache.sling.api.resource.external;
 
+import java.net.URI;
+
 import org.apache.sling.api.resource.Resource;
+import org.jetbrains.annotations.NotNull;
 import org.osgi.annotation.versioning.ProviderType;
 
-import java.net.URI;
-
 /**
  * Provides a URI in exchange for a Resource.
  * Typically the Resource will represent something where is a URI is valiable and usefull.
@@ -38,13 +39,13 @@ public interface URIProvider {
 
     /**
      * Return a URI appicable to the defined scope.
+     * @param resource the resource to convert from.
      * @param scope the required scope.
      * @param operation the required operation.
-     * @param resource the resource to convert from.
      * @return a URI if the resource has a URI suitable for the requested scope and operation, otherwise the implementation should throw an IlleagalArgumentException.
      * @throws IllegalArgumentException if a URI for the requested scope and operation cannot be provided to the caller.
      */
-    URI toURI(Resource resource, URIProvider.Scope scope, URIProvider.Operation operation);
+    @NotNull URI toURI(@NotNull Resource resource, @NotNull URIProvider.Scope scope, @NotNull URIProvider.Operation operation);
 
     /**
      * Defines which operatio the URI may be used to perform.
diff --git a/src/main/java/org/apache/sling/api/resource/external/package-info.java b/src/main/java/org/apache/sling/api/resource/external/package-info.java
index d22faa3..3b3161c 100644
--- a/src/main/java/org/apache/sling/api/resource/external/package-info.java
+++ b/src/main/java/org/apache/sling/api/resource/external/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.0.1")
+@Version("1.0.2")
 package org.apache.sling.api.resource.external;
 
 import org.osgi.annotation.versioning.Version;