jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r898677 - /jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
Date Wed, 13 Jan 2010 08:26:46 GMT
Author: mreutegg
Date: Wed Jan 13 08:26:45 2010
New Revision: 898677

URL: http://svn.apache.org/viewvc?rev=898677&view=rev
Log:
JCR-2464: Reduce usage of String.intern()

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java?rev=898677&r1=898676&r2=898677&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
Wed Jan 13 08:26:45 2010
@@ -84,6 +84,9 @@
      */
     private static class NameImpl implements Name {
 
+        /** The empty namespace uri */
+        private static final String EMPTY = "".intern();
+
         /** The memorized hash code of this name. */
         private transient int hash;
 
@@ -98,7 +101,12 @@
 
         private NameImpl(String namespaceURI, String localName) {
             // internalize namespaceURI to improve performance of comparisons.
-            this.namespaceURI = namespaceURI.intern();
+            if (namespaceURI.length() == 0) {
+                // see JCR-2464
+                this.namespaceURI = EMPTY;
+            } else {
+                this.namespaceURI = namespaceURI.intern();
+            }
             // localName is not internalized in order not to risk huge perm
             // space for large repositories
             this.localName = localName;



Mime
View raw message