added scm-web-compressor maven plugin

This commit is contained in:
Sebastian Sdorra
2010-11-21 18:16:39 +01:00
parent cdb295bdf3
commit b5c5201a55
15 changed files with 1109 additions and 41 deletions

View File

@@ -29,11 +29,14 @@
*
*/
package sonia.scm.security;
//~--- non-JDK imports --------------------------------------------------------
import sonia.scm.util.AssertUtil;
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
@@ -132,22 +135,7 @@ public class MessageDigestEncryptionHandler implements EncryptionHandler
messageDigest.reset();
messageDigest.update(value.getBytes());
byte hashCode[] = messageDigest.digest();
StringBuilder hashString = new StringBuilder();
for (int i = 0; i < hashCode.length; i++)
{
int x = hashCode[i] & 0xff;
if (x < 16)
{
hashString.append('0');
}
hashString.append(Integer.toString(x, 16));
}
return hashString.toString();
return Util.toString(messageDigest.digest());
}
//~--- fields ---------------------------------------------------------------

View File

@@ -29,6 +29,8 @@
*
*/
package sonia.scm.util;
//~--- JDK imports ------------------------------------------------------------
@@ -94,9 +96,7 @@ public class ChecksumUtil
}
}
byte[] b = digest.digest();
return toHexString(b);
return Util.toString(digest.digest());
}
/**
@@ -114,26 +114,6 @@ public class ChecksumUtil
return createChecksum(new FileInputStream(file));
}
/**
* Method description
*
*
* @param byteArray
*
* @return
*/
private static String toHexString(byte[] byteArray)
{
StringBuilder buffer = new StringBuilder();
for (byte b : byteArray)
{
buffer.append(Integer.toHexString(b));
}
return buffer.toString();
}
//~--- get methods ----------------------------------------------------------
/**

View File

@@ -29,6 +29,8 @@
*
*/
package sonia.scm.util;
//~--- JDK imports ------------------------------------------------------------
@@ -219,4 +221,33 @@ public class Util
{
return (array != null) && (array.length > 0);
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param byteValue
*
* @return
*/
public static String toString(byte[] byteValue)
{
StringBuilder buffer = new StringBuilder();
for (int i = 0; i < byteValue.length; i++)
{
int x = byteValue[i] & 0xff;
if (x < 16)
{
buffer.append('0');
}
buffer.append(Integer.toString(x, 16));
}
return buffer.toString();
}
}