changeset 14:0f64de5fff5a

try to use javax.xml.bind.DatatypeConverter
author casties
date Wed, 21 Mar 2012 16:38:50 +0100
parents 9393c9c9b916
children 6c7c4140630d
files src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorResourceImpl.java
diffstat 1 files changed, 3 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorResourceImpl.java	Wed Mar 21 15:23:57 2012 +0100
+++ b/src/de/mpiwg/itgroup/annotationManager/restlet/AnnotatorResourceImpl.java	Wed Mar 21 16:38:50 2012 +0100
@@ -13,6 +13,8 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import javax.xml.bind.DatatypeConverter;
+
 import org.apache.log4j.Logger;
 import org.joda.time.DateTime;
 import org.joda.time.format.DateTimeFormatter;
@@ -57,11 +59,7 @@
             MessageDigest md = MessageDigest.getInstance("SHA-256");
             md.update(text.getBytes("UTF-8"));
             byte[] dg = md.digest();
-            StringBuffer sb = new StringBuffer();
-            for (byte b : dg) {
-                sb.append(String.format("%02x", b));
-            }
-            digest = sb.toString();
+            digest = DatatypeConverter.printHexBinary(dg);
         } catch (NoSuchAlgorithmException e) {
             e.printStackTrace();
         } catch (UnsupportedEncodingException e) {