ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1336054 [2/2] - in /webservices/wss4j/trunk: ./ src/main/java/org/apache/ws/security/ src/main/java/org/apache/ws/security/action/ src/main/java/org/apache/ws/security/components/crypto/ src/main/java/org/apache/ws/security/conversation/ s...
Date Wed, 09 May 2012 10:20:07 GMT
Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/Base64.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/Base64.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/Base64.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/Base64.java Wed May
 9 10:20:05 2012
@@ -20,63 +20,64 @@ package org.apache.ws.security.util;
 import org.apache.ws.security.WSSecurityException;
 
 /**
- * This class provides encode/decode for RFC 2045 Base64 as
- * defined by RFC 2045, N. Freed and N. Borenstein.
- * RFC 2045: Multipurpose Internet Mail Extensions (MIME)
- * Part One: Format of Internet Message Bodies. Reference
- * 1996 Available at: http://www.ietf.org/rfc/rfc2045.txt
- * This class is used by XML Schema binary format validation
- *
- * This implementation does not encode/decode streaming
- * data. You need the data that you will encode/decode
- * already on a byte arrray.
- *
+ * This class provides encode/decode for RFC 2045 Base64 as defined by RFC 2045,
+ * N. Freed and N. Borenstein. RFC 2045: Multipurpose Internet Mail Extensions
+ * (MIME) Part One: Format of Internet Message Bodies. Reference 1996 Available
+ * at: http://www.ietf.org/rfc/rfc2045.txt This class is used by XML Schema
+ * binary format validation
+ * 
+ * This implementation does not encode/decode streaming data. You need the data
+ * that you will encode/decode already on a byte arrray.
+ * 
  * @author Jeffrey Rodriguez
  * @author Sandy Gao
  * @version $Id$
  */
