You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by co...@apache.org on 2008/09/29 16:51:37 UTC

svn commit: r700142 - in /webservices/wss4j/trunk/src/org/apache/ws/security: action/ components/crypto/ handler/ message/ message/token/ processor/ saml/ transform/ util/

Author: coheigea
Date: Mon Sep 29 07:51:36 2008
New Revision: 700142

URL: http://svn.apache.org/viewvc?rev=700142&view=rev
Log:
Applied some PMD cleanups

Modified:
    webservices/wss4j/trunk/src/org/apache/ws/security/action/SAMLTokenSignedAction.java
    webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/X509NameTokenizer.java
    webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java
    webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java
    webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java
    webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerFactory.java
    webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerImpl.java
    webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java
    webservices/wss4j/trunk/src/org/apache/ws/security/util/DOM2Writer.java
    webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/action/SAMLTokenSignedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/action/SAMLTokenSignedAction.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/action/SAMLTokenSignedAction.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/action/SAMLTokenSignedAction.java Mon Sep 29 07:51:36 2008
@@ -17,6 +17,8 @@
 
 package org.apache.ws.security.action;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.ws.security.WSSecurityException;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.handler.RequestData;
@@ -29,6 +31,8 @@
 import org.w3c.dom.Document;
 
 public class SAMLTokenSignedAction implements Action {
+    
+    private static Log log = LogFactory.getLog(SAMLTokenSignedAction.class.getName());
 
     public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData)
             throws WSSecurityException {
@@ -41,7 +45,10 @@
         */
         try {
             crypto = handler.loadSignatureCrypto(reqData);
-        } catch (Throwable t){
+        } catch (Throwable t) {
+            if (log.isDebugEnabled()) {
+                log.debug(t.getMessage(), t);
+            }
         }
 
         SAMLIssuer saml = loadSamlIssuer(handler, reqData);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/X509NameTokenizer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/X509NameTokenizer.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/X509NameTokenizer.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/components/crypto/X509NameTokenizer.java Mon Sep 29 07:51:36 2008
@@ -89,11 +89,11 @@
     private static String trim(String str) {
        String trimed = str.trim();
        int i = str.indexOf(trimed) + trimed.length();
-       if ((str.length() > i) && trimed.endsWith("\\")
-               &&!trimed.endsWith("\\\\")) {
-          if (str.charAt(i) == ' ') {
-             trimed = trimed + " ";
-          }
+       if ((str.length() > i) 
+           && trimed.endsWith("\\")
+           && !trimed.endsWith("\\\\")
+           && (str.charAt(i) == ' ')) {
+         trimed = trimed + " ";
        }
        return trimed;
     }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/handler/WSHandler.java Mon Sep 29 07:51:36 2008
@@ -162,20 +162,18 @@
             reqData.getSignatureParts().add(encP);
         }
         /*
-         * If SignatureConfirmation is enabled and this is a reqsponse then
+         * If SignatureConfirmation is enabled and this is a response then
          * insert SignatureConfrmation elements, note their wsu:id in the signature
          * parts. They will be signed automatically during a (probably) defined
          * SIGN action.
          */
         if (wssConfig.isEnableSignatureConfirmation() && !isRequest) {
-            String done;
-            if ((done = (String) getProperty(reqData.getMsgContext(),
-                    WSHandlerConstants.SIG_CONF_DONE)) == null
-                    || !DONE.equals(done)) {
-                if ((getProperty(reqData.getMsgContext(),
-                        WSHandlerConstants.RECV_RESULTS)) != null) {
-                    wssConfig.getAction(WSConstants.SC).execute(this, WSConstants.SC, doc, reqData);
-                }
+            String done = (String) 
+                getProperty(reqData.getMsgContext(), WSHandlerConstants.SIG_CONF_DONE);
+            if (!DONE.equals(done)
+                && (getProperty(reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS)) 
+                    != null) {
+                wssConfig.getAction(WSConstants.SC).execute(this, WSConstants.SC, doc, reqData);
             }
         }
         /*
@@ -228,25 +226,25 @@
          * other actors.
          */
 
-        if (wssConfig.isEnableSignatureConfirmation() && isRequest) {
-            if (reqData.getSignatureValues().size() > 0) {
-                Vector sigv = null;
-                if ((sigv = (Vector) getProperty(reqData.getMsgContext(),
-                        WSHandlerConstants.SEND_SIGV)) == null) {
-                    sigv = new Vector();
-                    setProperty(reqData.getMsgContext(),
-                            WSHandlerConstants.SEND_SIGV, sigv);
-                }
-                // sigv.add(reqData.getSignatureValues());
-                sigv.addAll(reqData.getSignatureValues());
+        if (wssConfig.isEnableSignatureConfirmation() 
+                && isRequest
+                && reqData.getSignatureValues().size() > 0) {
+            Vector sigv = (Vector) 
+            getProperty(reqData.getMsgContext(), WSHandlerConstants.SEND_SIGV);
+            if (sigv == null) {
+                sigv = new Vector();
+                setProperty(reqData.getMsgContext(),
+                        WSHandlerConstants.SEND_SIGV, sigv);
             }
+            // sigv.add(reqData.getSignatureValues());
+            sigv.addAll(reqData.getSignatureValues());
         }
     }
 
 
 
     protected void doReceiverAction(int doAction, RequestData reqData)
-    throws WSSecurityException {
+        throws WSSecurityException {
 
         WSSConfig wssConfig = WSSConfig.getNewInstance();
         wssConfig
@@ -367,7 +365,7 @@
      * fit.
      */
     public Crypto loadSignatureCrypto(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         Crypto crypto = null;
         /*
          * Get crypto property file for signature. If none specified throw
@@ -376,7 +374,8 @@
         String sigPropFile = getString(WSHandlerConstants.SIG_PROP_FILE,
                 reqData.getMsgContext());
         if (sigPropFile != null) {
-            if ((crypto = (Crypto) cryptos.get(sigPropFile)) == null) {
+            crypto = (Crypto) cryptos.get(sigPropFile);
+            if (crypto == null) {
                 crypto = CryptoFactory.getInstance(sigPropFile, this
                         .getClassLoader(reqData.getMsgContext()));
                 cryptos.put(sigPropFile, crypto);
@@ -389,22 +388,25 @@
              */
             String refId = getString(WSHandlerConstants.SIG_PROP_REF_ID,
                     reqData.getMsgContext());
-            if(refId != null) {
+            if (refId != null) {
                 Object propObj = getProperty(reqData.getMsgContext(), refId);
                 if(propObj instanceof Properties) {
-                    if ((crypto = (Crypto) cryptos.get(refId)) == null) {
+                    crypto = (Crypto) cryptos.get(refId);
+                    if (crypto == null) {
                         crypto = CryptoFactory.getInstance((Properties)propObj);
                         cryptos.put(refId, crypto);
                     }
                 } else {
                     throw new WSSecurityException(
-                            "WSHandler: Signature: signaturePropRefId must hold a " +
-                    "java.util.Properties object");
+                        "WSHandler: Signature: signaturePropRefId must hold a " 
+                            + "java.util.Properties object"
+                    );
                 }
             }
         } else {
             throw new WSSecurityException(
-            "WSHandler: Signature: no crypto properties");
+                "WSHandler: Signature: no crypto properties"
+            );
         }
         return crypto;
     }
@@ -414,7 +416,7 @@
      * see fit.
      */
     protected Crypto loadEncryptionCrypto(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         Crypto crypto = null;
         /*
          * Get encryption crypto property file. If non specified take crypto
@@ -423,7 +425,8 @@
         String encPropFile = getString(WSHandlerConstants.ENC_PROP_FILE,
                 reqData.getMsgContext());
         if (encPropFile != null) {
-            if ((crypto = (Crypto) cryptos.get(encPropFile)) == null) {
+            crypto = (Crypto) cryptos.get(encPropFile);
+            if (crypto == null) {
                 crypto = CryptoFactory.getInstance(encPropFile, this
                         .getClassLoader(reqData.getMsgContext()));
                 cryptos.put(encPropFile, crypto);
@@ -439,25 +442,28 @@
             if(refId != null) {
                 Object propObj = getProperty(reqData.getMsgContext(), refId);
                 if(propObj instanceof Properties) {
-                    if ((crypto = (Crypto) cryptos.get(refId)) == null) {
+                    crypto = (Crypto) cryptos.get(refId);
+                    if (crypto == null) {
                         crypto = CryptoFactory.getInstance((Properties)propObj);
                         cryptos.put(refId, crypto);
                     }
                 } else {
                     throw new WSSecurityException(
-                            "WSHandler: Encryption: encryptionPropRefId must hold a" +
-                    " java.util.Properties object");
+                        "WSHandler: Encryption: encryptionPropRefId must hold a" 
+                            + " java.util.Properties object"
+                    );
                 }
             }
         } else if ((crypto = reqData.getSigCrypto()) == null) {
             throw new WSSecurityException(
-            "WSHandler: Encryption: no crypto property file");
+                "WSHandler: Encryption: no crypto property file"
+            );
         }
         return crypto;
     }
 
     protected void decodeUTParameter(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         Object mc = reqData.getMsgContext();
 
         String type = getString(WSHandlerConstants.PASSWORD_TYPE, mc);
@@ -481,14 +487,15 @@
     }
 
     protected void decodeSignatureParameter(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         Object mc = reqData.getMsgContext();
         String keyId = getString(WSHandlerConstants.SIG_KEY_ID, mc);
         if (keyId != null) {
             Integer id = (Integer) WSHandlerConstants.keyIdentifier.get(keyId);
             if (id == null) {
                 throw new WSSecurityException(
-                "WSHandler: Signature: unknown key identification");
+                    "WSHandler: Signature: unknown key identification"
+                );
             }
             int tmp = id.intValue();
             if (!(tmp == WSConstants.ISSUER_SERIAL
@@ -497,7 +504,8 @@
                     || tmp == WSConstants.SKI_KEY_IDENTIFIER
                     || tmp == WSConstants.THUMBPRINT_IDENTIFIER)) {
                 throw new WSSecurityException(
-                "WSHandler: Signature: illegal key identification");
+                    "WSHandler: Signature: illegal key identification"
+                );
             }
             reqData.setSigKeyId(tmp);
         }
@@ -511,7 +519,7 @@
     }
 
     protected void decodeEncryptionParameter(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         Object mc = reqData.getMsgContext();
         String encUser = getString(WSHandlerConstants.ENCRYPTION_USER, mc);
 
@@ -536,11 +544,11 @@
          */
         String encKeyId = getString(WSHandlerConstants.ENC_KEY_ID, mc);
         if (encKeyId != null) {
-            Integer id = (Integer) WSHandlerConstants
-            .keyIdentifier.get(encKeyId);
+            Integer id = (Integer) WSHandlerConstants.keyIdentifier.get(encKeyId);
             if (id == null) {
                 throw new WSSecurityException(
-                "WSHandler: Encryption: unknown key identification");
+                    "WSHandler: Encryption: unknown key identification"
+                );
             }
             int tmp = id.intValue();
             reqData.setEncKeyId(tmp);
@@ -551,14 +559,15 @@
                     || tmp == WSConstants.EMBEDDED_KEYNAME
                     || tmp == WSConstants.THUMBPRINT_IDENTIFIER)) {
                 throw new WSSecurityException(
-                "WSHandler: Encryption: illegal key identification");
+                    "WSHandler: Encryption: illegal key identification"
+                );
             }
         }
         String encSymAlgo = getString(WSHandlerConstants.ENC_SYM_ALGO, mc);
         reqData.setEncSymmAlgo(encSymAlgo);
 
-        String encKeyTransport 
-        = getString(WSHandlerConstants.ENC_KEY_TRANSPORT, mc);
+        String encKeyTransport = 
+            getString(WSHandlerConstants.ENC_KEY_TRANSPORT, mc);
         reqData.setEncKeyTransport(encKeyTransport);
 
         String encParts = getString(WSHandlerConstants.ENCRYPTION_PARTS, mc);
@@ -569,8 +578,8 @@
 
     protected boolean decodeMustUnderstand(RequestData reqData) 
         throws WSSecurityException {
-        String mu = getString(WSHandlerConstants.MUST_UNDERSTAND,
-                reqData.getMsgContext());
+        String mu = 
+            getString(WSHandlerConstants.MUST_UNDERSTAND, reqData.getMsgContext());
 
         if (mu == null) {return true;}
 
@@ -578,12 +587,13 @@
         if ("1".equals(mu) || "true".equals(mu)) {return true;}
 
         throw new WSSecurityException(
-        "WSHandler: illegal mustUnderstand parameter");
+            "WSHandler: illegal mustUnderstand parameter"
+        );
     }
 
     public int decodeTimeToLive(RequestData reqData) {
-        String ttl = getString(WSHandlerConstants.TTL_TIMESTAMP,
-                reqData.getMsgContext());
+        String ttl = 
+            getString(WSHandlerConstants.TTL_TIMESTAMP, reqData.getMsgContext());
         int ttl_i = 0;
         if (ttl != null) {
             try {
@@ -609,11 +619,12 @@
         if ("1".equals(value) || "true".equals(value)) {return true;}
 
         throw new WSSecurityException(
-        "WSHandler: illegal enableSignatureConfirmation parameter");
+            "WSHandler: illegal enableSignatureConfirmation parameter"
+        );
     }
 
     protected boolean decodeTimestampPrecision(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         String value = getString(WSHandlerConstants.TIMESTAMP_PRECISION,
                 reqData.getMsgContext());
 
@@ -623,11 +634,12 @@
         if ("1".equals(value) || "true".equals(value)) {return true;}
 
         throw new WSSecurityException(
-        "WSHandler: illegal precisionInMilliSeconds parameter");
+            "WSHandler: illegal precisionInMilliSeconds parameter"
+        );
     }
 
     protected boolean decodeCustomPasswordTypes(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         String value = getString(
                 WSHandlerConstants.HANDLE_CUSTOM_PASSWORD_TYPES,
                 reqData.getMsgContext()
@@ -639,11 +651,12 @@
         if ("1".equals(value) || "true".equals(value)) {return true;}
 
         throw new WSSecurityException(
-        "WSHandler: illegal handleCustomPasswordTypes parameter");
+            "WSHandler: illegal handleCustomPasswordTypes parameter"
+        );
     }
 
     protected boolean decodeTimestampStrict(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         String value = getString(WSHandlerConstants.TIMESTAMP_STRICT,
                 reqData.getMsgContext());
 
@@ -653,7 +666,8 @@
         if ("1".equals(value) || "true".equals(value)) {return true;}
 
         throw new WSSecurityException(
-        "WSHandler: illegal timestampStrict parameter");
+            "WSHandler: illegal timestampStrict parameter"
+        );
     }
 
     /**
@@ -665,8 +679,8 @@
             int doAction,
             String clsProp,
             String refProp,
-            RequestData reqData)
-    throws WSSecurityException {
+            RequestData reqData
+    ) throws WSSecurityException {
         WSPasswordCallback pwCb = null;
         CallbackHandler cbHandler = null;
         String err = "provided null or empty password";
@@ -695,8 +709,8 @@
     private WSPasswordCallback readPwViaCallbackClass(String callback,
             String username,
             int doAction,
-            RequestData requestData)
-    throws WSSecurityException {
+            RequestData requestData
+    ) throws WSSecurityException {
 
         Class cbClass = null;
         CallbackHandler cbHandler = null;
@@ -727,8 +741,8 @@
      */
     private WSPasswordCallback performCallback(CallbackHandler cbHandler,
             String username,
-            int doAction)
-    throws WSSecurityException {
+            int doAction
+    ) throws WSSecurityException {
 
         WSPasswordCallback pwCb = constructPasswordCallback(username, doAction);
         Callback[] callbacks = new Callback[1];
@@ -767,7 +781,7 @@
     }
 
     private void splitEncParts(String tmpS, Vector parts, RequestData reqData)
