incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r824288 - in /sling/trunk/bundles/jcr/resource: pom.xml src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiablePropertyMap.java src/main/java/org/apache/sling/jcr/resource/internal/JcrPropertyMap.java
Date Mon, 12 Oct 2009 10:17:55 GMT
Author: cziegeler
Date: Mon Oct 12 10:17:55 2009
New Revision: 824288

URL: http://svn.apache.org/viewvc?rev=824288&view=rev
Log:
SLING-1153 : Throw NPE if key is null

Modified:
    sling/trunk/bundles/jcr/resource/pom.xml
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiablePropertyMap.java
    sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrPropertyMap.java

Modified: sling/trunk/bundles/jcr/resource/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/pom.xml?rev=824288&r1=824287&r2=824288&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/pom.xml (original)
+++ sling/trunk/bundles/jcr/resource/pom.xml Mon Oct 12 10:17:55 2009
@@ -113,16 +113,23 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.api</artifactId>
             <version>2.0.8</version>
+            <scope>provided</scope>
+        </dependency>
+       <dependency>
+           <groupId>javax.jcr</groupId>
+           <artifactId>jcr</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.jcr.api</artifactId>
             <version>2.0.2-incubator</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.adapter</artifactId>
             <version>2.0.2-incubator</version>
+            <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
@@ -132,6 +139,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.commons.classloader</artifactId>
             <version>0.9.0</version>
+            <scope>provided</scope>
         </dependency>
         
         <!--
@@ -142,6 +150,7 @@
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- For the Console Plugin of the JcrResourceResolverFactoryImpl -->
@@ -153,6 +162,7 @@
             <groupId>org.apache.felix</groupId>
             <artifactId>org.apache.felix.webconsole</artifactId>
             <version>1.2.0</version>
+            <scope>provided</scope>
         </dependency>
 
         <!-- for adapting JCR resources to URLs -->
@@ -165,7 +175,7 @@
         <dependency>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>jackrabbit-jcr-commons</artifactId>
-            <version>1.5.0</version>
+            <version>1.6.0</version>
             <scope>provided</scope>
         </dependency>
 

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiablePropertyMap.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiablePropertyMap.java?rev=824288&r1=824287&r2=824288&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiablePropertyMap.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrModifiablePropertyMap.java
Mon Oct 12 10:17:55 2009
@@ -69,7 +69,7 @@
      */
     public Object put(String aKey, Object value) {
         final String key = checkKey(aKey);
-        if ( key == null || key.indexOf('/') != -1 ) {
+        if ( key.indexOf('/') != -1 ) {
             throw new IllegalArgumentException("Invalid key: " + key);
         }
         if ( value == null ) {
@@ -109,9 +109,6 @@
      * @see java.util.Map#remove(java.lang.Object)
      */
     public Object remove(Object aKey) {
-        if ( aKey == null ) {
-            return null;
-        }
         final String key = checkKey(aKey.toString());
         readFully();
         final Object oldValue = this.cache.remove(key);

Modified: sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrPropertyMap.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrPropertyMap.java?rev=824288&r1=824287&r2=824288&view=diff
==============================================================================
--- sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrPropertyMap.java
(original)
+++ sling/trunk/bundles/jcr/resource/src/main/java/org/apache/sling/jcr/resource/internal/JcrPropertyMap.java
Mon Oct 12 10:17:55 2009
@@ -102,7 +102,10 @@
     // ---------- ValueMap
 
     protected String checkKey(final String key) {
-        if ( key != null && key.startsWith("./") ) {
+        if ( key == null ) {
+            throw new NullPointerException("Key must not be null.");
+        }
+        if ( key.startsWith("./") ) {
             return key.substring(2);
         }
         return key;
@@ -113,9 +116,6 @@
      */
     @SuppressWarnings("unchecked")
     public <T> T get(final String aKey, final Class<T> type) {
-        if ( aKey == null ) {
-            return null;
-        }
         final String key = checkKey(aKey);
         if (type == null) {
             return (T) get(key);
@@ -136,9 +136,6 @@
      */
     @SuppressWarnings("unchecked")
     public <T> T get(final String aKey,final T defaultValue) {
-        if ( aKey == null ) {
-            return null;
-        }
         final String key = checkKey(aKey);
         if (defaultValue == null) {
             return (T) get(key);
@@ -162,9 +159,6 @@
      * @see java.util.Map#get(java.lang.Object)
      */
     public Object get(final Object aKey) {
-        if ( aKey == null ) {
-            return null;
-        }
         final String key = checkKey(aKey.toString());
         CacheEntry entry = cache.get(key);
         if (entry == null) {



Mime
View raw message