James Moger
2011-06-25 22fc5e48cbe050d8485f78f6165b59e4085eaeef
src/com/gitblit/utils/StringUtils.java
@@ -16,15 +16,11 @@
package com.gitblit.utils;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.PatternSyntaxException;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jgit.util.Base64;
public class StringUtils {
@@ -60,6 +56,11 @@
         i++;
      }
      return retStr.toString();
   }
   public static String decodeFromHtml(String inStr) {
      return inStr.replace("&amp;", "&").replace("&lt;", "<").replace("&gt;", ">")
            .replace("&quot;", "\"").replace("&nbsp;", " ");
   }
   public static String encodeURL(String inStr) {
@@ -152,9 +153,10 @@
         md.update(string.getBytes("iso-8859-1"));
         byte[] digest = md.digest();
         return toHex(digest);
      } catch (Exception e) {
         Log.warn(e);
         return null;
      } catch (UnsupportedEncodingException u) {
         throw new RuntimeException(u);
      } catch (NoSuchAlgorithmException t) {
         throw new RuntimeException(t);
      }
   }
@@ -167,10 +169,6 @@
         sb.append(Long.toString((int) bytes[i] & 0xff, 16));
      }
      return sb.toString();
   }
   public static String decodeBase64(String base64) {
      return new String(Base64.decode(base64), Charset.forName("UTF-8"));
   }
   public static String getRootPath(String path) {