-public final class  Base64 {
+public final class Base64 {
+
+    private static final int BASELENGTH = 128;
+    private static final int LOOKUPLENGTH = 64;
+    private static final int TWENTYFOURBITGROUP = 24;
+    private static final int EIGHTBIT = 8;
+    private static final int SIXTEENBIT = 16;
+    private static final int FOURBYTE = 4;
+    private static final int SIGN = -128;
+    private static final char PAD = '=';
+    private static final byte[] BASE_64_ALPHABET = new byte[BASELENGTH];
+    private static final char[] LOOKUP_BASE_64_ALPHABET = new char[LOOKUPLENGTH];
 
-    static private final int  BASELENGTH         = 128;
-    static private final int  LOOKUPLENGTH       = 64;
-    static private final int  TWENTYFOURBITGROUP = 24;
-    static private final int  EIGHTBIT           = 8;
-    static private final int  SIXTEENBIT         = 16;
-    static private final int  FOURBYTE           = 4;
-    static private final int  SIGN               = -128;
-    static private final char PAD                = '=';
-    static final private byte [] base64Alphabet        = new byte[BASELENGTH];
-    static final private char [] lookUpBase64Alphabet  = new char[LOOKUPLENGTH];
-    
     static {
 
         for (int i = 0; i < BASELENGTH; ++i) {
-            base64Alphabet[i] = -1;
+            BASE_64_ALPHABET[i] = -1;
         }
         for (int i = 'Z'; i >= 'A'; i--) {
-            base64Alphabet[i] = (byte) (i-'A');
+            BASE_64_ALPHABET[i] = (byte) (i - 'A');
         }
-        for (int i = 'z'; i>= 'a'; i--) {
-            base64Alphabet[i] = (byte) ( i-'a' + 26);
+        for (int i = 'z'; i >= 'a'; i--) {
+            BASE_64_ALPHABET[i] = (byte) (i - 'a' + 26);
         }
 
         for (int i = '9'; i >= '0'; i--) {
-            base64Alphabet[i] = (byte) (i-'0' + 52);
+            BASE_64_ALPHABET[i] = (byte) (i - '0' + 52);
         }
 
-        base64Alphabet['+']  = 62;
-        base64Alphabet['/']  = 63;
+        BASE_64_ALPHABET['+'] = 62;
+        BASE_64_ALPHABET['/'] = 63;
 
-        for (int i = 0; i<=25; i++)
-            lookUpBase64Alphabet[i] = (char)('A'+i);
+        for (int i = 0; i <= 25; i++) {
+            LOOKUP_BASE_64_ALPHABET[i] = (char) ('A' + i);
+        }
 
-        for (int i = 26,  j = 0; i<=51; i++, j++)
-            lookUpBase64Alphabet[i] = (char)('a'+ j);
+        for (int i = 26, j = 0; i <= 51; i++, j++) {
+            LOOKUP_BASE_64_ALPHABET[i] = (char) ('a' + j);
+        }
 
-        for (int i = 52,  j = 0; i<=61; i++, j++)
-            lookUpBase64Alphabet[i] = (char)('0' + j);
-        lookUpBase64Alphabet[62] = (char)'+';
-        lookUpBase64Alphabet[63] = (char)'/';
+        for (int i = 52, j = 0; i <= 61; i++, j++) {
+            LOOKUP_BASE_64_ALPHABET[i] = (char) ('0' + j);
+        }
+        LOOKUP_BASE_64_ALPHABET[62] = (char) '+';
+        LOOKUP_BASE_64_ALPHABET[63] = (char) '/';
 
     }
 
@@ -89,7 +90,7 @@ public final class  Base64 {
     }
 
     protected static boolean isData(char octect) {
-        return (octect < BASELENGTH && base64Alphabet[octect] != -1);
+        return (octect < BASELENGTH && BASE_64_ALPHABET[octect] != -1);
     }
 
     protected static boolean isBase64(char octect) {
@@ -98,73 +99,85 @@ public final class  Base64 {
 
     /**
      * Encodes hex octects into Base64
-     *
-     * @param binaryData Array containing binaryData
+     * 
+     * @param binaryData
+     *            Array containing binaryData
      * @return Encoded Base64 array
      */
     public static String encode(byte[] binaryData) {
 
-        if (binaryData == null)
+        if (binaryData == null) {
             return null;
+        }
 
-        int      lengthDataBits    = binaryData.length*EIGHTBIT;
+        int lengthDataBits = binaryData.length * EIGHTBIT;
         if (lengthDataBits == 0) {
             return "";
         }
-        
-        int      fewerThan24bits   = lengthDataBits%TWENTYFOURBITGROUP;
-        int      numberTriplets    = lengthDataBits/TWENTYFOURBITGROUP;
-        int      numberQuartet     = fewerThan24bits != 0 ? numberTriplets+1 : numberTriplets;
-        char     encodedData[]     = null;
 
-        encodedData = new char[numberQuartet*4];
+        int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP;
+        int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP;
+        int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1
+                : numberTriplets;
+        char encodedData[] = null;
+
+        encodedData = new char[numberQuartet * 4];
 
-        byte k=0, l=0, b1=0,b2=0,b3=0;
+        byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0;
 
         int encodedIndex = 0;
-        int dataIndex   = 0;
+        int dataIndex = 0;
 
-        for (int i=0; i<numberTriplets; i++) {
+        for (int i = 0; i < numberTriplets; i++) {
             b1 = binaryData[dataIndex++];
             b2 = binaryData[dataIndex++];
             b3 = binaryData[dataIndex++];
 
-            l  = (byte)(b2 & 0x0f);
-            k  = (byte)(b1 & 0x03);
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
 
-            byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
+                    : (byte) ((b1) >> 2 ^ 0xc0);
 
-            byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
-            byte val3 = ((b3 & SIGN)==0)?(byte)(b3>>6):(byte)((b3)>>6^0xfc);
-
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ (l <<2 ) | val3 ];
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ b3 & 0x3f ];
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4)
+                    : (byte) ((b2) >> 4 ^ 0xf0);
+            byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6)
+                    : (byte) ((b3) >> 6 ^ 0xfc);
+
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[val1];
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[val2
+                    | (k << 4)];
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[(l << 2)
+                    | val3];
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[b3 & 0x3f];
         }
 
         // form integral number of 6-bit groups
         if (fewerThan24bits == EIGHTBIT) {
             b1 = binaryData[dataIndex];
-            k = (byte) ( b1 &0x03 );
+            k = (byte) (b1 & 0x03);
 
-            byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ k<<4 ];
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
+                    : (byte) ((b1) >> 2 ^ 0xc0);
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[val1];
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[k << 4];
             encodedData[encodedIndex++] = PAD;
             encodedData[encodedIndex++] = PAD;
         } else if (fewerThan24bits == SIXTEENBIT) {
             b1 = binaryData[dataIndex];
-            b2 = binaryData[dataIndex +1 ];
-            l = ( byte ) ( b2 &0x0f );
-            k = ( byte ) ( b1 &0x03 );
-
-            byte val1 = ((b1 & SIGN)==0)?(byte)(b1>>2):(byte)((b1)>>2^0xc0);
-            byte val2 = ((b2 & SIGN)==0)?(byte)(b2>>4):(byte)((b2)>>4^0xf0);
-
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val1 ];
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ val2 | ( k<<4 )];
-            encodedData[encodedIndex++] = lookUpBase64Alphabet[ l<<2 ];
+            b2 = binaryData[dataIndex + 1];
+            l = (byte) (b2 & 0x0f);
+            k = (byte) (b1 & 0x03);
+
+            byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2)
+                    : (byte) ((b1) >> 2 ^ 0xc0);
+            byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4)
+                    : (byte) ((b2) >> 4 ^ 0xf0);
+
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[val1];
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[val2
+                    | (k << 4)];
+            encodedData[encodedIndex++] = LOOKUP_BASE_64_ALPHABET[l << 2];
             encodedData[encodedIndex++] = PAD;
         }
 
