[rhmessaging-commits] rhmessaging commits: r4355 - store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Sep 28 10:34:50 EDT 2010


Author: rgemmell
Date: 2010-09-28 10:34:49 -0400 (Tue, 28 Sep 2010)
New Revision: 4355

Modified:
   store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java
Log:
remove unused code block containing issues highlighted by FindBugs


Modified: store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java
===================================================================
--- store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java	2010-09-28 13:01:23 UTC (rev 4354)
+++ store/branches/java/0.5.x-dev/src/main/java/org/apache/qpid/server/store/berkeleydb/MessageContentKey.java	2010-09-28 14:34:49 UTC (rev 4355)
@@ -20,9 +20,6 @@
 import com.sleepycat.bind.tuple.TupleInput;
 import com.sleepycat.bind.tuple.TupleOutput;
 
-import java.util.Comparator;
-import java.io.Serializable;
-
 /**
  * @author Apache Software Foundation
  */
@@ -42,6 +39,12 @@
         chunk = ti.readInt();
     }
 
+    public MessageContentKey(long messageId, int chunk)
+    {
+        this.chunk = chunk;
+        this.messageId = messageId;
+    }
+
     public static class TupleBinding extends com.sleepycat.bind.tuple.TupleBinding
     {
         public Object entryToObject(TupleInput tupleInput)
@@ -58,166 +61,5 @@
             tupleOutput.writeLong(mk.messageId);            
             tupleOutput.writeInt(mk.chunk);
         }
-
-
     }
-
-    public static void writeModifiedLong(TupleOutput t, long l)
-    {
-        int ln = (int) (0x0F & l);
-        int hn = (int) (0xF0 & l);
-        t.writeByte(((ln <<4) | (hn>>4)) ^ 0x55);
-        t.writeByte((int) (0xFF & (l >> 8)));
-        t.writeByte((int) (0xFF & (l >> 16)));
-        t.writeByte((int) (0xFF & (l >> 24)));
-        t.writeByte((int) (0xFF & (l >> 32)));
-        t.writeByte((int) (0xFF & (l >> 40)));
-        t.writeByte((int) (0xFF & (l >> 48)));
-        t.writeByte((int) (0xFF & (l >> 56)));
-
-    }
-
-    public static long readModifiedLong(TupleInput t)
-    {
-        byte b0 = (byte) (0xFF & (t.readByte() ^ 0x55));
-        long l = (0x0f & (b0 >> 4)) | ((0xf0 & (b0 << 4)));
-
-        l |=  ((long) (0xFF & t.readByte())) << 8;
-        l |=  ((long) (0xFF & t.readByte())) << 16;
-        l |=  ((long) (0xFF & t.readByte())) << 24;
-        l |=  ((long) (0xFF & t.readByte())) << 32;
-        l |=  ((long) (0xFF & t.readByte())) << 40;
-        l |=  ((long) (0xFF & t.readByte())) << 48;
-        l |=  ((long) (0xFF & t.readByte())) << 56;
-
-        return l;
-    }
-
-
-    public static class ContentKeyComparator implements Comparator, Serializable
-    {
-
-        public int compare(Object o1, Object o2)
-        {
-            byte[] b1 = (byte[]) o1;
-            byte[] b2 = (byte[]) o2;
-
-            MessageContentKey ck1 = new MessageContentKey(b1);
-            MessageContentKey ck2 = new MessageContentKey(b2);
-            if (ck1.messageId == ck2.messageId)
-            {
-                // reminder of Comparator return value:
-                // return a negative integer if the first item is "less" than the second, 0 if equal
-                return ck1.chunk - ck2.chunk;
-            }
-            else
-            {
-                return (int) (ck1.messageId - ck2.messageId);
-            }
-        }
-    }
-
-    public MessageContentKey(long messageId, int chunk)
-    {
-        this.chunk = chunk;
-        this.messageId = messageId;
-    }
-
-
-
-    private static final char[] HEX = { '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
-
-    private static StringBuilder appendHex(StringBuilder str, byte b)
-    {
-        str.append(HEX[0xF & (b >> 4)]);
-        str.append(HEX[0xF & b]);
-        return str;
-    }
-
-    private static StringBuilder appendHex(StringBuilder str, byte[] b)
-    {
-        for(int i = 0; i < b.length; i++)
-        {
-            appendHex(str,b[i]);
-        }
-        return str;
-    }
-
-    private static StringBuilder appendHex(StringBuilder str, int i)
-    {
-        appendHex(str,(byte)(0xFF & (i >> 24)));
-        appendHex(str,(byte)(0xFF & (i >> 16)));
-        appendHex(str,(byte)(0xFF & (i >> 8)));
-        appendHex(str,(byte)(0xFF & i));
-        return str;
-    }
-
-
-    private static StringBuilder appendHex(StringBuilder str, long l)
-    {
-        appendHex(str,(byte)(0xFF & (l >> 56)));
-        appendHex(str,(byte)(0xFF & (l >> 48)));
-        appendHex(str,(byte)(0xFF & (l >> 40)));
-        appendHex(str,(byte)(0xFF & (l >> 32)));
-        appendHex(str,(byte)(0xFF & (l >> 24)));
-        appendHex(str,(byte)(0xFF & (l >> 16)));
-        appendHex(str,(byte)(0xFF & (l >> 8)));
-        appendHex(str,(byte)(0xFF & l));
-        return str;
-    }
-
-
-
-
-    private static byte[] convertLong(long l)
-    {
-        byte[] b = new byte[8];
-        int ln = (int) (0x0F & l);
-        int hn = (int) (0xF0 & l);
-        b[0] = (byte)(((ln <<4) | (hn>>4)) ^ 0x55);
-        b[1] = ((byte)(0xFF & (l >> 8)));
-        b[2] = ((byte)(0xFF & (l >> 16)));
-        b[3] = ((byte)(0xFF & (l >> 24)));
-        b[4] = ((byte)(0xFF & (l >> 32)));
-        b[5] = ((byte)(0xFF & (l >> 40)));
-        b[6] = ((byte)(0xFF & (l >> 48)));
-        b[7] = ((byte)(0xFF & (l >> 56)));
-
-        return b;
-
-    }
-
-
-    private static long readModifiedLong(byte[] b)
-    {
-        byte b0 = (byte) (b[0] ^ 0x55);
-        long l = (0x0f & (b0 >> 4)) | ((0xf0 & (b0 << 4)));
-        l |=  ((long) b[1]) << 8;
-        l |=  ((long) b[2]) << 16;
-        l |=  ((long) b[3]) << 24;
-        l |=  ((long) b[4]) << 32;
-        l |=  ((long) b[5]) << 40;
-        l |=  ((long) b[6]) << 48;
-        l |=  ((long) b[7]) << 56;
-
-
-        return l;
-    }
-
-
-    public static void main(String[] args)
-    {
-        StringBuilder s = new StringBuilder();
-
-
-
-        for(long i = 1000; i < 1010; i++)
-        {
-            byte[] b = convertLong(i);
-            System.out.println(appendHex(new StringBuilder(),b));
-            System.out.println(readModifiedLong(b));
-
-        }
-
-    }
 }



More information about the rhmessaging-commits mailing list