Return-Path: Delivered-To: apmail-sling-commits-archive@www.apache.org Received: (qmail 44839 invoked from network); 12 Oct 2009 10:18:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Oct 2009 10:18:18 -0000 Received: (qmail 23771 invoked by uid 500); 12 Oct 2009 10:18:18 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 23712 invoked by uid 500); 12 Oct 2009 10:18:18 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 23703 invoked by uid 99); 12 Oct 2009 10:18:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 10:18:18 +0000 X-ASF-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 10:18:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DA57F23888DC; Mon, 12 Oct 2009 10:17:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@sling.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20091012101755.DA57F23888DC@eris.apache.org> 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 @@ org.apache.sling org.apache.sling.api 2.0.8 + provided + + + javax.jcr + jcr org.apache.sling org.apache.sling.jcr.api 2.0.2-incubator + provided org.apache.sling org.apache.sling.adapter 2.0.2-incubator + provided org.slf4j @@ -132,6 +139,7 @@ org.apache.sling org.apache.sling.commons.classloader 0.9.0 + provided @@ -153,6 +162,7 @@ org.apache.felix org.apache.felix.webconsole 1.2.0 + provided @@ -165,7 +175,7 @@ org.apache.jackrabbit jackrabbit-jcr-commons - 1.5.0 + 1.6.0 provided 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 get(final String aKey, final Class 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 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) {