@@ -173,92 +186,108 @@ public final class  Base64 {
 
     /**
      * Decodes Base64 data into octets
-     *
-     * @param encoded string containing Base64 data
-     * @return Array containind decoded data.
+     * 
+     * @param encoded
+     *            string containing Base64 data
+     * @return Array containing decoded data.
      */
     public static byte[] decode(String encoded) throws WSSecurityException {
 
-        if (encoded == null)
+        if (encoded == null) {
             return null;
+        }
 
         char[] base64Data = encoded.toCharArray();
         // remove white spaces
         int len = removeWhiteSpace(base64Data);
-        
-        if (len%FOURBYTE != 0) {
+
+        if (len % FOURBYTE != 0) {
             throw new WSSecurityException("decoding.divisible.four");
         }
 
-        int      numberQuadruple    = (len/FOURBYTE );
+        int numberQuadruple = (len / FOURBYTE);
 
-        if (numberQuadruple == 0)
+        if (numberQuadruple == 0) {
             return new byte[0];
+        }
 
-        byte     decodedData[]      = null;
-        byte     b1=0,b2=0,b3=0,b4=0;
-        char     d1=0,d2=0,d3=0,d4=0;
+        byte decodedData[] = null;
+        byte b1 = 0, b2 = 0, b3 = 0, b4 = 0;
+        char d1 = 0, d2 = 0, d3 = 0, d4 = 0;
 
         int i = 0;
         int encodedIndex = 0;
-        int dataIndex    = 0;
-        decodedData      = new byte[ (numberQuadruple)*3];
-
-        for (; i<numberQuadruple-1; i++) {
-
-            if (!isData( (d1 = base64Data[dataIndex++]) )||
-                !isData( (d2 = base64Data[dataIndex++]) )||
-                !isData( (d3 = base64Data[dataIndex++]) )||
-                !isData( (d4 = base64Data[dataIndex++]) ))
-                throw new WSSecurityException("decoding.general");//if found "no data" just
return null
+        int dataIndex = 0;
+        decodedData = new byte[(numberQuadruple) * 3];
 
-            b1 = base64Alphabet[d1];
-            b2 = base64Alphabet[d2];
-            b3 = base64Alphabet[d3];
-            b4 = base64Alphabet[d4];
+        for (; i < numberQuadruple - 1; i++) {
 
-            decodedData[encodedIndex++] = (byte)(  b1 <<2 | b2>>4 ) ;
-            decodedData[encodedIndex++] = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2)
& 0xf) );
-            decodedData[encodedIndex++] = (byte)( b3<<6 | b4 );
+            if (!isData((d1 = base64Data[dataIndex++]))
+                    || !isData((d2 = base64Data[dataIndex++]))
+                    || !isData((d3 = base64Data[dataIndex++]))
+                    || !isData((d4 = base64Data[dataIndex++])))
+                throw new WSSecurityException("decoding.general");// if found
+                                                                  // "no data"
+                                                                  // just return
+                                                                  // null
+
+            b1 = BASE_64_ALPHABET[d1];
+            b2 = BASE_64_ALPHABET[d2];
+            b3 = BASE_64_ALPHABET[d3];
+            b4 = BASE_64_ALPHABET[d4];
+
+            decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >>
2) & 0xf));
+            decodedData[encodedIndex++] = (byte) (b3 << 6 | b4);
+        }
+
+        if (!isData((d1 = base64Data[dataIndex++]))
+                || !isData((d2 = base64Data[dataIndex++]))) {
+            throw new WSSecurityException("decoding.general");// if found
+                                                              // "no data" just
+                                                              // return null
         }
 
