You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ps...@apache.org on 2005/09/11 19:22:39 UTC

svn commit: r280153 - /jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/uuid/UUID.java

Author: psteitz
Date: Sun Sep 11 10:22:36 2005
New Revision: 280153

URL: http://svn.apache.org/viewcvs?rev=280153&view=rev
Log:
Modified UUID to include the offending UUID value when throwing
UUIDFormatException.
PR# 36566
Reported by John Gregg
Patch Submitted by Jukka Zitting

Modified:
    jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/uuid/UUID.java

Modified: jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/uuid/UUID.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/uuid/UUID.java?rev=280153&r1=280152&r2=280153&view=diff
==============================================================================
--- jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/uuid/UUID.java (original)
+++ jakarta/commons/sandbox/id/trunk/src/java/org/apache/commons/id/uuid/UUID.java Sun Sep 11 10:22:36 2005
@@ -160,13 +160,13 @@
 		
 		//Check for 36 char length
 		if (leanString.length() != UUID_FORMATTED_LENGTH) {
-			throw new UUIDFormatException();
+			throw new UUIDFormatException(uuidString);
 		}
 		
 		//Check for 5 fields
 		StringTokenizer tok = new StringTokenizer(leanString, "-");
 		if ( tok.countTokens() != TOKENS_IN_UUID ) {
-			throw new UUIDFormatException();
+			throw new UUIDFormatException(uuidString);
 		}
 		
 		//Remove the "-" from the formatted string and test token sizes
@@ -176,7 +176,7 @@
 		while (tok.hasMoreTokens()) {
 			token = tok.nextToken();
 			if (token.length() != TOKEN_LENGTHS[count++]) {
-				throw new UUIDFormatException();
+				throw new UUIDFormatException(uuidString);
 			}
 			buf.append(token);
 		}
@@ -186,7 +186,7 @@
 			char[] chars = buf.toString().toCharArray();
 			tmpUUID = new UUID(Hex.decodeHex(chars));
 		} catch (DecoderException de) {
-			throw new UUIDFormatException(de.getMessage());
+			throw new UUIDFormatException(uuidString + ": " + de.getMessage());
 		}
 		return tmpUUID;
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org