db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1293147 - in /db/derby/code/trunk/java: engine/org/apache/derby/catalog/ engine/org/apache/derby/iapi/services/uuid/ engine/org/apache/derby/impl/services/uuid/ testing/org/apache/derbyTesting/unitTests/services/
Date Fri, 24 Feb 2012 09:40:55 GMT
Author: kahatlen
Date: Fri Feb 24 09:40:55 2012
New Revision: 1293147

URL: http://svn.apache.org/viewvc?rev=1293147&view=rev
Log:
DERBY-5627: Remove unused methods from the UUID classes

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/UUID.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/uuid/UUIDFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUID.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUIDFactory.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_UUIDFactory.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/UUID.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/UUID.java?rev=1293147&r1=1293146&r2=1293147&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/UUID.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/UUID.java Fri Feb 24 09:40:55
2012
@@ -49,22 +49,10 @@ public interface UUID extends java.io.Ex
 	String toANSIidentifier();
 
 	/**
-	    Produce a byte array representation of this UUID
-		which can be passed to UUIDFactory.recreateUUID later
-		on to reconstruct it.
-	*/
-	byte[] toByteArray();
-
-	/**
 	  Clone this UUID.
 
 	  @return	a copy of this UUID
 	  */
 	UUID cloneMe();
-
-	/**
-	  Create a hex string representation of this UUID.
-	  */
-	String toHexString();
 }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/uuid/UUIDFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/uuid/UUIDFactory.java?rev=1293147&r1=1293146&r2=1293147&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/uuid/UUIDFactory.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/uuid/UUIDFactory.java Fri
Feb 24 09:40:55 2012
@@ -65,12 +65,5 @@ public interface UUIDFactory 
 	  @return		The UUID.
 	**/
 	public UUID recreateUUID(String uuidstring);
-
-	/**
-	  Recreate a UUID from a byte array produced by UUID.toByteArray.
-	  @return		The UUID.
-	  @see UUID#toByteArray
-	**/
-	public UUID recreateUUID(byte[] b);
 }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUID.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUID.java?rev=1293147&r1=1293146&r2=1293147&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUID.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUID.java Fri
Feb 24 09:40:55 2012
@@ -21,7 +21,6 @@
 
 package org.apache.derby.impl.services.uuid;
 
-import org.apache.derby.iapi.services.io.FormatIdUtil;
 import org.apache.derby.iapi.services.io.StoredFormatIds;
 import org.apache.derby.iapi.services.io.Formatable;
 
@@ -76,40 +75,6 @@ public class BasicUUID implements UUID, 
 		majorId = readMSB(sr);
 	}
 
-	/**
-		Constructor only called by BasicUUIDFactory.
-		Constructs a UUID from the byte array representation
-		produced by toByteArrayio.
-		@see BasicUUID#toByteArray
-	**/
-	public BasicUUID(byte[] b)
-	{
-		int lsequence = 0;
-		for (int ix = 0; ix < 4; ix++)
-		{
-			lsequence = lsequence << 8;
-			lsequence = lsequence | (0xff & b[ix]);
-		}
-
-		long ltimemillis = 0;
-		for (int ix = 4; ix < 10; ix++)
-		{
-			ltimemillis = ltimemillis << 8;
-			ltimemillis = ltimemillis | (0xff & b[ix]);
-		}
-
-		long linetaddr = 0;
-		for (int ix = 10; ix < 16; ix++)
-		{
-			linetaddr = linetaddr << 8;
-			linetaddr = linetaddr | (0xff & b[ix]);
-		}
-
-		sequence = lsequence;
-		timemillis = ltimemillis;
-		majorId = linetaddr;
-	}
-
 	/*
 	 * Formatable methods
 	 */
@@ -123,7 +88,6 @@ public class BasicUUID implements UUID, 
 	*/
 	public void writeExternal(ObjectOutput out) throws IOException 
 	{
-		// RESOLVE: write out the byte array instead?
 		out.writeLong(majorId);
 		out.writeLong(timemillis);
 		out.writeInt(sequence);
@@ -275,42 +239,6 @@ public class BasicUUID implements UUID, 
 	}
 
 	/**
-	  Store this UUID in a byte array. Arrange the bytes in the UUID
-	  in the same order the code which stores a UUID in a string
-	  does.
-	  
-	  @see org.apache.derby.catalog.UUID#toByteArray
-	*/
-	public byte[] toByteArray()
-	{
-		byte[] result = new byte[16];
-
-		int lsequence = sequence; 
-		result[0] = (byte)(lsequence >>> 24);
-		result[1] = (byte)(lsequence >>> 16);
-		result[2] = (byte)(lsequence >>> 8);
-		result[3] = (byte)lsequence;
-
-		long ltimemillis = timemillis;
-		result[4] = (byte)(ltimemillis >>> 40);
-		result[5] = (byte)(ltimemillis >>> 32);
-		result[6] = (byte)(ltimemillis >>> 24);
-		result[7] = (byte)(ltimemillis >>> 16);
- 		result[8] = (byte)(ltimemillis >>> 8);
-		result[9] = (byte)ltimemillis;
-
-		long linetaddr = majorId;
-		result[10] = (byte)(linetaddr >>> 40);
-		result[11] = (byte)(linetaddr >>> 32);
-		result[12] = (byte)(linetaddr >>> 24);
-		result[13] = (byte)(linetaddr >>> 16);
-		result[14] = (byte)(linetaddr >>> 8);
-		result[15] = (byte)linetaddr;
-
-		return result;
-	}
-
-	/**
 	  Clone this UUID.
 
 	  @return	a copy of this UUID
@@ -319,7 +247,5 @@ public class BasicUUID implements UUID, 
 	{
 		return	new	BasicUUID(majorId, timemillis, sequence);
 	}
-
-	public String toHexString() {return stringWorkhorse( (char) 0 );}
 }
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUIDFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUIDFactory.java?rev=1293147&r1=1293146&r2=1293147&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUIDFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/uuid/BasicUUIDFactory.java
Fri Feb 24 09:40:55 2012
@@ -141,14 +141,6 @@ public final class BasicUUIDFactory
 		return new BasicUUID(uuidstring);
 	}
 
-	/**
-		@see UUIDFactory#recreateUUID
-	**/
-	public UUID recreateUUID(byte[] b)
-	{
-		return new BasicUUID(b);
-	}
-
 	private void bumpMajor() {
 
 		// 48 bits only

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_UUIDFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_UUIDFactory.java?rev=1293147&r1=1293146&r2=1293147&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_UUIDFactory.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/unitTests/services/T_UUIDFactory.java
Fri Feb 24 09:40:55 2012
@@ -151,26 +151,5 @@ public class T_UUIDFactory extends T_Gen
 			out.printlnWithHeader(message);
 			resultSoFar =  false;
 		}
-
-		byte[] uuidByteArray = uuid.toByteArray();
-		UUID uuid_b = factory.recreateUUID(uuidByteArray);
-		if (!uuid_b.equals(uuid))
-		{
-			// Resolve: format this with a message factory
-			String badByteArrayString = "";
-			for (int ix = 0; ix < 16; ix++)
-			{
-				badByteArrayString +=
-					Integer.toHexString(0x00ff&uuidByteArray[ix])+".";
-			}
-
-			String message = 
-				"Conversion error: "
-				+ uuidstring 
-				+ " != " 
-				+ badByteArrayString;
-			out.printlnWithHeader(message);
-			resultSoFar =  false;
-		}
 	}
 }



Mime
View raw message