-    throws WSSecurityException {
+        throws WSSecurityException {
         WSEncryptionPart encPart = null;
         String[] rawParts = StringUtil.split(tmpS, ';');
 
@@ -820,10 +834,9 @@
         if (!WSHandlerConstants.USE_REQ_SIG_CERT.equals(reqData.getEncUser())) {
             return;
         }
-        Vector results = null;
-        if ((results =
-            (Vector) getProperty(reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS))
-            == null) {
+        Vector results = 
+            (Vector) getProperty(reqData.getMsgContext(), WSHandlerConstants.RECV_RESULTS);
+        if (results == null) {
             return;
         }
         /*
@@ -846,8 +859,12 @@
             for (int j = 0; j < wsSecEngineResults.size(); j++) {
                 WSSecurityEngineResult wser =
                     (WSSecurityEngineResult) wsSecEngineResults.get(j);
-                if (wser.getAction() == WSConstants.SIGN) {
-                    reqData.setEncCert(wser.getCertificate());
+                int wserAction = 
+                    ((java.lang.Integer)wser.get(WSSecurityEngineResult.TAG_ACTION)).intValue();
+                if (wserAction == WSConstants.SIGN) {
+                    X509Certificate cert = 
+                        (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
+                    reqData.setEncCert(cert);
                     return;
                 }
             }
@@ -859,13 +876,14 @@
      * see fit.
      */
     protected Crypto loadDecryptionCrypto(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
 
         Crypto crypto = null;
         String decPropFile = getString(WSHandlerConstants.DEC_PROP_FILE,
                 reqData.getMsgContext());
         if (decPropFile != null) {
-            if ((crypto = (Crypto) cryptos.get(decPropFile)) == null) {
+            crypto = (Crypto) cryptos.get(decPropFile);
+            if (crypto == null) {
                 crypto = CryptoFactory.getInstance(decPropFile, this
                         .getClassLoader(reqData.getMsgContext()));
                 cryptos.put(decPropFile, crypto);
@@ -881,25 +899,28 @@
             if(refId != null) {
                 Object propObj = getProperty(reqData.getMsgContext(), refId);
                 if(propObj instanceof Properties) {
-                    if ((crypto = (Crypto) cryptos.get(refId)) == null) {
+                    crypto = (Crypto) cryptos.get(refId);
+                    if (crypto == null) {
                         crypto = CryptoFactory.getInstance((Properties)propObj);
                         cryptos.put(refId, crypto);
                     }
                 } else {
                     throw new WSSecurityException(
-                            "WSHandler: Decrytion: decryptionPropRefId must hold a" +
-                    " java.util.Properties object");
+                        "WSHandler: Decrytion: decryptionPropRefId must hold a" 
+                            + " java.util.Properties object"
+                    );
                 }
             }
         } else if ((crypto = reqData.getSigCrypto()) == null) {
             throw new WSSecurityException(
-            "WSHandler: Encryption: no crypto property file");
+                "WSHandler: Encryption: no crypto property file"
+            );
         }
         return crypto;
     }
 
     protected void decodeSignatureParameter2(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         reqData.setSigCrypto(loadSignatureCrypto(reqData));
         /* There are currently no other signature parameters that need 
          * to be handled here, but we call the load crypto hook rather 
@@ -912,9 +933,8 @@
      * Set and check the decryption specific parameters, if necessary
      * take over signature crypto instance.
      */
-
     protected void decodeDecryptionParameter(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
         reqData.setDecCrypto(loadDecryptionCrypto(reqData));
         /* There are currently no other decryption parameters that need 
          * to be handled here, but we call the load crypto hook rather 
@@ -928,7 +948,7 @@
      * <p/>
      */
     protected CallbackHandler getPasswordCB(RequestData reqData) 
-    throws WSSecurityException {
+        throws WSSecurityException {
 
         Object mc = reqData.getMsgContext();
         CallbackHandler cbHandler = null;
@@ -975,7 +995,8 @@
      * @return true if the certificate is trusted, false if not (AxisFault is thrown for exceptions during CertPathValidation)
      * @throws WSSecurityException
      */
-    protected boolean verifyTrust(X509Certificate cert, RequestData reqData) throws WSSecurityException {
+    protected boolean verifyTrust(X509Certificate cert, RequestData reqData) 
+        throws WSSecurityException {
 
         // If no certificate was transmitted, do not trust the signature
         if (cert == null) {
@@ -1014,7 +1035,7 @@
             }
 
             // If certificates have been found, the certificates must be compared
-            // to ensure againgst phony DNs (compare encoded form including signature)
+            // to ensure against phony DNs (compare encoded form including signature)
             if (certs != null && certs.length > 0 && cert.equals(certs[0])) {
                 if (doDebug) {
                     log.debug("Direct trust for certificate with " + subjectString);
@@ -1172,8 +1193,7 @@
             return s;
         }
         if (mc == null) {
-            throw new 
-            IllegalArgumentException("Message context cannot be null");
+            throw new IllegalArgumentException("Message context cannot be null");
         }
         return (String) getProperty(mc, key);
     }

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSBaseMessage.java Mon Sep 29 07:51:36 2008
@@ -20,7 +20,6 @@
 import org.apache.ws.security.SOAPConstants;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSSConfig;
-import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.util.WSSecurityUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSEncryptBody.java Mon Sep 29 07:51:36 2008
@@ -294,7 +294,7 @@
 
         if (keyIdentifierType == WSConstants.EMBEDDED_KEYNAME ||
             keyIdentifierType == WSConstants.EMBED_SECURITY_TOKEN_REF) {
-            return buildEmbedded(doc, crypto);
+            return buildEmbedded(doc);
         }
 
         long t0 = 0, t1 = 0, t2 = 0, t3 = 0;
@@ -550,7 +550,7 @@
         return encDataRefs;
     }
 
-    private Document buildEmbedded(Document doc, Crypto crypto)
+    private Document buildEmbedded(Document doc)
             throws WSSecurityException {
         doDebug = log.isDebugEnabled();
 

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecBase.java Mon Sep 29 07:51:36 2008
@@ -20,7 +20,6 @@
 import org.apache.ws.security.SOAPConstants;
 import org.apache.ws.security.WSConstants;
 import org.apache.ws.security.WSSConfig;
-import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.util.WSSecurityUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncrypt.java Mon Sep 29 07:51:36 2008
@@ -289,7 +289,7 @@
 
         if (keyIdentifierType == WSConstants.EMBEDDED_KEYNAME
                 || keyIdentifierType == WSConstants.EMBED_SECURITY_TOKEN_REF) {
-            return buildEmbedded(doc, crypto, secHeader);
+            return buildEmbedded(doc, secHeader);
         }
 
         if (doDebug) {
@@ -577,8 +577,8 @@
         return encDataRef;
     }
 
-    private Document buildEmbedded(Document doc, Crypto crypto,
-            WSSecHeader secHeader) throws WSSecurityException {
+    private Document buildEmbedded(Document doc, WSSecHeader secHeader) 
+        throws WSSecurityException {
         doDebug = log.isDebugEnabled();
 
         if (doDebug) {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecEncryptedKey.java Mon Sep 29 07:51:36 2008
@@ -186,7 +186,7 @@
      *            The bytes that represent the symmetric key
      * @param remoteCert
      *            The certificate that contains the public key to encrypt the
-     *            seymmetric key data
+     *            symmetric key data
      * @param crypto
      *            An instance of the Crypto API to handle keystore and
      *            certificates

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/WSSecSignatureConfirmation.java Mon Sep 29 07:51:36 2008
@@ -70,7 +70,7 @@
 	 */
 	public void prepare(Document doc) {
 		document = doc;
-        sc = new SignatureConfirmation(doc, signatureValue);;
+        sc = new SignatureConfirmation(doc, signatureValue);
 		String scId = "SigConf-" + sc.hashCode();
 		sc.setID(scId);
 	}

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/Timestamp.java Mon Sep 29 07:51:36 2008
@@ -93,7 +93,7 @@
             }
         }
 
-        DateFormat zulu = new XmlSchemaDateFormat();;
+        DateFormat zulu = new XmlSchemaDateFormat();
         
         try {
         	if (strCreated != null) {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/message/token/UsernameToken.java Mon Sep 29 07:51:36 2008
@@ -296,7 +296,6 @@
                 WSConstants.WSSE11_NS, WSConstants.WSSE11_PREFIX);
         this.elementIteration.appendChild(doc.createTextNode(text));
         element.appendChild(elementIteration);
-        return;
     }
 
     /**

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/ReferenceListProcessor.java Mon Sep 29 07:51:36 2008
@@ -101,7 +101,7 @@
 			}
 			if (tmpE.getLocalName().equals("DataReference")) {
 				String dataRefURI = ((Element) tmpE).getAttribute("URI");
-				WSDataRef dataRef = new WSDataRef(dataRefURI.substring(1));;
+				WSDataRef dataRef = new WSDataRef(dataRefURI.substring(1));
 				decryptDataRefEmbedded(doc, dataRefURI, dataRef,cb, crypto);
                 dataRefUris.add(dataRef);
 			}

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/SignatureProcessor.java Mon Sep 29 07:51:36 2008
@@ -115,7 +115,7 @@
      * here:
      * <ul>
      * <li> A URI reference to a binary security token contained in the <code>wsse:Security
-     * </code> header.  If the derefenced token is
+     * </code> header.  If the dereferenced token is
      * of the correct type the contained certificate is extracted.
      * </li>
      * <li> Issuer name an serial number of the certificate. In this case the method
@@ -188,19 +188,19 @@
 
             int docHash = elem.getOwnerDocument().hashCode();
             /*
-                * Her we get some information about the document that is being
-                * processed, in particular the crypto implementation, and already
-                * detected BST that may be used later during dereferencing.
-                */
+             * Here we get some information about the document that is being
+             * processed, in particular the crypto implementation, and already
+             * detected BST that may be used later during dereferencing.
+             */
             WSDocInfo wsDocInfo = WSDocInfoStore.lookup(docHash);
 
             if (secRef.containsReference()) {
                 Element token = secRef.getTokenElement(elem.getOwnerDocument(),
                         wsDocInfo, cb);
                 /*
-                     * at this point check token type: UsernameToken, Binary, SAML
-                     * Crypto required only for Binary and SAML
-                     */
+                 * at this point check token type: UsernameToken, Binary, SAML
+                 * Crypto required only for Binary and SAML
+                 */
                 QName el = new QName(token.getNamespaceURI(), token
                         .getLocalName());
                 if (el.equals(WSSecurityEngine.usernameToken)) {
@@ -256,7 +256,7 @@
                     }else {
                         
                         //Try custom token through callback handler
-                      //try to find a custom token
+                        //try to find a custom token
                         String id = secRef
                                 .getReference().getURI().substring(1);
                         WSPasswordCallback pwcb = new WSPasswordCallback(id,
@@ -354,10 +354,10 @@
                 }
                 signatureValue[0] = sig.getSignatureValue();
                 /*
-                     * Now dig into the Signature element to get the elements that
-                     * this Signature covers. Build the QName of these Elements and
-                     * return them to caller
-                     */
+                 * Now dig into the Signature element to get the elements that
+                 * this Signature covers. Build the QName of these Elements and
+                 * return them to caller
+                 */
                 SignedInfo si = sig.getSignedInfo();
                 int numReferences = si.getLength();
                 for (int i = 0; i < numReferences; i++) {

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/processor/TimestampProcessor.java Mon Sep 29 07:51:36 2008
@@ -84,7 +84,6 @@
 					"invalidTimestamp",
 					new Object[] { "The security semantics of message have expired" });
 		}
-		return;
 	}
     
     /* (non-Javadoc)

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerFactory.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerFactory.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerFactory.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerFactory.java Mon Sep 29 07:51:36 2008
@@ -20,7 +20,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.security.util.Loader;
-import org.apache.ws.security.saml.SAMLIssuer;
 
 import java.lang.reflect.Constructor;
 import java.net.URL;

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerImpl.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerImpl.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerImpl.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/saml/SAMLIssuerImpl.java Mon Sep 29 07:51:36 2008
@@ -19,7 +19,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.security.WSSecurityException;
-import org.apache.ws.security.saml.SAMLIssuer;
 import org.apache.ws.security.components.crypto.Crypto;
 import org.apache.ws.security.components.crypto.CryptoFactory;
 import org.apache.xml.security.exceptions.XMLSecurityException;
@@ -49,7 +48,6 @@
 public class SAMLIssuerImpl implements SAMLIssuer {
 
     private static final Log log = LogFactory.getLog(SAMLIssuerImpl.class.getName());
-    private static final boolean doDebug = log.isDebugEnabled();
 
     private SAMLAssertion sa = null;
 

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/transform/STRTransform.java Mon Sep 29 07:51:36 2008
@@ -215,7 +215,6 @@
             /*
              * Find start and end of first element <....>, this is the Apex node
              */
-            int lt = bf1.indexOf("<");
             int gt = bf1.indexOf(">");
             /*
              * Lookup the default namespace

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/util/DOM2Writer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/util/DOM2Writer.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/util/DOM2Writer.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/util/DOM2Writer.java Mon Sep 29 07:51:36 2008
@@ -124,6 +124,7 @@
                                 prefixIsDeclared = true;
                             }
                         } catch (IllegalArgumentException e) {
+                            //
                         }
                         if (!prefixIsDeclared) {
                             printNamespaceDecl(node, namespaceStack, out);
@@ -146,6 +147,7 @@
                                     prefixIsDeclared = true;
                                 }
                             } catch (IllegalArgumentException e) {
+                                //
                             }
                             if (!prefixIsDeclared) {
                                 printNamespaceDecl(attr, namespaceStack, out);

Modified: webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java?rev=700142&r1=700141&r2=700142&view=diff
==============================================================================
--- webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/trunk/src/org/apache/ws/security/util/WSSecurityUtil.java Mon Sep 29 07:51:36 2008
@@ -624,12 +624,10 @@
         }
         Element header = findChildElement(envelope, sc.getEnvelopeURI(), sc
                 .getHeaderQName().getLocalPart());
-        if (header == null) {
-            if (doCreate) {
-                header = createElementInSameNamespace(envelope, sc
-                        .getHeaderQName().getLocalPart());
-                header = prependChildElement(doc, envelope, header, true);
-            }
+        if (header == null && doCreate) {
+            header = createElementInSameNamespace(envelope, sc
+                    .getHeaderQName().getLocalPart());
+            header = prependChildElement(doc, envelope, header, true);
         }
         if (doCreate) {
             wsseSecurity = header.getOwnerDocument().createElementNS(



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org