You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2015/02/17 11:32:23 UTC

svn commit: r1660344 [1/2] - in /sling/trunk/bundles/api: ./ src/main/java/org/apache/sling/api/ src/main/java/org/apache/sling/api/adapter/ src/main/java/org/apache/sling/api/auth/ src/main/java/org/apache/sling/api/request/ src/main/java/org/apache/s...

Author: kwin
Date: Tue Feb 17 10:32:22 2015
New Revision: 1660344

URL: http://svn.apache.org/r1660344
Log:
SLING-4377 add null check annotations (JSR 305)

Increasing Java dependency to 1.6 (because of imports to javax.annotation)
This closes #64

Modified:
    sling/trunk/bundles/api/pom.xml
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/SlingHttpServletRequest.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/Adaptable.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterFactory.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterManager.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/package-info.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/Authenticator.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/package-info.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/package-info.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameter.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameterMap.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestPathInfo.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestUtil.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/package-info.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceDecorator.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceMetadata.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolverFactory.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ValueMap.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingBindings.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/package-info.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/ResourceAccessSecurity.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/package-info.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingAllMethodsServlet.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/SlingSafeMethodsServlet.java
    sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/package-info.java

Modified: sling/trunk/bundles/api/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/pom.xml?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/pom.xml (original)
+++ sling/trunk/bundles/api/pom.xml Tue Feb 17 10:32:22 2015
@@ -51,6 +51,7 @@
 
     <properties>
         <site.jira.version.id>12314252</site.jira.version.id>
+        <sling.java.version>6</sling.java.version>
     </properties>
 
     <dependencies>
@@ -71,6 +72,12 @@
             <scope>provided</scope>
         </dependency>
         
+        <dependency>
+            <groupId>com.google.code.findbugs</groupId>
+            <artifactId>jsr305</artifactId>
+            <version>3.0.0</version>
+            <scope>provided</scope>
+        </dependency>
         <!-- Testing -->
         <dependency>
             <groupId>junit</groupId>
@@ -90,6 +97,13 @@
 
     <build>
         <plugins>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
             <!-- Create the bundle of the Sling API -->
             <plugin>
                 <groupId>org.apache.felix</groupId>

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/SlingHttpServletRequest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/SlingHttpServletRequest.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/SlingHttpServletRequest.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/SlingHttpServletRequest.java Tue Feb 17 10:32:22 2015
@@ -23,6 +23,8 @@ import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import javax.servlet.RequestDispatcher;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
@@ -67,7 +69,7 @@ public interface SlingHttpServletRequest
      *
      * @return The <code>Resource</code> object of this request.
      */
-    Resource getResource();
+    @Nonnull Resource getResource();
 
     /**
      * Returns the {@link ResourceResolver} which resolved the
@@ -75,14 +77,14 @@ public interface SlingHttpServletRequest
      *
      * @return The resource resolver
      */
-    ResourceResolver getResourceResolver();
+    @Nonnull ResourceResolver getResourceResolver();
 
     /**
      * Returns the {@link RequestPathInfo} pertaining to this request.
      *
      * @return the request path info.
      */
-    RequestPathInfo getRequestPathInfo();
+    @Nonnull RequestPathInfo getRequestPathInfo();
 
     /**
      * Returns the value of a request parameter as a {@link RequestParameter},
@@ -106,7 +108,7 @@ public interface SlingHttpServletRequest
      * @see RequestParameterMap#getValue(String)
      * @throws IllegalArgumentException if name is <code>null</code>.
      */
-    RequestParameter getRequestParameter(String name);
+    @CheckForNull RequestParameter getRequestParameter(@Nonnull String name);
 
     /**
      * Returns an array of {@link RequestParameter} objects containing all of
@@ -126,7 +128,7 @@ public interface SlingHttpServletRequest
      * @see RequestParameterMap#getValues(String)
      * @throws IllegalArgumentException if name is <code>null</code>.
      */
-    RequestParameter[] getRequestParameters(String name);
+    @CheckForNull RequestParameter[] getRequestParameters(@Nonnull String name);
 
     /**
      * Returns a <code>Map</code> of the parameters of this request.
@@ -142,7 +144,7 @@ public interface SlingHttpServletRequest
      *         parameter map are of type String. The values in the parameter map
      *         are of type {@link RequestParameter} array (<code>RequestParameter[]</code>).
      */
-    RequestParameterMap getRequestParameterMap();
+   @Nonnull RequestParameterMap getRequestParameterMap();
 
     /**
      * Returns the request parameters as instances of the
@@ -154,7 +156,7 @@ public interface SlingHttpServletRequest
      *         order.
      * @since 2.3  (Sling API Bundle 2.6.0)
      */
-    List<RequestParameter> getRequestParameterList();
+    @Nonnull List<RequestParameter> getRequestParameterList();
 
     /**
      * Returns a <code>RequestDispatcher</code> object that acts as a wrapper
@@ -173,7 +175,7 @@ public interface SlingHttpServletRequest
      *         for the <code>resource</code> or <code>null</code> if an
      *         error occurs preparing the dispatcher.
      */