-        if (!isData( (d1 = base64Data[dataIndex++]) ) ||
-            !isData( (d2 = base64Data[dataIndex++]) )) {
-            throw new WSSecurityException("decoding.general");//if found "no data" just return
null
-        }
-
-        b1 = base64Alphabet[d1];
-        b2 = base64Alphabet[d2];
+        b1 = BASE_64_ALPHABET[d1];
+        b2 = BASE_64_ALPHABET[d2];
 
         d3 = base64Data[dataIndex++];
         d4 = base64Data[dataIndex++];
-        if (!isData( (d3 ) ) ||
-            !isData( (d4 ) )) {//Check if they are PAD characters
-            if (isPad( d3 ) && isPad( d4)) {               //Two PAD e.g. 3c[Pad][Pad]
-                if ((b2 & 0xf) != 0)//last 4 bits should be zero
+        if (!isData((d3)) || !isData((d4))) {// Check if they are PAD characters
+            if (isPad(d3) && isPad(d4)) { // Two PAD e.g. 3c[Pad][Pad]
+                if ((b2 & 0xf) != 0) {// last 4 bits should be zero
                     throw new WSSecurityException("decoding.general");
-                byte[] tmp = new byte[ i*3 + 1 ];
-                System.arraycopy( decodedData, 0, tmp, 0, i*3 );
-                tmp[encodedIndex]   = (byte)(  b1 <<2 | b2>>4 ) ;
+                }
+                byte[] tmp = new byte[i * 3 + 1];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex] = (byte)(b1 << 2 | b2 >> 4);
                 return tmp;
-            } else if (!isPad( d3) && isPad(d4)) {               //One PAD  e.g.
3cQ[Pad]
-                b3 = base64Alphabet[ d3 ];
-                if ((b3 & 0x3 ) != 0)//last 2 bits should be zero
+            } else if (!isPad(d3) && isPad(d4)) { // One PAD e.g. 3cQ[Pad]
+                b3 = BASE_64_ALPHABET[d3];
+                if ((b3 & 0x3) != 0) { // last 2 bits should be zero
                     throw new WSSecurityException("decoding.general");
-                byte[] tmp = new byte[ i*3 + 2 ];
-                System.arraycopy( decodedData, 0, tmp, 0, i*3 );
-                tmp[encodedIndex++] = (byte)(  b1 <<2 | b2>>4 );
-                tmp[encodedIndex]   = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2)
& 0xf) );
+                }
+                byte[] tmp = new byte[i * 3 + 2];
+                System.arraycopy(decodedData, 0, tmp, 0, i * 3);
+                tmp[encodedIndex++] = (byte)(b1 << 2 | b2 >> 4);
+                tmp[encodedIndex] = (byte)(((b2 & 0xf) << 4) | ((b3 >> 2)
& 0xf));
                 return tmp;
             } else {
-                throw new WSSecurityException("decoding.general");//an error  like "3c[Pad]r",
"3cdX", "3cXd", "3cXX" where X is non data
+                throw new WSSecurityException("decoding.general");// an error
+                                                                  // like
+                                                                  // "3c[Pad]r",
+                                                                  // "3cdX",
+                                                                  // "3cXd",
+                                                                  // "3cXX"
+                                                                  // where X is
+                                                                  // non data
             }
