jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r898680 - in /jackrabbit/branches/2.0: ./ jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
Date Wed, 13 Jan 2010 08:30:36 GMT
Author: mreutegg
Date: Wed Jan 13 08:30:36 2010
New Revision: 898680

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

Modified:
    jackrabbit/branches/2.0/   (props changed)
    jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java

Propchange: jackrabbit/branches/2.0/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jan 13 08:30:36 2010
@@ -2,4 +2,4 @@
 /jackrabbit/sandbox/JCR-1456:774917-886178
 /jackrabbit/sandbox/JCR-2170:812417-816332
 /jackrabbit/sandbox/tripod-JCR-2209:795441-795863
-/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,898042
+/jackrabbit/trunk:891595,891629,892253,892263,894150-894151,896408,896513,896532,896857,896870,896876,896908,896940,896942-896943,896969,896977,897071,897836,897842,897858,897935,898042,898677

Modified: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java?rev=898680&r1=898679&r2=898680&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
(original)
+++ jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameFactoryImpl.java
Wed Jan 13 08:30:36 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