You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2003/09/13 15:45:57 UTC

cvs commit: ws-axis/java/src/org/apache/axis/utils SessionUtils.java

dims        2003/09/13 06:45:57

  Modified:    java/src/org/apache/axis/utils SessionUtils.java
  Log:
  No need to digest as we already have an array of bytes. (Consumes unnecessary CPU cycles)
  
  Revision  Changes    Path
  1.7       +0 -44     ws-axis/java/src/org/apache/axis/utils/SessionUtils.java
  
  Index: SessionUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/utils/SessionUtils.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SessionUtils.java	22 Apr 2003 19:36:05 -0000	1.6
  +++ SessionUtils.java	13 Sep 2003 13:45:57 -0000	1.7
  @@ -57,8 +57,6 @@
   import org.apache.axis.components.logger.LogFactory;
   import org.apache.commons.logging.Log;
   
  -import java.security.MessageDigest;
  -import java.security.NoSuchAlgorithmException;
   import java.util.Random;
   
   /**
  @@ -70,31 +68,12 @@
       protected static Log log = LogFactory.getLog(SessionUtils.class.getName());
   
       /**
  -     * The default message digest algorithm to use if we cannot use
  -     * the requested one.
  -     */
  -    protected static final String DEFAULT_ALGORITHM = "MD5";
  -
  -    /**
        * The number of random bytes to include when generating a
        * session identifier.
        */
       protected static final int SESSION_ID_BYTES = 16;
   
       /**
  -     * The message digest algorithm to be used when generating session
  -     * identifiers.  This must be an algorithm supported by the
  -     * <code>java.security.MessageDigest</code> class on your platform.
  -     */
  -    protected static String algorithm = DEFAULT_ALGORITHM;
  -
  -    /**
  -     * Return the MessageDigest implementation to be used when
  -     * creating session identifiers.
  -     */
  -    protected static MessageDigest digest = null;
  -
  -    /**
        * A random number generator to use when generating session identifiers.
        */
       protected static Random random = null;
  @@ -120,7 +99,6 @@
           byte bytes[] = new byte[SESSION_ID_BYTES];
   
           getRandom().nextBytes(bytes);
  -        bytes = getDigest().digest(bytes);
   
           // Render the result as a String of hexadecimal digits
           StringBuffer result = new StringBuffer();
  @@ -150,28 +128,6 @@
        */
       public static synchronized Long generateSession() {
           return new Long(getRandom().nextLong());
  -    }
  -
  -    /**
  -     * Return the MessageDigest object to be used for calculating
  -     * session identifiers.  If none has been created yet, initialize
  -     * one the first time this method is called.
  -     *
  -     * @return Message Digest
  -     */
  -    private static synchronized MessageDigest getDigest() {
  -        if (digest == null) {
  -            try {
  -                digest = MessageDigest.getInstance(algorithm);
  -            } catch (NoSuchAlgorithmException e) {
  -                try {
  -                    digest = MessageDigest.getInstance(DEFAULT_ALGORITHM);
  -                } catch (NoSuchAlgorithmException f) {
  -                    digest = null;
  -                }
  -            }
  -        }
  -        return (digest);
       }
   
       /**