jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1566708 - in /jackrabbit/branches/2.6: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
Date Mon, 10 Feb 2014 19:29:23 GMT
Author: jukka
Date: Mon Feb 10 19:29:22 2014
New Revision: 1566708

URL: http://svn.apache.org/r1566708
Log:
2.6: Merged revisions 1566668 and 1566669 (JCR-3721)

Modified:
    jackrabbit/branches/2.6/   (props changed)
    jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java

Propchange: jackrabbit/branches/2.6/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1566668-1566669

Modified: jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java?rev=1566708&r1=1566707&r2=1566708&view=diff
==============================================================================
--- jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
(original)
+++ jackrabbit/branches/2.6/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
Mon Feb 10 19:29:22 2014
@@ -250,7 +250,31 @@ public class NodeId implements ItemId, C
      * @return UUID string
      */
     public String toString() {
-        return new UUID(msb, lsb).toString();
+        char[] retval = new char[36];
+        hex4(retval, 0, msb >>> 48);
+        hex4(retval, 4, msb >>> 32);
+        retval[8]  = '-';
+        hex4(retval, 9, msb >>> 16);
+        retval[13] = '-';
+        hex4(retval, 14, msb);
+        retval[18] = '-';
+        hex4(retval, 19, lsb >>> 48);
+        retval[23] = '-';
+        hex4(retval, 24, lsb >>> 32);
+        hex4(retval, 28, lsb >>> 16);
+        hex4(retval, 32, lsb);
+        return new String(retval);
+    }
+
+    private static final void hex4(char[] c, int index, long value) {
+        for (int i = 0; i < 4; i++) {
+            long v = (value >>> (12 - i * 4)) & 0xf;
+            if (v < 10) {
+                c[index + i] = (char) (v + '0');
+            } else {
+                c[index + i] = (char) (v - 10 + 'a');
+            }
+        }
     }
 
     /**



Mime
View raw message