-        } else { //No PAD e.g 3cQl
-            b3 = base64Alphabet[ d3 ];
-            b4 = base64Alphabet[ d4 ];
-            decodedData[encodedIndex++] = (byte)(  b1 <<2 | b2>>4 ) ;
-            decodedData[encodedIndex++] = (byte)(((b2 & 0xf)<<4 ) |( (b3>>2)
& 0xf) );
-            decodedData[encodedIndex++] = (byte)( b3<<6 | b4 );
+        } else { // No PAD e.g 3cQl
+            b3 = BASE_64_ALPHABET[d3];
+            b4 = BASE_64_ALPHABET[d4];
+            decodedData[encodedIndex++] = (byte)(b1 << 2 | b2 >> 4);
+            decodedData[encodedIndex++] = (byte)(((b2 & 0xf) << 4) | ((b3 >>
2) & 0xf));
+            decodedData[encodedIndex++] = (byte)(b3 << 6 | b4);
 
         }
 
@@ -268,19 +297,22 @@ public final class  Base64 {
     /**
      * remove WhiteSpace from MIME containing encoded Base64 data.
      * 
-     * @param data  the byte array of base64 data (with WS)
-     * @return      the new length
+     * @param data
+     *            the byte array of base64 data (with WS)
+     * @return the new length
      */
     protected static int removeWhiteSpace(char[] data) {
-        if (data == null)
+        if (data == null) {
             return 0;
+        }
 
         // count characters that's not whitespace
         int newSize = 0;
         int len = data.length;
         for (int i = 0; i < len; i++) {
-            if (!isWhiteSpace(data[i]))
+            if (!isWhiteSpace(data[i])) {
                 data[newSize++] = data[i];
+            }
         }
         return newSize;
     }

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/DOM2Writer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/DOM2Writer.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/DOM2Writer.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/DOM2Writer.java Wed
May  9 10:20:05 2012
@@ -106,8 +106,9 @@ public class DOM2Writer {
                 {
                     namespaceStack.push();
                     if (pretty) {
-                        for (int i = 0; i < indent; i++)
+                        for (int i = 0; i < indent; i++) {
                             out.print(' ');
+                        }
                     }
                     out.print('<' + node.getNodeName());
                     String elPrefix = node.getPrefix();
@@ -197,8 +198,9 @@ public class DOM2Writer {
                     out.print("<!--");
                     out.print(node.getNodeValue());
                     out.print("-->");
-                    if (pretty)
+                    if (pretty) {
                         out.print(LS);
+                    }
                     break;
                 }
             case Node.PROCESSING_INSTRUCTION_NODE:
@@ -211,21 +213,24 @@ public class DOM2Writer {
                         out.print(data);
                     }
                     out.println("?>");
-                    if (pretty)
+                    if (pretty) {
                         out.print(LS);
+                    }
                     break;
                 }
         }
-        if (type == Node.ELEMENT_NODE && hasChildren == true) {
+        if (type == Node.ELEMENT_NODE && hasChildren) {
             if (pretty) {
-                for (int i = 0; i < indent; i++)
+                for (int i = 0; i < indent; i++) {
                     out.print(' ');
+                }
             }
             out.print("</");
             out.print(node.getNodeName());
             out.print('>');
-            if (pretty)
+            if (pretty) {
                 out.print(LS);
+            }
             hasChildren = false;
         }
     }

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/NSStack.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/NSStack.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/NSStack.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/NSStack.java Wed May
 9 10:20:05 2012
@@ -44,7 +44,7 @@ import java.util.List;
  * @author Sam Ruby (rubys@us.ibm.com)
  */
 public class NSStack {
-    protected static org.apache.commons.logging.Log log =
+    protected static final org.apache.commons.logging.Log log =
         org.apache.commons.logging.LogFactory.getLog(NSStack.class);
 
     private Mapping[] stack;
@@ -121,7 +121,9 @@ public class NSStack {
      * Remove all mappings from the current frame.
      */
     private void clearFrame() {
-        while (stack[top] != null) top--;
+        while (stack[top] != null) {
+            top--;
+        }
     }
 
     /**
@@ -132,7 +134,9 @@ public class NSStack {
      */
     public Mapping topOfFrame() {
         iterator = top;
-        while (stack[iterator] != null) iterator--;
+        while (stack[iterator] != null) {
+            iterator--;
+        }
         iterator++;
         return next();
     }

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/UUIDGenerator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/UUIDGenerator.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/UUIDGenerator.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/UUIDGenerator.java Wed
May  9 10:20:05 2012
@@ -30,7 +30,7 @@ import java.util.Random;
  */
 public class UUIDGenerator {
 
-    private static final org.apache.commons.logging.Log log = 
+    private static final org.apache.commons.logging.Log LOG = 
         org.apache.commons.logging.LogFactory.getLog(UUIDGenerator.class);
 
     private static String baseUUID = null;
@@ -79,8 +79,8 @@ public class UUIDGenerator {
         try {
             md5 = MessageDigest.getInstance("MD5");
         } catch (NoSuchAlgorithmException e) {
-            if (log.isDebugEnabled()) {
-                log.debug(e.getMessage(), e);
+            if (LOG.isDebugEnabled()) {
+                LOG.debug(e.getMessage(), e);
             }
             //todo have to be properly handled
         }

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XMLUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XMLUtils.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XMLUtils.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XMLUtils.java Wed May
 9 10:20:05 2012
@@ -37,9 +37,9 @@ import java.io.OutputStream;
 
 public class XMLUtils {
     
-    private static final org.apache.commons.logging.Log log = 
+    private static final org.apache.commons.logging.Log LOG = 
         org.apache.commons.logging.LogFactory.getLog(XMLUtils.class);
-    private static final boolean doDebug = log.isDebugEnabled();
+    private static final boolean doDebug = LOG.isDebugEnabled();
     
     public static String PrettyDocumentToString(Document doc) {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -56,7 +56,7 @@ public class XMLUtils {
             transformer.transform(source, result);
         } catch (Exception ex) {
             if (doDebug) {
-                log.debug(ex.getMessage(), ex);
+                LOG.debug(ex.getMessage(), ex);
             }
         }
     }

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/util/XmlSchemaDateFormat.java
Wed May  9 10:20:05 2012
@@ -44,7 +44,7 @@ public class XmlSchemaDateFormat extends
     /**
      * Logger.
      */
-    private static org.apache.commons.logging.Log log = 
+    private static final org.apache.commons.logging.Log LOG = 
         org.apache.commons.logging.LogFactory.getLog(XmlSchemaDateFormat.class);
 
     /**
@@ -69,7 +69,7 @@ public class XmlSchemaDateFormat extends
      *
      * @see DateFormat#parse(java.lang.String)
      */
-    public Date parse(String src, ParsePosition parse_pos) {
+    public Date parse(String src, ParsePosition parsePos) {
         Date date;
 
         // validate fixed portion of format
@@ -81,14 +81,14 @@ public class XmlSchemaDateFormat extends
                 }
 
                 if (src.length() < 19) {
-                    parse_pos.setIndex(src.length() - 1);
-                    handleParseError(parse_pos, "TOO_FEW_CHARS");
+                    parsePos.setIndex(src.length() - 1);
+                    handleParseError(parsePos, "TOO_FEW_CHARS");
                 }
-                validateChar(src, parse_pos, index = 4, '-', "EXPECTED_DASH");
-                validateChar(src, parse_pos, index = 7, '-', "EXPECTED_DASH");
-                validateChar(src, parse_pos, index = 10, 'T', "EXPECTED_CAPITAL_T");
-                validateChar(src, parse_pos, index = 13, ':', "EXPECTED_COLON_IN_TIME");
-                validateChar(src, parse_pos, index = 16, ':', "EXPECTED_COLON_IN_TIME");
+                validateChar(src, parsePos, index = 4, '-', "EXPECTED_DASH");
+                validateChar(src, parsePos, index = 7, '-', "EXPECTED_DASH");
+                validateChar(src, parsePos, index = 10, 'T', "EXPECTED_CAPITAL_T");
+                validateChar(src, parsePos, index = 13, ':', "EXPECTED_COLON_IN_TIME");
+                validateChar(src, parsePos, index = 16, ':', "EXPECTED_COLON_IN_TIME");
             }
 
             // convert what we have validated so far
@@ -133,11 +133,11 @@ public class XmlSchemaDateFormat extends
                 // parse optional timezone
                 if (((index + 5) < src.length())
                         && ((src.charAt(index) == '+') || (src.charAt(index) == '-')))
{
-                    validateCharIsDigit(src, parse_pos, index + 1, "EXPECTED_NUMERAL");
-                    validateCharIsDigit(src, parse_pos, index + 2, "EXPECTED_NUMERAL");
-                    validateChar(src, parse_pos, index + 3, ':', "EXPECTED_COLON_IN_TIMEZONE");
-                    validateCharIsDigit(src, parse_pos, index + 4, "EXPECTED_NUMERAL");
-                    validateCharIsDigit(src, parse_pos, index + 5, "EXPECTED_NUMERAL");
+                    validateCharIsDigit(src, parsePos, index + 1, "EXPECTED_NUMERAL");
+                    validateCharIsDigit(src, parsePos, index + 2, "EXPECTED_NUMERAL");
+                    validateChar(src, parsePos, index + 3, ':', "EXPECTED_COLON_IN_TIMEZONE");
+                    validateCharIsDigit(src, parsePos, index + 4, "EXPECTED_NUMERAL");
+                    validateCharIsDigit(src, parsePos, index + 5, "EXPECTED_NUMERAL");
 
                     final int hours = (((src.charAt(index + 1) - '0') * 10) + src
                             .charAt(index + 2)) - '0';
@@ -159,58 +159,58 @@ public class XmlSchemaDateFormat extends
                 }
 
                 if (index < src.length()) {
-                    handleParseError(parse_pos, "TOO_MANY_CHARS");
+                    handleParseError(parsePos, "TOO_MANY_CHARS");
                 }
             }
         } catch (ParseException pe) {
-            log.error(pe.toString(), pe);
+            LOG.error(pe.toString(), pe);
             index = 0; // IMPORTANT: this tells DateFormat.parse() to throw a ParseException
-            parse_pos.setErrorIndex(index);
+            parsePos.setErrorIndex(index);
             date = null;
         }
-        parse_pos.setIndex(index);
-        return (date);
+        parsePos.setIndex(index);
+        return date;
     }
 
     /**
      * @see DateFormat#format(java.util.Date)
      */
-    public StringBuffer format(Date date, StringBuffer append_buf,
-            FieldPosition field_pos) {
+    public StringBuffer format(Date date, StringBuffer appendBuf,
+            FieldPosition fieldPos) {
         String str;
 
         synchronized (DATEFORMAT_XSD_ZULU) {
             str = DATEFORMAT_XSD_ZULU.format(date);
         }
 
-        if (append_buf == null) {
-            append_buf = new StringBuffer();
+        if (appendBuf == null) {
+            appendBuf = new StringBuffer();
         }
 
-        append_buf.append(str);
+        appendBuf.append(str);
 
-        return append_buf;
+        return appendBuf;
     }
 
-    private void validateChar(String str, ParsePosition parse_pos, int index,
-            char expected, String error_reason) throws ParseException {
+    private void validateChar(String str, ParsePosition parsePos, int index,
+            char expected, String errorReason) throws ParseException {
         if (str.charAt(index) != expected) {
-            handleParseError(parse_pos, error_reason);
+            handleParseError(parsePos, errorReason);
         }
     }
 
-    private void validateCharIsDigit(String str, ParsePosition parse_pos,
-            int index, String error_reason) throws ParseException {
+    private void validateCharIsDigit(String str, ParsePosition parsePos,
+            int index, String errorReason) throws ParseException {
         if (!Character.isDigit(str.charAt(index))) {
-            handleParseError(parse_pos, error_reason);
+            handleParseError(parsePos, errorReason);
         }
     }
 
-    private void handleParseError(ParsePosition parse_pos, String error_reason)
+    private void handleParseError(ParsePosition parsePos, String errorReason)
             throws ParseException {
         throw new ParseException(
-            "INVALID_XSD_DATETIME: " + error_reason, 
-            parse_pos.getErrorIndex()
+            "INVALID_XSD_DATETIME: " + errorReason, 
+            parsePos.getErrorIndex()
         );
     }
 

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/KerberosTokenDecoder.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/KerberosTokenDecoder.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/KerberosTokenDecoder.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/KerberosTokenDecoder.java
Wed May  9 10:20:05 2012
@@ -33,23 +33,23 @@ public interface KerberosTokenDecoder {
      * Set the AP-REQ Kerberos Token
      * @param token the AP-REQ Kerberos Token
      */
-    public void setToken(byte[] token);
+    void setToken(byte[] token);
     
     /**
      * Set the Subject
      * @param subject the Subject
      */
-    public void setSubject(Subject subject);
+    void setSubject(Subject subject);
     
     /**
      * Get the session key from the token
      * @return the session key from the token
      */
-    public byte[] getSessionKey();
+    byte[] getSessionKey();
     
     /**
      * Clear all internal information
      */
-    public void clear();
+    void clear();
     
 }

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SamlAssertionValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SamlAssertionValidator.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SamlAssertionValidator.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SamlAssertionValidator.java
Wed May  9 10:20:05 2012
@@ -40,7 +40,7 @@ import org.opensaml.xml.validation.Valid
  */
 public class SamlAssertionValidator extends SignatureTrustValidator {
     
-    private static org.apache.commons.logging.Log LOG = 
+    private static final org.apache.commons.logging.Log LOG = 
         org.apache.commons.logging.LogFactory.getLog(SamlAssertionValidator.class);
     
     /**

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java
(original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/SignatureTrustValidator.java
Wed May  9 10:20:05 2012
@@ -36,7 +36,7 @@ import org.apache.ws.security.handler.Re
  */
 public class SignatureTrustValidator implements Validator {
     
-    private static org.apache.commons.logging.Log LOG = 
+    private static final org.apache.commons.logging.Log LOG = 
         org.apache.commons.logging.LogFactory.getLog(SignatureTrustValidator.class);
     
     /**

Modified: webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/Validator.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/Validator.java?rev=1336054&r1=1336053&r2=1336054&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/Validator.java (original)
+++ webservices/wss4j/trunk/src/main/java/org/apache/ws/security/validate/Validator.java Wed
May  9 10:20:05 2012
@@ -39,7 +39,7 @@ public interface Validator {
      * @return a validated Credential
      * @throws WSSecurityException on a failed validation
      */
-    public Credential validate(Credential credential, RequestData data) throws WSSecurityException;
+    Credential validate(Credential credential, RequestData data) throws WSSecurityException;
     
     
 }



Mime
View raw message