-    RequestDispatcher getRequestDispatcher(String path,
+    @CheckForNull RequestDispatcher getRequestDispatcher(@Nonnull String path,
             RequestDispatcherOptions options);
 
     /**
@@ -192,14 +194,14 @@ public interface SlingHttpServletRequest
      *         for the <code>resource</code> or <code>null</code> if an
      *         error occurs preparing the dispatcher.
      */
-    RequestDispatcher getRequestDispatcher(Resource resource,
+    @CheckForNull RequestDispatcher getRequestDispatcher(@Nonnull Resource resource,
             RequestDispatcherOptions options);
 
     /**
      * Same as {@link #getRequestDispatcher(Resource,RequestDispatcherOptions)}
      * but using empty options.
      */
-    RequestDispatcher getRequestDispatcher(Resource resource);
+    @CheckForNull RequestDispatcher getRequestDispatcher(@Nonnull Resource resource);
 
     /**
      * Returns the named cookie from the HTTP request or <code>null</code> if
@@ -208,7 +210,7 @@ public interface SlingHttpServletRequest
      * @param name The name of the cookie to return.
      * @return The named cookie or <code>null</code> if no such cookie exists.
      */
-    Cookie getCookie(String name);
+    @CheckForNull Cookie getCookie(String name);
 
     /**
      * Returns the framework preferred content type for the response. The
@@ -220,7 +222,7 @@ public interface SlingHttpServletRequest
      *
      * @return preferred MIME type of the response
      */
-    String getResponseContentType();
+    @CheckForNull String getResponseContentType();
 
     /**
      * Gets a list of content types which the framework accepts for the
@@ -235,7 +237,7 @@ public interface SlingHttpServletRequest
      *
      * @return ordered list of MIME types for the response
      */
-    Enumeration<String> getResponseContentTypes();
+    @Nonnull Enumeration<String> getResponseContentTypes();
 
     /**
      * Returns the resource bundle for the given locale.
@@ -245,7 +247,7 @@ public interface SlingHttpServletRequest
      *            {@link #getLocale()} is used to select the resource bundle.
      * @return the resource bundle for the given locale
      */
-    ResourceBundle getResourceBundle(Locale locale);
+    @CheckForNull ResourceBundle getResourceBundle(Locale locale);
 
     /**
      * Returns the resource bundle of the given base name for the given locale.
@@ -259,10 +261,10 @@ public interface SlingHttpServletRequest
      *            {@link #getLocale()} is used to select the resource bundle.
      * @return the resource bundle for the given locale
      */
-    ResourceBundle getResourceBundle(String baseName, Locale locale);
+    @CheckForNull ResourceBundle getResourceBundle(String baseName, Locale locale);
 
     /**
      * Returns the {@link RequestProgressTracker} of this request.
      */
-    RequestProgressTracker getRequestProgressTracker();
+    @Nonnull RequestProgressTracker getRequestProgressTracker();
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/Adaptable.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/Adaptable.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/Adaptable.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/Adaptable.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.api.adapter;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ConsumerType;
 
 /**
@@ -49,6 +52,6 @@ public interface Adaptable {
      * @return The adapter target or <code>null</code> if the resource cannot
      *         adapt to the requested type
      */
-    <AdapterType> AdapterType adaptTo(Class<AdapterType> type);
+    @CheckForNull <AdapterType> AdapterType adaptTo(@Nonnull Class<AdapterType> type);
 
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterFactory.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterFactory.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterFactory.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.api.adapter;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ConsumerType;
 
 /**
@@ -82,7 +85,7 @@ public interface AdapterFactory {
      * @return The adapted object or <code>null</code> if this factory instance
      *         cannot adapt the object.
      */
-    <AdapterType> AdapterType getAdapter(Object adaptable,
-            Class<AdapterType> type);
+    @CheckForNull <AdapterType> AdapterType getAdapter(@Nonnull Object adaptable,
+            @Nonnull Class<AdapterType> type);
 
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterManager.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterManager.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/AdapterManager.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.api.adapter;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ProviderType;
 
 /**
@@ -57,7 +60,7 @@ public interface AdapterManager {
      *         or if the <code>adaptable</code> cannot be adapted for any other
      *         reason.
      */
-    <AdapterType> AdapterType getAdapter(Object adaptable,
-            Class<AdapterType> type);
+    @CheckForNull <AdapterType> AdapterType getAdapter(@Nonnull Object adaptable,
+            @Nonnull Class<AdapterType> type);
 
 }
\ No newline at end of file

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/package-info.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/package-info.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/adapter/package-info.java Tue Feb 17 10:32:22 2015
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.2")
+@Version("2.2.1")
 package org.apache.sling.api.adapter;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/Authenticator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/Authenticator.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/Authenticator.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/Authenticator.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,7 @@
  */
 package org.apache.sling.api.auth;
 
+import javax.annotation.Nonnull;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -115,7 +116,7 @@ public interface Authenticator {
      *             to authenticate a request user.
      * @throws IllegalStateException If the response has already been committed.
      */
-    void login(HttpServletRequest request, HttpServletResponse response);
+    void login(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response);
 
     /**
      * Logs out if the current request is authenticated.
@@ -132,5 +133,5 @@ public interface Authenticator {
      * @param response The object representing the response to the client.
      * @throws IllegalStateException If the response has already been committed.
      */
-    void logout(HttpServletRequest request, HttpServletResponse response);
+    void logout(@Nonnull HttpServletRequest request, @Nonnull HttpServletResponse response);
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/package-info.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/package-info.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/auth/package-info.java Tue Feb 17 10:32:22 2015
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.0")
+@Version("1.0.1")
 package org.apache.sling.api.auth;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/package-info.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/package-info.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/package-info.java Tue Feb 17 10:32:22 2015
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.3")
+@Version("2.3.1")
 package org.apache.sling.api;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameter.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameter.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameter.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameter.java Tue Feb 17 10:32:22 2015
@@ -22,6 +22,9 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.UnsupportedEncodingException;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ProviderType;
 
 /**
@@ -42,7 +45,7 @@ public interface RequestParameter {
      * @return the name of this {@code RequestParameter}
      * @since 2.4 (Sling API Bundle 2.6)
      */
-    String getName();
+    @Nonnull String getName();
 
     /**
      * Determines whether or not this instance represents a simple form field or
@@ -60,7 +63,7 @@ public interface RequestParameter {
      * @return The content type passed by the browser or <code>null</code> if
      *         not defined.
      */
-    String getContentType();
+    @CheckForNull String getContentType();
 
     /**
      * Returns the size in bytes of the parameter.
@@ -88,7 +91,7 @@ public interface RequestParameter {
      *         file.
      * @throws IOException if an error occurs.
      */
-    InputStream getInputStream() throws IOException;
+    @CheckForNull InputStream getInputStream() throws IOException;
 
     /**
      * Returns the original filename in the client's filesystem, as provided by
@@ -98,7 +101,7 @@ public interface RequestParameter {
      *
      * @return The original filename in the client's filesystem.
      */
-    String getFileName();
+    @CheckForNull String getFileName();
 
     /**
      * Returns the contents of the parameter as a String, using the default
@@ -107,7 +110,7 @@ public interface RequestParameter {
      *
      * @return The contents of the parameter, as a string.
      */
-    String getString();
+    @Nonnull String getString();
 
     /**
      * Returns the contents of the parameter as a String, using the specified
@@ -119,6 +122,6 @@ public interface RequestParameter {
      * @throws UnsupportedEncodingException if the requested character encoding
      *             is not available.
      */
-    String getString(String encoding) throws UnsupportedEncodingException;
+    @Nonnull String getString(@Nonnull String encoding) throws UnsupportedEncodingException;
 
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameterMap.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameterMap.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameterMap.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestParameterMap.java Tue Feb 17 10:32:22 2015
@@ -20,6 +20,9 @@ package org.apache.sling.api.request;
 
 import java.util.Map;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ProviderType;
 
 
@@ -32,10 +35,10 @@ public interface RequestParameterMap ext
 
     /** Returns all values for the named parameter or null if none
      */
-    RequestParameter[] getValues(String name);
+    @CheckForNull RequestParameter[] getValues(@Nonnull String name);
 
     /** Returns the first value for the named parameter or null if none
      */
-    RequestParameter getValue(String name);
+    @CheckForNull RequestParameter getValue(String name);
 
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestPathInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestPathInfo.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestPathInfo.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestPathInfo.java Tue Feb 17 10:32:22 2015
@@ -16,6 +16,10 @@
  */
 package org.apache.sling.api.request;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 import org.apache.sling.api.resource.Resource;
 
 import aQute.bnd.annotation.ProviderType;
@@ -158,7 +162,7 @@ public interface RequestPathInfo {
      * {@link org.apache.sling.api.resource.ResourceMetadata#RESOLUTION_PATH resolution path metadata property}
      * of the resource.
      */
-    String getResourcePath();
+    @Nonnull String getResourcePath();
 
     /**
      * Returns the extension from the URL or <code>null</code> if the request
@@ -169,7 +173,7 @@ public interface RequestPathInfo {
      *
      * @return The extension from the request URL.
      */
-    String getExtension();
+    @CheckForNull String getExtension();
 
     /**
      * Returns the selectors decoded from the request URL as string. Returns
@@ -180,7 +184,7 @@ public interface RequestPathInfo {
      *
      * @see #getSelectors()
      */
-    String getSelectorString();
+    @CheckForNull String getSelectorString();
 
     /**
      * Returns the selectors decoded from the request URL as an array of
@@ -193,7 +197,7 @@ public interface RequestPathInfo {
      *
      * @see #getSelectorString()
      */
-    String[] getSelectors();
+    @Nonnull String[] getSelectors();
 
     /**
      * Returns the suffix part of the URL or <code>null</code> if the request
@@ -204,7 +208,7 @@ public interface RequestPathInfo {
      *
      * @return The suffix part of the request URL.
      */
-    String getSuffix();
+    @CheckForNull String getSuffix();
 
     /**
      * Returns the resource addressed by the suffix or null if the request does
@@ -217,5 +221,5 @@ public interface RequestPathInfo {
      *
      * @since 2.3 (Sling API Bundle 2.3.2)
      */
-    Resource getSuffixResource();
+    @CheckForNull Resource getSuffixResource();
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestProgressTracker.java Tue Feb 17 10:32:22 2015
@@ -21,6 +21,9 @@ package org.apache.sling.api.request;
 import java.io.PrintWriter;
 import java.util.Iterator;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ProviderType;
 
 /**
@@ -83,44 +86,44 @@ import aQute.bnd.annotation.ProviderType
 public interface RequestProgressTracker {
 
     /** Creates an entry with the given message */
-     void log(String message);
+     void log(@Nonnull String message);
 
     /**
      * Creates an entry with a message constructed from the given
      * <code>MessageFormat</code> format evaluated using the given formatting
      * arguments.
      */
-    void log(String format, Object... args);
+    void log(@Nonnull String format, Object... args);
 
     /**
      * Starts a named timer. If a timer of the same name already exists, it is
      * reset to the current time.
      */
-    void startTimer(String timerName);
+    void startTimer(@Nonnull String timerName);
 
     /**
      * Logs an entry with the message set to the name of the timer and the
      * number of milliseconds elapsed since the timer start.
      */
-    void logTimer(String timerName);
+    void logTimer(@Nonnull String timerName);
 
     /**
      * Logs an entry with the message constructed from the given
      * <code>MessageFormat</code> pattern evaluated using the given arguments
      * and the number of milliseconds elapsed since the timer start.
      */
-    void logTimer(String timerName, String format, Object... args);
+    void logTimer(@Nonnull String timerName, @Nonnull String format, Object... args);
 
     /**
      * Returns an <code>Iterator</code> of tracking entries.
      * If there are no messages <code>null</code> is returned.
      */
-    Iterator<String> getMessages();
+    @CheckForNull Iterator<String> getMessages();
 
     /**
      * Dumps the process timer entries to the given writer, one entry per line.
      */
-    void dump(PrintWriter writer);
+    void dump(@Nonnull PrintWriter writer);
 
     /**
      *  Call this when done processing the request - only the first call of this

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestUtil.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestUtil.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/RequestUtil.java Tue Feb 17 10:32:22 2015
@@ -22,6 +22,8 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import javax.servlet.Servlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -53,7 +55,7 @@ public class RequestUtil {
      * @return A Map indexed by the Token names where the values are Map
      *         instances indexed by parameter name
      */
-    public static Map<String, Map<String, String>> parserHeader(String value) {
+    public static @Nonnull Map<String, Map<String, String>> parserHeader(@Nonnull String value) {
         Map<String, Map<String, String>> result = new HashMap<String, Map<String, String>>();
         String[] tokens = value.split(",");
         for (int i = 0; i < tokens.length; i++) {
@@ -94,7 +96,7 @@ public class RequestUtil {
      *         <code>Double</code> instances providing the value of the
      *         <code>q</code> parameter.
      */
-    public static Map<String, Double> parserAcceptHeader(String value) {
+    public static @Nonnull Map<String, Double> parserAcceptHeader(@Nonnull String value) {
         Map<String, Double> result = new HashMap<String, Double>();
         String[] tokens = value.split(",");
         for (int i = 0; i < tokens.length; i++) {
@@ -131,7 +133,7 @@ public class RequestUtil {
      * <li>Otherwise use the fully qualified name of the servlet class
      * </ol>
      */
-    public static String getServletName(Servlet servlet) {
+    public static @Nonnull String getServletName(@Nonnull Servlet servlet) {
         String name = null;
 
         if (servlet.getServletConfig() != null) {
@@ -158,8 +160,8 @@ public class RequestUtil {
      * @return The previous value of the named request attribute or
      *         <code>null</code> if it was not set.
      */
-    public static Object setRequestAttribute(HttpServletRequest request,
-            String name, Object value) {
+    public static @CheckForNull Object setRequestAttribute(@Nonnull HttpServletRequest request,
+            @Nonnull String name, Object value) {
         Object oldValue = request.getAttribute(name);
         if (value == null) {
             request.removeAttribute(name);
@@ -177,7 +179,7 @@ public class RequestUtil {
      * @param resp the response
      * @return <code>true</code> if the response was set
      */
-    public static boolean handleIfModifiedSince(SlingHttpServletRequest req, HttpServletResponse resp){
+    public static boolean handleIfModifiedSince(@Nonnull SlingHttpServletRequest req, @Nonnull HttpServletResponse resp){
         boolean responseSet=false;
         long lastModified=req.getResource().getResourceMetadata().getModificationTime();
         if (lastModified!=-1){

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/ResponseUtil.java Tue Feb 17 10:32:22 2015
@@ -21,6 +21,8 @@ package org.apache.sling.api.request;
 import java.io.IOException;
 import java.io.Writer;
 
+import javax.annotation.Nonnull;
+
 /**
  * Response related utility methods
  * <p>
@@ -116,7 +118,7 @@ public class ResponseUtil {
 
     /** Return a Writer that writes escaped XML text to target
      */
-    public static Writer getXmlEscapingWriter(Writer target) {
+    public static @Nonnull Writer getXmlEscapingWriter(@Nonnull Writer target) {
         return new XmlEscapingWriter(target);
     }
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/package-info.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/package-info.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/request/package-info.java Tue Feb 17 10:32:22 2015
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.4")
+@Version("2.4.1")
 package org.apache.sling.api.request;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/Resource.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,9 @@ package org.apache.sling.api.resource;
 
 import java.util.Iterator;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.adapter.Adaptable;
 
 import aQute.bnd.annotation.ProviderType;
@@ -62,7 +65,7 @@ public interface Resource extends Adapta
     /**
      * Returns the absolute path of this resource in the resource tree.
      */
-    String getPath();
+    @Nonnull String getPath();
 
     /**
      * Returns the name of this resource. The name of a resource is the last
@@ -70,7 +73,7 @@ public interface Resource extends Adapta
      *
      * @since 2.1 (Sling API Bundle 2.2.0)
      */
-    String getName();
+    @Nonnull String getName();
 
     /**
      * Returns the parent resource or <code>null</code> if this resource
@@ -78,7 +81,7 @@ public interface Resource extends Adapta
      *
      * @since 2.1 (Sling API Bundle 2.1.0)
      */
-    Resource getParent();
+    @CheckForNull Resource getParent();
 
     /**
      * Returns an iterator of the direct children of this resource.
@@ -89,7 +92,7 @@ public interface Resource extends Adapta
      * @since 2.1 (Sling API Bundle 2.1.0)
      * @see ResourceResolver#listChildren(Resource)
      */
-    Iterator<Resource> listChildren();
+    @Nonnull Iterator<Resource> listChildren();
 
     /**
      * Returns an iterable of the direct children of this resource.
@@ -100,7 +103,7 @@ public interface Resource extends Adapta
      * @since 2.2 (Sling API Bundle 2.2.0)
      * @see ResourceResolver#getChildren(Resource)
      */
-    Iterable<Resource> getChildren();
+    @Nonnull Iterable<Resource> getChildren();
 
     /**
      * Returns the child at the given relative path of this resource or
@@ -112,7 +115,7 @@ public interface Resource extends Adapta
      * @since 2.1 (Sling API Bundle 2.1.0)
      * @see ResourceResolver#getResource(Resource, String)
      */
-    Resource getChild(String relPath);
+    @CheckForNull Resource getChild(@Nonnull String relPath);
 
     /**
      * The resource type is meant to point to rendering/processing scripts,
@@ -125,7 +128,7 @@ public interface Resource extends Adapta
      * If the resource instance represents a resource which is not actually
      * existing, this method returns {@link #RESOURCE_TYPE_NON_EXISTING}.
      */
-    String getResourceType();
+    @Nonnull String getResourceType();
 
     /**
      * Returns the super type of the resource if the resource defines its
@@ -135,7 +138,7 @@ public interface Resource extends Adapta
      * If a client is interested in the effective resource super type
      * of a resource, it should call {@link ResourceResolver#getParentResourceType(Resource)}.
      */
-    String getResourceSuperType();
+    @CheckForNull String getResourceSuperType();
 
     /**
      * Checks if the resource has any child resources.
@@ -167,13 +170,13 @@ public interface Resource extends Adapta
      *
      * @see ResourceMetadata
      */
-    ResourceMetadata getResourceMetadata();
+    @Nonnull ResourceMetadata getResourceMetadata();
 
     /**
      * Returns the {@link ResourceResolver} from which this resource has been
      * retrieved.
      */
-    ResourceResolver getResourceResolver();
+    @Nonnull ResourceResolver getResourceResolver();
 
     /**
      * Returns a value map for this resource.
@@ -181,5 +184,5 @@ public interface Resource extends Adapta
      * @return A value map
      * @since 2.5 (Sling API Bundle 2.7.0)
      */
-    ValueMap getValueMap();
+    @Nonnull ValueMap getValueMap();
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceDecorator.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceDecorator.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceDecorator.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceDecorator.java Tue Feb 17 10:32:22 2015
@@ -16,6 +16,8 @@
  */
 package org.apache.sling.api.resource;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import javax.servlet.http.HttpServletRequest;
 
 import aQute.bnd.annotation.ConsumerType;
@@ -43,7 +45,7 @@ public interface ResourceDecorator {
      * @param resource The resource to decorate
      * @return The decorated resource, the original resource or null.
      */
-    Resource decorate(Resource resource);
+    @CheckForNull Resource decorate(@Nonnull Resource resource);
 
     /**
      * Decorate a resource.
@@ -59,5 +61,5 @@ public interface ResourceDecorator {
      * @deprecated since 2.3.0 (and JCR Resource 2.1.0), this method will not be invoked.
      */
     @Deprecated
-    Resource decorate(Resource resource, HttpServletRequest request);
+    @CheckForNull Resource decorate(@Nonnull Resource resource, @Nonnull HttpServletRequest request);
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceMetadata.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceMetadata.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceMetadata.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceMetadata.java Tue Feb 17 10:32:22 2015
@@ -25,6 +25,9 @@ import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 /**
  * The <code>ResourceMetadata</code> interface defines the API for the
  * metadata of a Sling {@link Resource}. Essentially the resource's metadata is
@@ -151,7 +154,7 @@ public class ResourceMetadata extends Ha
      * and a <code>String</code> instance. Otherwise <code>null</code> is
      * returned.
      */
-    public String getCharacterEncoding() {
+    public @CheckForNull String getCharacterEncoding() {
         Object value = get(CHARACTER_ENCODING);
         if (value instanceof String) {
             return (String) value;
@@ -175,7 +178,7 @@ public class ResourceMetadata extends Ha
      * a <code>String</code> instance. Otherwise <code>null</code> is
      * returned.
      */
-    public String getContentType() {
+    public @CheckForNull String getContentType() {
         Object value = get(CONTENT_TYPE);
         if (value instanceof String) {
             return (String) value;
@@ -268,7 +271,7 @@ public class ResourceMetadata extends Ha
      * and a <code>String</code> instance. Otherwise <code>null</code> is
      * returned.
      */
-    public String getResolutionPath() {
+    public @CheckForNull String getResolutionPath() {
         Object value = get(RESOLUTION_PATH);
         if (value instanceof String) {
             return (String) value;
@@ -292,7 +295,7 @@ public class ResourceMetadata extends Ha
      * <code>null</code> and a <code>String</code> instance. Otherwise
      * <code>null</code> is returned.
      */
-    public String getResolutionPathInfo() {
+    public @CheckForNull String getResolutionPathInfo() {
         Object value = get(RESOLUTION_PATH_INFO);
         if (value instanceof String) {
             return (String) value;
@@ -317,7 +320,7 @@ public class ResourceMetadata extends Ha
      * <code>null</code> is returned.
      */
     @SuppressWarnings("unchecked")
-    public Map<String, String> getParameterMap() {
+    public @CheckForNull Map<String, String> getParameterMap() {
         Object value = get(PARAMETER_MAP);
         if (value instanceof Map) {
             return (Map<String, String>) value;
@@ -352,24 +355,24 @@ public class ResourceMetadata extends Ha
     }
 
     @Override
-    public Object put(final String key, final Object value) {
+    public Object put(@Nonnull final String key, final Object value) {
         this.checkReadOnly();
         return super.put(key, value);
     }
 
     @Override
-    public void putAll(final Map<? extends String, ? extends Object> m) {
+    public void putAll(@Nonnull final Map<? extends String, ? extends Object> m) {
         this.checkReadOnly();
         super.putAll(m);
     }
 
     @Override
-    public Object remove(final Object key) {
+    public Object remove(@Nonnull final Object key) {
         this.checkReadOnly();
         return super.remove(key);
     }
     
-    protected void internalPut(String key, Object value) {
+    protected void internalPut(@Nonnull String key, Object value) {
         super.put(key, value);
     }
     
@@ -400,19 +403,19 @@ public class ResourceMetadata extends Ha
     }
 
     @Override
-    public Set<Map.Entry<String, Object>> entrySet() {
+    public @Nonnull Set<Map.Entry<String, Object>> entrySet() {
         getLockedData();
         return lockedEntrySet != null ? lockedEntrySet : super.entrySet();
     }
 
     @Override
-    public Set<String> keySet() {
+    public @Nonnull Set<String> keySet() {
         getLockedData();
         return lockedKeySet != null ? lockedKeySet : super.keySet();
     }
 
     @Override
-    public Collection<Object> values() {
+    public @Nonnull Collection<Object> values() {
         getLockedData();
         return lockedValues != null ? lockedValues : super.values();
     }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProvider.java Tue Feb 17 10:32:22 2015
@@ -20,6 +20,8 @@ package org.apache.sling.api.resource;
 
 import java.util.Iterator;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.sling.api.SlingException;
@@ -111,7 +113,7 @@ public interface ResourceProvider {
      * @deprecated since 2.2.0 (and JCR Resource 2.1.0), this method will not be invoked.
      */
     @Deprecated
-    Resource getResource(ResourceResolver resourceResolver, HttpServletRequest request, String path);
+    @CheckForNull Resource getResource(@Nonnull ResourceResolver resourceResolver, @Nonnull HttpServletRequest request, @Nonnull String path);
 
     /**
      * Returns a resource from this resource provider or <code>null</code> if
@@ -131,7 +133,7 @@ public interface ResourceProvider {
      * @throws org.apache.sling.api.SlingException
      *             may be thrown in case of any problem creating the <code>Resource</code> instance.
      */
-    Resource getResource(ResourceResolver resourceResolver, String path);
+    @CheckForNull Resource getResource(@Nonnull ResourceResolver resourceResolver, @Nonnull String path);
 
     /**
      * Returns an <code>Iterator</code> of {@link Resource} objects loaded from
@@ -162,5 +164,5 @@ public interface ResourceProvider {
      * @throws SlingException
      *             If any error occurs acquiring the child resource iterator.
      */
-    Iterator<Resource> listChildren(Resource parent);
+    @CheckForNull Iterator<Resource> listChildren(@Nonnull Resource parent);
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceProviderFactory.java Tue Feb 17 10:32:22 2015
@@ -20,6 +20,8 @@ package org.apache.sling.api.resource;
 
 import java.util.Map;
 
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ConsumerType;
 
 /**
@@ -99,7 +101,7 @@ public interface ResourceProviderFactory
      *      href="http://sling.apache.org/documentation/the-sling-engine/service-authentication.html">Service
      *      Authentication</a>
      */
-    ResourceProvider getResourceProvider(Map<String, Object> authenticationInfo) throws LoginException;
+    @Nonnull ResourceProvider getResourceProvider(Map<String, Object> authenticationInfo) throws LoginException;
 
     /**
      * Returns a new {@link ResourceProvider} instance with administrative
@@ -132,5 +134,5 @@ public interface ResourceProviderFactory
      *             {@link ResourceResolverFactory#SUBSERVICE} properties.
      */
     @Deprecated
-    ResourceProvider getAdministrativeResourceProvider(Map<String, Object> authenticationInfo) throws LoginException;
+    @Nonnull ResourceProvider getAdministrativeResourceProvider(Map<String, Object> authenticationInfo) throws LoginException;
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolver.java Tue Feb 17 10:32:22 2015
@@ -21,6 +21,8 @@ package org.apache.sling.api.resource;
 import java.util.Iterator;
 import java.util.Map;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.sling.api.adapter.Adaptable;
@@ -169,7 +171,7 @@ public interface ResourceResolver extend
      *             {@link #close() closed}.
      * @since 2.0.4 (Sling API Bundle 2.0.4)
      */
-    Resource resolve(HttpServletRequest request, String absPath);
+    @Nonnull Resource resolve(@Nonnull HttpServletRequest request, @Nonnull String absPath);
 
     /**
      * Resolves the resource from the given absolute path. Returns a
@@ -197,7 +199,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Resource resolve(String absPath);
+    @Nonnull Resource resolve(@Nonnull String absPath);
 
     /**
      * Resolves the resource from the given <code>HttpServletRequest</code>.
@@ -225,7 +227,7 @@ public interface ResourceResolver extend
      *             instead.
      */
     @Deprecated
-    Resource resolve(HttpServletRequest request);
+    @Nonnull Resource resolve(@Nonnull HttpServletRequest request);
 
     /**
      * Returns a path mapped from the (resource) path applying the reverse
@@ -248,7 +250,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    String map(String resourcePath);
+    @Nonnull String map(@Nonnull String resourcePath);
 
     /**
      * Returns an URL mapped from the (resource) path applying the reverse
@@ -277,7 +279,7 @@ public interface ResourceResolver extend
      *             {@link #close() closed}.
      * @since 2.0.4 (Sling API Bundle 2.0.4)
      */
-    String map(HttpServletRequest request, String resourcePath);
+    @CheckForNull String map(@Nonnull HttpServletRequest request, @Nonnull String resourcePath);
 
     /**
      * Returns a {@link Resource} object for data located at the given path.
@@ -304,7 +306,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Resource getResource(String path);
+    @CheckForNull Resource getResource(@Nonnull String path);
 
     /**
      * Returns a {@link Resource} object for data located at the given path.
@@ -334,7 +336,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Resource getResource(Resource base, String path);
+    @CheckForNull Resource getResource(Resource base, @Nonnull String path);
 
     /**
      * Returns the search path used by the {@link #getResource(String)} method
@@ -357,7 +359,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    String[] getSearchPath();
+    @Nonnull String[] getSearchPath();
 
     /**
      * Returns an <code>Iterator</code> of {@link Resource} objects loaded from
@@ -377,7 +379,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Iterator<Resource> listChildren(Resource parent);
+    @Nonnull Iterator<Resource> listChildren(@Nonnull Resource parent);
 
     /**
      * Returns an <code>Iterable</code> of {@link Resource} objects loaded from
@@ -398,7 +400,7 @@ public interface ResourceResolver extend
      *             {@link #close() closed}.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
-    Iterable<Resource> getChildren(Resource parent);
+    @Nonnull Iterable<Resource> getChildren(@Nonnull Resource parent);
 
     /**
      * Searches for resources using the given query formulated in the given
@@ -425,7 +427,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Iterator<Resource> findResources(String query, String language);
+    @Nonnull Iterator<Resource> findResources(@Nonnull String query, String language);
 
     /**
      * Queries the storage using the given query formulated in the given
@@ -455,7 +457,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Iterator<Map<String, Object>> queryResources(String query, String language);
+    @Nonnull Iterator<Map<String, Object>> queryResources(@Nonnull String query, String language);
 
     /**
      * Checks if the specified resource has any direct child resources.
@@ -465,7 +467,7 @@ public interface ResourceResolver extend
      * @return <code>true</code> if the resource has any child resources
      * @since 2.4.4 (Sling API Bundle 2.5.0)
      */
-    boolean hasChildren(Resource resource);
+    boolean hasChildren(@Nonnull Resource resource);
 
     /**
      * Returns a new <code>ResourceResolver</code> instance based on the given
@@ -495,7 +497,7 @@ public interface ResourceResolver extend
      *             {@link #close() closed}.
      * @since 2.1 (Sling API Bundle 2.1.0)
      */
-    ResourceResolver clone(Map<String, Object> authenticationInfo)
+    @Nonnull ResourceResolver clone(Map<String, Object> authenticationInfo)
             throws LoginException;
 
     /**
@@ -534,7 +536,7 @@ public interface ResourceResolver extend
      *             {@link #close() closed}.
      * @since 2.1 (Sling API Bundle 2.1.0)
      */
-    String getUserID();
+    @CheckForNull String getUserID();
 
     /**
      * Returns an iterator of attribute names whose value can be retrieved
@@ -545,7 +547,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Iterator<String> getAttributeNames();
+    @Nonnull Iterator<String> getAttributeNames();
 
     /**
      * Returns the value of the given resource resolver attribute or
@@ -560,7 +562,7 @@ public interface ResourceResolver extend
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
      */
-    Object getAttribute(String name);
+    @CheckForNull Object getAttribute(@Nonnull String name);
 
     /**
      * Delete the resource
@@ -575,7 +577,7 @@ public interface ResourceResolver extend
      * @throws PersistenceException If the operation fails.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
-    void delete(Resource resource)
+    void delete(@Nonnull Resource resource)
     throws PersistenceException;
 
     /**
@@ -592,7 +594,7 @@ public interface ResourceResolver extend
      * @throws PersistenceException If the operation fails.
      * @since 2.2 (Sling API Bundle 2.2.0)
      */
-    Resource create(Resource parent, String name, Map<String, Object> properties)
+    @Nonnull Resource create(@Nonnull Resource parent, @Nonnull String name, Map<String, Object> properties)
     throws PersistenceException;
 
     /**
@@ -628,7 +630,7 @@ public interface ResourceResolver extend
      *         provided resource is <code>null</code>
      * @since 2.3 (Sling API Bundle 2.4.0)
      */
-    String getParentResourceType(final Resource resource);
+    @CheckForNull String getParentResourceType(final Resource resource);
 
     /**
      * Returns the super type of the given resource type. This method converts
@@ -643,7 +645,7 @@ public interface ResourceResolver extend
      *         <code>null</code> if <code>resourceType> is null.
      * @since 2.3 (Sling API Bundle 2.4.0)
      */
-    public String getParentResourceType(final String resourceType);
+    public @CheckForNull String getParentResourceType(final String resourceType);
 
     /**
      * Returns <code>true</code> if the resource type or any of the resource's

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolverFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolverFactory.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolverFactory.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceResolverFactory.java Tue Feb 17 10:32:22 2015
@@ -20,6 +20,9 @@ package org.apache.sling.api.resource;
 
 import java.util.Map;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import aQute.bnd.annotation.ProviderType;
 
 /**
@@ -117,7 +120,7 @@ public interface ResourceResolverFactory
      *             <code>ResourceResolver</code> with the provided credential
      *             data.
      */
-    ResourceResolver getResourceResolver(Map<String, Object> authenticationInfo) throws LoginException;
+    @Nonnull ResourceResolver getResourceResolver(Map<String, Object> authenticationInfo) throws LoginException;
 
     /**
      * Returns a new {@link ResourceResolver} instance with administrative
@@ -154,7 +157,7 @@ public interface ResourceResolverFactory
      *             the {@link #getServiceResourceResolver(Map)} instead.
      */
     @Deprecated
-    ResourceResolver getAdministrativeResourceResolver(Map<String, Object> authenticationInfo) throws LoginException;
+    @Nonnull ResourceResolver getAdministrativeResourceResolver(Map<String, Object> authenticationInfo) throws LoginException;
 
     /**
      * Returns a new {@link ResourceResolver} instance with privileges assigned
@@ -183,7 +186,7 @@ public interface ResourceResolverFactory
      *      href="http://sling.apache.org/documentation/the-sling-engine/service-authentication.html">Service
      *      Authentication</a>
      */
-    ResourceResolver getServiceResourceResolver(Map<String, Object> authenticationInfo) throws LoginException;
+    @Nonnull ResourceResolver getServiceResourceResolver(Map<String, Object> authenticationInfo) throws LoginException;
 
     /**
      * Returns the {@link ResourceResolver} for the current thread.
@@ -197,5 +200,5 @@ public interface ResourceResolverFactory
      *
      * @since 2.6 (Sling API Bundle 2.8.0)
      */
-    ResourceResolver getThreadResourceResolver();
+    @CheckForNull ResourceResolver getThreadResourceResolver();
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceUtil.java Tue Feb 17 10:32:22 2015
@@ -25,6 +25,9 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.NoSuchElementException;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.wrappers.ValueMapDecorator;
 
 /**
@@ -41,7 +44,7 @@ public class ResourceUtil {
      * Returns null if not possible (.. points above root) or if path is not
      * absolute.
      */
-    public static String normalize(String path) {
+    public static @CheckForNull String normalize(@Nonnull String path) {
 
         // don't care for empty paths
         if (path.length() == 0) {
@@ -125,7 +128,7 @@ public class ResourceUtil {
      *             {@link #normalize(String)} method.
      * @throws NullPointerException If <code>path</code> is <code>null</code>.
      */
-    public static String getParent(String path) {
+    public static @CheckForNull String getParent(@Nonnull String path) {
         if ("/".equals(path)) {
             return null;
         }
@@ -208,7 +211,7 @@ public class ResourceUtil {
      * @deprecated since 2.1.0, use {@link Resource#getParent()} instead
      */
     @Deprecated
-    public static Resource getParent(Resource rsrc) {
+    public static @CheckForNull Resource getParent(@Nonnull Resource rsrc) {
         return rsrc.getParent();
     }
 
@@ -219,7 +222,7 @@ public class ResourceUtil {
      * @deprecated since 2.1.0, use {@link Resource#getName()} instead
      */
     @Deprecated
-    public static String getName(Resource rsrc) {
+    public static @Nonnull String getName(@Nonnull Resource rsrc) {
         /*
          * Same as AbstractResource.getName() implementation to prevent problems
          * if there are implementations of the pre-2.1.0 Resource interface in
@@ -241,7 +244,7 @@ public class ResourceUtil {
      *             {@link #normalize(String)} method.
      * @throws NullPointerException If <code>path</code> is <code>null</code>.
      */
-    public static String getName(String path) {
+    public static @Nonnull String getName(@Nonnull String path) {
         if ("/".equals(path)) {
             return "";
         }
@@ -270,7 +273,7 @@ public class ResourceUtil {
      *         <code>null</code> or not an instance of the
      *         <code>org.apache.sling.resource.SyntheticResource</code> class.
      */
-    public static boolean isSyntheticResource(Resource res) {
+    public static boolean isSyntheticResource(@Nonnull Resource res) {
         if (res instanceof SyntheticResource) {
             return true;
         }
@@ -304,7 +307,7 @@ public class ResourceUtil {
      *         resource.
      * @throws NullPointerException if <code>res</code> is <code>null</code>.
      */
-    public static boolean isStarResource(Resource res) {
+    public static boolean isStarResource(@Nonnull Resource res) {
         return res.getPath().endsWith("/*");
     }
 
@@ -322,7 +325,7 @@ public class ResourceUtil {
      *         non-existing resource.
      * @throws NullPointerException if <code>res</code> is <code>null</code>.
      */
-    public static boolean isNonExistingResource(Resource res) {
+    public static boolean isNonExistingResource(@Nonnull Resource res) {
         return Resource.RESOURCE_TYPE_NON_EXISTING.equals(res.getResourceType());
     }
 
@@ -342,7 +345,7 @@ public class ResourceUtil {
      * @deprecated since 2.1.0, use {@link Resource#listChildren()} instead
      */
     @Deprecated
-    public static Iterator<Resource> listChildren(Resource parent) {
+    public static @Nonnull Iterator<Resource> listChildren(@Nonnull Resource parent) {
         /*
          * Same as AbstractResource.listChildren() implementation to prevent
          * problems if there are implementations of the pre-2.1.0 Resource
@@ -362,7 +365,7 @@ public class ResourceUtil {
      * @param res The <code>Resource</code> to adapt to the value map.
      * @return A value map.
      */
-    public static ValueMap getValueMap(final Resource res) {
+    public static @Nonnull ValueMap getValueMap(@Nonnull final Resource res) {
         if ( res == null ) {
             // use empty map
             return new ValueMapDecorator(new HashMap<String, Object>());
@@ -379,7 +382,7 @@ public class ResourceUtil {
      * @return The resource type as a path.
      * @since 2.0.6 (Sling API Bundle 2.0.6)
      */
-    public static String resourceTypeToPath(final String type) {
+    public static @Nonnull String resourceTypeToPath(@Nonnull final String type) {
         return type.replace(':', '/');
     }
 
@@ -405,8 +408,8 @@ public class ResourceUtil {
      * @deprecated Use {@link ResourceResolver#getParentResourceType(String)}
      */
     @Deprecated
-    public static String getResourceSuperType(
-            final ResourceResolver resourceResolver, final String resourceType) {
+    public static @CheckForNull String getResourceSuperType(
+            final @Nonnull ResourceResolver resourceResolver, final String resourceType) {
         return resourceResolver.getParentResourceType(resourceType);
     }
 
@@ -424,7 +427,7 @@ public class ResourceUtil {
      * @deprecated Use {@link ResourceResolver#getParentResourceType(Resource)}
      */
     @Deprecated
-    public static String findResourceSuperType(final Resource resource) {
+    public static @CheckForNull String findResourceSuperType(@Nonnull final Resource resource) {
         if ( resource == null ) {
             return null;
         }
@@ -446,7 +449,7 @@ public class ResourceUtil {
      * @deprecated Use {@link ResourceResolver#isResourceType(Resource, String)}
      */
     @Deprecated
-    public static boolean isA(final Resource resource, final String resourceType) {
+    public static boolean isA(@Nonnull final Resource resource, final String resourceType) {
         if ( resource == null ) {
             return false;
         }
@@ -465,7 +468,7 @@ public class ResourceUtil {
      * @param <T> The adapted type
      * @since 2.0.6 (Sling API Bundle 2.0.6)
      */
-    public static <T> Iterator<T> adaptTo(final Iterator<Resource> iterator,
+    public static @Nonnull <T> Iterator<T> adaptTo(final @Nonnull Iterator<Resource> iterator,
             final Class<T> type) {
         return new Iterator<T>() {
 
@@ -509,9 +512,9 @@ public class ResourceUtil {
      * @param autoCommit If set to true, a commit is performed after each resource creation.
      * @since 2.3.0  (Sling API Bundle 2.4.0)
      */
-    public static Resource getOrCreateResource(
-                            final ResourceResolver resolver,
-                            final String path,
+    public static @Nonnull Resource getOrCreateResource(
+                            final @Nonnull ResourceResolver resolver,
+                            final @Nonnull String path,
                             final String resourceType,
                             final String intermediateResourceType,
                             final boolean autoCommit)
@@ -538,9 +541,9 @@ public class ResourceUtil {
      * @param autoCommit If set to true, a commit is performed after each resource creation.
      * @since 2.3.0  (Sling API Bundle 2.4.0)
      */
-    public static Resource getOrCreateResource(
-            final ResourceResolver resolver,
-            final String path,
+    public static @Nonnull Resource getOrCreateResource(
+            final @Nonnull ResourceResolver resolver,
+            final @Nonnull String path,
             final Map<String, Object> resourceProperties,
             final String intermediateResourceType,
             final boolean autoCommit)
@@ -688,7 +691,7 @@ public class ResourceUtil {
      * @return The unwrapped resource
      * @since 2.5  (Sling API Bundle 2.7.0)
      */
-    public static Resource unwrap(final Resource rsrc) {
+    public static @Nonnull Resource unwrap(final @Nonnull Resource rsrc) {
         Resource result = rsrc;
         while ( result instanceof ResourceWrapper ) {
             result = ((ResourceWrapper)result).getResource();
@@ -714,7 +717,7 @@ public class ResourceUtil {
             this.max = (batchSize < 1 ? 50 : batchSize);
         }
 
-        public void delete(final Resource rsrc)
+        public void delete(@Nonnull final Resource rsrc)
         throws PersistenceException {
             final ResourceResolver resolver = rsrc.getResourceResolver();
             for(final Resource child : rsrc.getChildren()) {
@@ -741,7 +744,7 @@ public class ResourceUtil {
      * @return A new batch resource remover.
      * Since 2.6
      */
-    public static BatchResourceRemover getBatchResourceRemover(final int threshold) {
+    public static @Nonnull BatchResourceRemover getBatchResourceRemover(final int threshold) {
         return new BatchResourceRemover(threshold);
     }
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ResourceWrapper.java Tue Feb 17 10:32:22 2015
@@ -20,6 +20,8 @@ package org.apache.sling.api.resource;
 
 import java.util.Iterator;
 
+import javax.annotation.Nonnull;
+
 /**
  * The <code>ResourceWrapper</code> is a wrapper for any <code>Resource</code>
  * delegating all method calls to the wrapped resource by default. Extensions of
@@ -35,7 +37,7 @@ public class ResourceWrapper implements
      * Creates a new wrapper instance delegating all method calls to the given
      * <code>resource</code>.
      */
-    public ResourceWrapper(final Resource resource) {
+    public ResourceWrapper(@Nonnull final Resource resource) {
         this.resource = resource;
     }
 

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ValueMap.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ValueMap.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ValueMap.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/resource/ValueMap.java Tue Feb 17 10:32:22 2015
@@ -21,6 +21,9 @@ package org.apache.sling.api.resource;
 import java.util.Collections;
 import java.util.Map;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.wrappers.ValueMapDecorator;
 
 import aQute.bnd.annotation.ConsumerType;
@@ -61,7 +64,7 @@ public interface ValueMap extends Map<St
      * @return Return named value converted to type T or <code>null</code> if
      *         non existing or can't be converted.
      */
-    <T> T get(String name, Class<T> type);
+    @CheckForNull <T> T get(@Nonnull String name, @Nonnull Class<T> type);
 
     /**
      * Get a named property and convert it into the given type.
@@ -78,5 +81,5 @@ public interface ValueMap extends Map<St
      * @return Return named value converted to type T or the default value if
      *         non existing or can't be converted.
      */
-    <T> T get(String name, T defaultValue);
+    <T> T get(@Nonnull String name, T defaultValue);
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingBindings.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingBindings.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingBindings.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingBindings.java Tue Feb 17 10:32:22 2015
@@ -22,6 +22,8 @@ import java.io.PrintWriter;
 import java.io.Reader;
 import java.util.HashMap;
 
+import javax.annotation.CheckForNull;
+
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.resource.Resource;
@@ -195,7 +197,7 @@ public class SlingBindings extends HashM
      * <code>org.slf4j.Logger</code> instance. Otherwise <code>null</code>
      * is returned.
      */
-    public Logger getLog() {
+    public @CheckForNull Logger getLog() {
         return this.get(LOG, Logger.class);
     }
 
@@ -212,7 +214,7 @@ public class SlingBindings extends HashM
      * <code>PrintWriter</code> instance. Otherwise <code>null</code> is
      * returned.
      */
-    public PrintWriter getOut() {
+    public @CheckForNull PrintWriter getOut() {
         return this.get(OUT, PrintWriter.class);
     }
 
@@ -229,7 +231,7 @@ public class SlingBindings extends HashM
      * <code>SlingHttpServletRequest</code> instance. Otherwise
      * <code>null</code> is returned.
      */
-    public SlingHttpServletRequest getRequest() {
+    public @CheckForNull SlingHttpServletRequest getRequest() {
         return this.get(REQUEST, SlingHttpServletRequest.class);
     }
 
@@ -246,7 +248,7 @@ public class SlingBindings extends HashM
      * <code>Reader</code> instance. Otherwise <code>null</code> is
      * returned.
      */
-    public Reader getReader() {
+    public @CheckForNull Reader getReader() {
         return this.get(READER, Reader.class);
     }
 
@@ -263,7 +265,7 @@ public class SlingBindings extends HashM
      * <code>Resource</code> instance. Otherwise <code>null</code> is
      * returned.
      */
-    public Resource getResource() {
+    public @CheckForNull Resource getResource() {
         return this.get(RESOURCE, Resource.class);
     }
 
@@ -280,7 +282,7 @@ public class SlingBindings extends HashM
      * <code>SlingHttpServletResponse</code> instance. Otherwise
      * <code>null</code> is returned.
      */
-    public SlingHttpServletResponse getResponse() {
+    public @CheckForNull SlingHttpServletResponse getResponse() {
         return this.get(RESPONSE, SlingHttpServletResponse.class);
     }
 
@@ -297,7 +299,7 @@ public class SlingBindings extends HashM
      * <code>SlingScriptHelper</code> instance. Otherwise <code>null</code>
      * is returned.
      */
-    public SlingScriptHelper getSling() {
+    public @CheckForNull SlingScriptHelper getSling() {
         return this.get(SLING, SlingScriptHelper.class);
     }
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScript.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,8 @@
  */
 package org.apache.sling.api.scripting;
 
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.resource.Resource;
 
 import aQute.bnd.annotation.ConsumerType;
@@ -39,7 +41,7 @@ public interface SlingScript {
     /**
      * Returns the Resource providing the script source code.
      */
-    Resource getScriptResource();
+    @Nonnull Resource getScriptResource();
 
     /**
      * Evaluates this script using the bound variables as global variables to
@@ -54,7 +56,7 @@ public interface SlingScript {
      *             script or preparing the script execution. The cause of the
      *             evaluation execption is available as the exception cause.
      */
-    Object eval(SlingBindings props);
+    Object eval(@Nonnull SlingBindings props);
 
     /**
      * Evaluates this script using the bound variables as global variables to
@@ -71,5 +73,5 @@ public interface SlingScript {
      *             script or preparing the script execution. The cause of the
      *             evaluation execption is available as the exception cause.
      */
-    Object call(SlingBindings props, String method, Object... args);
+    Object call(@Nonnull SlingBindings props, @Nonnull String method, Object... args);
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptHelper.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.api.scripting;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.SlingHttpServletRequest;
 import org.apache.sling.api.SlingHttpServletResponse;
 import org.apache.sling.api.request.RequestDispatcherOptions;
@@ -37,18 +40,18 @@ public interface SlingScriptHelper {
      * Returns the {@link SlingHttpServletRequest} representing the input of the
      * request.
      */
-    SlingHttpServletRequest getRequest();
+    @Nonnull SlingHttpServletRequest getRequest();
 
     /**
      * Returns the {@link SlingHttpServletResponse} representing the output of
      * the request.
      */
-    SlingHttpServletResponse getResponse();
+    @Nonnull SlingHttpServletResponse getResponse();
 
     /**
      * Returns the {@link SlingScript} being called to handle the request.
      */
-    SlingScript getScript();
+    @Nonnull SlingScript getScript();
 
     /**
      * Same as {@link #include(String,RequestDispatcherOptions)}, but using
@@ -59,7 +62,7 @@ public interface SlingScriptHelper {
      * @throws org.apache.sling.api.SlingServletException Wrapping a <code>ServletException</code>
      *             thrown while handling the include.
      */
-    void include(String path);
+    void include(@Nonnull String path);
 
     /**
      * Helper method to include the result of processing the request for the
@@ -90,7 +93,7 @@ public interface SlingScriptHelper {
      * @see RequestDispatcherOptions#RequestDispatcherOptions(String)
      * @see #include(String, RequestDispatcherOptions)
      */
-    void include(String path, String requestDispatcherOptions);
+    void include(@Nonnull String path, String requestDispatcherOptions);
 
     /**
      * Helper method to include the result of processing the request for the
@@ -115,7 +118,7 @@ public interface SlingScriptHelper {
      * @see RequestDispatcherOptions
      * @see #include(String, String)
      */
-    void include(String path, RequestDispatcherOptions options);
+    void include(@Nonnull String path, RequestDispatcherOptions options);
 
     /**
      * Same as {@link #include(Resource,RequestDispatcherOptions)}, but using
@@ -126,7 +129,7 @@ public interface SlingScriptHelper {
      * @throws org.apache.sling.api.SlingServletException Wrapping a <code>ServletException</code>
      *             thrown while handling the include.
      */
-    void include(Resource resource);
+    void include(@Nonnull Resource resource);
 
     /**
      * Helper method to include the result of processing the request for the
@@ -157,7 +160,7 @@ public interface SlingScriptHelper {
      * @see RequestDispatcherOptions#RequestDispatcherOptions(String)
      * @see #include(String, RequestDispatcherOptions)
      */
-    void include(Resource resource, String requestDispatcherOptions);
+    void include(@Nonnull Resource resource, String requestDispatcherOptions);
 
     /**
      * Helper method to include the result of processing the request for the
@@ -182,7 +185,7 @@ public interface SlingScriptHelper {
      * @see RequestDispatcherOptions
      * @see #include(String, String)
      */
-    void include(Resource resource, RequestDispatcherOptions options);
+    void include(@Nonnull Resource resource, RequestDispatcherOptions options);
 
     /**
      * Same as {@link #forward(String,RequestDispatcherOptions)}, but using
@@ -193,7 +196,7 @@ public interface SlingScriptHelper {
      * @throws org.apache.sling.api.SlingServletException Wrapping a <code>ServletException</code>
      *             thrown while handling the forward.
      */
-    void forward(String path);
+    void forward(@Nonnull String path);
 
     /**
      * Helper method to forward the request to a Servlet or script for the given
@@ -224,7 +227,7 @@ public interface SlingScriptHelper {
      * @see RequestDispatcherOptions#RequestDispatcherOptions(String)
      * @see #forward(String, RequestDispatcherOptions)
      */
-    void forward(String path, String requestDispatcherOptions);
+    void forward(@Nonnull String path, String requestDispatcherOptions);
 
     /**
      * Helper method to forward the request to a Servlet or script for the given
@@ -249,7 +252,7 @@ public interface SlingScriptHelper {
      * @throws IllegalStateException If the respoonse has already been committed
      * @see RequestDispatcherOptions
      */
-    void forward(String path, RequestDispatcherOptions options);
+    void forward(@Nonnull String path, RequestDispatcherOptions options);
 
     /**
      * Same as {@link #forward(Resource,RequestDispatcherOptions)}, but using
@@ -260,7 +263,7 @@ public interface SlingScriptHelper {
      * @throws org.apache.sling.api.SlingServletException Wrapping a <code>ServletException</code>
      *             thrown while handling the forward.
      */
-    void forward(Resource resource);
+    void forward(@Nonnull Resource resource);
 
     /**
      * Helper method to forward the request to a Servlet or script for the given
@@ -291,7 +294,7 @@ public interface SlingScriptHelper {
      * @see RequestDispatcherOptions#RequestDispatcherOptions(String)
      * @see #forward(String, RequestDispatcherOptions)
      */
-    void forward(Resource resource, String requestDispatcherOptions);
+    void forward(@Nonnull Resource resource, String requestDispatcherOptions);
 
     /**
      * Helper method to forward the request to a Servlet or script for the given
@@ -316,7 +319,7 @@ public interface SlingScriptHelper {
      * @throws IllegalStateException If the respoonse has already been committed
      * @see RequestDispatcherOptions
      */
-    void forward(Resource resource, RequestDispatcherOptions options);
+    void forward(@Nonnull Resource resource, RequestDispatcherOptions options);
 
     /**
      * Lookup a single service
@@ -324,7 +327,7 @@ public interface SlingScriptHelper {
      * @param serviceType The type (interface) of the service.
      * @return The service instance, or null if the service is not available.
      */
-    <ServiceType> ServiceType getService(Class<ServiceType> serviceType);
+    @CheckForNull <ServiceType> ServiceType getService(@Nonnull Class<ServiceType> serviceType);
 
     /**
      * Lookup one or several services
@@ -335,7 +338,7 @@ public interface SlingScriptHelper {
      * @throws InvalidServiceFilterSyntaxException If the <code>filter</code>
      *             string is not a valid OSGi service filter string.
      */
-    <ServiceType> ServiceType[] getServices(Class<ServiceType> serviceType,
+    @CheckForNull <ServiceType> ServiceType[] getServices(@Nonnull Class<ServiceType> serviceType,
             String filter);
 
     /**

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/SlingScriptResolver.java Tue Feb 17 10:32:22 2015
@@ -16,6 +16,9 @@
  */
 package org.apache.sling.api.scripting;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.resource.ResourceResolver;
 
 import aQute.bnd.annotation.ProviderType;
@@ -48,5 +51,5 @@ public interface SlingScriptResolver {
      *         <code>null</code> otherwise.
      * @throws org.apache.sling.api.SlingException If an error occurrs trying to resolve the name.
      */
-    SlingScript findScript(ResourceResolver resourceResolver, String name);
+    @CheckForNull SlingScript findScript(@Nonnull ResourceResolver resourceResolver, @Nonnull String name);
 }

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/package-info.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/package-info.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/scripting/package-info.java Tue Feb 17 10:32:22 2015
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.1")
+@Version("2.1.1")
 package org.apache.sling.api.scripting;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/ResourceAccessSecurity.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/ResourceAccessSecurity.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/ResourceAccessSecurity.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/ResourceAccessSecurity.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,9 @@
  */
 package org.apache.sling.api.security;
 
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 
@@ -82,29 +85,29 @@ public interface ResourceAccessSecurity
      *  instead of the one that was passed into the method.
      *  @return null if {@link Resource} cannot be read
      */
-    Resource getReadableResource(Resource resource);
+    @CheckForNull Resource getReadableResource(Resource resource);
 
     /** @return true if a {@link Resource} can be created at the supplied
      *  absolute path. */
-    boolean canCreate(String absPathName, ResourceResolver resourceResolver);
+    boolean canCreate(@Nonnull String absPathName, @Nonnull ResourceResolver resourceResolver);
 
     /** @return true if supplied {@link Resource} can be updated */
-    boolean canUpdate(Resource resource);
+    boolean canUpdate(@Nonnull Resource resource);
 
     /** @return true if supplied {@link Resource} can be deleted */
-    boolean canDelete(Resource resource);
+    boolean canDelete(@Nonnull Resource resource);
 
     /** @return true if supplied {@link Resource} can be executed as a script */
-    boolean canExecute(Resource resource);
+    boolean canExecute(@Nonnull Resource resource);
 
     /** @return true if the "valueName" value of supplied {@link Resource} can be read */
-    boolean canReadValue(Resource resource, String valueName);
+    boolean canReadValue(@Nonnull Resource resource, @Nonnull String valueName);
 
     /** @return true if the "valueName" value of supplied {@link Resource} can be set */
-    boolean canSetValue(Resource resource, String valueName);
+    boolean canSetValue(@Nonnull Resource resource, @Nonnull String valueName);
 
     /** @return true if the "valueName" value of supplied {@link Resource} can be deleted */
-    boolean canDeleteValue(Resource resource, String valueName);
+    boolean canDeleteValue(@Nonnull Resource resource, @Nonnull String valueName);
 
     /**
      * Optionally transform a query based on the current
@@ -121,7 +124,7 @@ public interface ResourceAccessSecurity
      * @return the transformed query
      * @throws AccessSecurityException
      */
-    String transformQuery(String query, String language, ResourceResolver resourceResolver)
+    @Nonnull String transformQuery(@Nonnull String query, @Nonnull String language, @Nonnull ResourceResolver resourceResolver)
     throws AccessSecurityException;
 
 }
\ No newline at end of file

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/package-info.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/package-info.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/security/package-info.java Tue Feb 17 10:32:22 2015
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.0")
+@Version("1.0.1")
 package org.apache.sling.api.security;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java?rev=1660344&r1=1660343&r2=1660344&view=diff
==============================================================================
--- sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java (original)
+++ sling/trunk/bundles/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java Tue Feb 17 10:32:22 2015
@@ -18,6 +18,7 @@
  */
 package org.apache.sling.api.servlets;
 
+import javax.annotation.Nonnull;
 import javax.servlet.Servlet;
 
 import org.apache.sling.api.SlingHttpServletRequest;
@@ -48,6 +49,6 @@ public interface OptingServlet extends S
      * @return <code>true</code> if this servlet will handle the request,
      *         <code>false</code> otherwise
      */
-    boolean accepts(SlingHttpServletRequest request);
+    boolean accepts(@Nonnull SlingHttpServletRequest request);
 
 }