You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2015/04/30 17:48:29 UTC
svn commit: r1677017 [1/3] - in /webservices/wss4j/branches/2_0_x-fixes:
ws-security-common/src/main/java/org/apache/wss4j/common/crypto/
ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/
ws-security-common/src/main/java/org/apache/w...
Author: coheigea
Date: Thu Apr 30 15:48:27 2015
New Revision: 1677017
URL: http://svn.apache.org/r1677017
Log:
Security Exception refactor
Modified:
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenSignedAction.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/bsp/BSPEnforcer.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignature.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecUsernameToken.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/BinarySecurity.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/KerberosSecurity.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/Reference.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SecurityTokenReference.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SignatureConfirmation.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/X509Security.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/DerivedKeyTokenProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedAssertionProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/UsernameTokenProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/X509Util.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSSAMLKeyInfoProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSecSignatureSAML.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/DerivedKeyTokenSTRParser.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SecurityTokenRefSTRParser.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransformUtil.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/KerberosTokenValidator.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SamlAssertionValidator.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/TimestampValidator.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/UsernameTokenValidator.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomSamlAssertionValidator.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSConfigurationException.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSCrypto.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSUtils.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/InboundWSSecurityContextImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/BinarySecurityTokenInputHandler.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DecryptInputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DerivedKeyTokenInputHandler.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/TimestampInputHandler.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptedKeyOutputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityHeaderReorderProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureEndingOutputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureOutputProcessor.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/EncryptedKeySha1SecurityTokenImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ExternalSecurityTokenImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosClientSecurityToken.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosServiceSecurityTokenImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SamlSecurityTokenImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/BinarySecurityTokenValidatorImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SamlTokenValidatorImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/TimestampValidatorImpl.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
webservices/wss4j/branches/2_0_x-fixes/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/UsernameTokenTest.java
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java Thu Apr 30 15:48:27 2015
@@ -199,7 +199,8 @@ public class CertificateStore extends Cr
);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", "No trusted certs found"
+ WSSecurityException.ErrorCode.FAILURE, "certpath",
+ new Object[] {"No trusted certs found"}
);
}
@@ -249,28 +250,28 @@ public class CertificateStore extends Cr
validator.validate(path, param);
} catch (java.security.NoSuchProviderException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e,
- e.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath",
+ new Object[] {e.getMessage()}
);
} catch (NoSuchAlgorithmException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e,
- e.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath",
+ new Object[] {e.getMessage()}
);
} catch (java.security.cert.CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e,
- e.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath",
+ new Object[] {e.getMessage()}
);
} catch (java.security.InvalidAlgorithmParameterException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e,
- e.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath",
+ new Object[] {e.getMessage()}
);
} catch (java.security.cert.CertPathValidatorException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e,
- e.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath",
+ new Object[] {e.getMessage()}
);
}
@@ -364,7 +365,7 @@ public class CertificateStore extends Cr
sha = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
+ WSSecurityException.ErrorCode.FAILURE, e, "decoding.general"
);
}
for (X509Certificate trustedCert : trustedCerts) {
@@ -372,7 +373,7 @@ public class CertificateStore extends Cr
sha.update(trustedCert.getEncoded());
} catch (CertificateEncodingException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", ex
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, ex, "encodeError"
);
}
byte[] data = sha.digest();
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java Thu Apr 30 15:48:27 2015
@@ -168,11 +168,11 @@ public abstract class CryptoBase impleme
certFactMap.put(factory.getProvider().getName(), factory);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "unsupportedCertType", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "unsupportedCertType"
);
} catch (NoSuchProviderException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "noSecProvider", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "noSecProvider"
);
}
}
@@ -192,7 +192,7 @@ public abstract class CryptoBase impleme
return (X509Certificate) certFactory.generateCertificate(in);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "parseError", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "parseError"
);
}
}
@@ -225,8 +225,8 @@ public abstract class CryptoBase impleme
return digest.digest(value);
} catch (Exception ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN, "noSKIHandling", ex,
- "No SKI certificate extension and no SHA1 message digest available"
+ WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN, ex, "noSKIHandling",
+ new Object[] {"No SKI certificate extension and no SHA1 message digest available"}
);
}
}
@@ -258,11 +258,11 @@ public abstract class CryptoBase impleme
return path.getEncoded();
} catch (CertificateEncodingException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "encodeError"
);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "parseError", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "parseError"
);
}
}
@@ -283,7 +283,7 @@ public abstract class CryptoBase impleme
path = getCertificateFactory().generateCertPath(in);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "parseError", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "parseError"
);
}
List<?> l = path.getCertificates();
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java Thu Apr 30 15:48:27 2015
@@ -79,7 +79,8 @@ public abstract class CryptoFactory {
LOG.debug("Cannot load Crypto instance as properties object is null");
}
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", null, "Cannot load Crypto instance as properties object is null");
+ "empty",
+ new Object[] {"Cannot load Crypto instance as properties object is null"});
}
return getInstance(properties, Loader.getClassLoader(CryptoFactory.class), null);
}
@@ -111,7 +112,8 @@ public abstract class CryptoFactory {
LOG.debug("Cannot load Crypto instance as properties object is null");
}
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", null, "Cannot load Crypto instance as properties object is null");
+ "empty",
+ new Object[] {"Cannot load Crypto instance as properties object is null"});
}
String cryptoClassName = properties.getProperty("org.apache.wss4j.crypto.provider");
@@ -129,9 +131,10 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to instantiate Merlin", e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", e, "Cannot create Crypto class "
- + cryptoClassName);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty",
+ new Object[] {"Cannot create Crypto class "
+ + cryptoClassName});
}
} else {
try {
@@ -141,8 +144,8 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug(ex.getMessage(), ex);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", ex, cryptoClassName + " Not Found");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
+ "empty", new Object[] {cryptoClassName + " Not Found"});
}
}
return loadClass(cryptoClass, properties, classLoader);
@@ -231,8 +234,8 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to instantiate: " + cryptoClass.getName(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", e, cryptoClass + " cannot create instance");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {cryptoClass + " cannot create instance"});
}
}
@@ -267,8 +270,8 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to instantiate: " + cryptoClass.getName(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", e, cryptoClass + " cannot create instance");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {cryptoClass + " cannot create instance"});
}
}
@@ -290,7 +293,7 @@ public abstract class CryptoFactory {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
"resourceNotFound",
- propFilename
+ new Object[] {propFilename}
);
}
properties.load(url.openStream());
@@ -299,8 +302,8 @@ public abstract class CryptoFactory {
LOG.debug("Cannot find resource: " + propFilename, e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE,
- "resourceNotFound", e, propFilename
+ WSSecurityException.ErrorCode.FAILURE, e,
+ "resourceNotFound", new Object[] {propFilename}
);
}
return properties;
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java Thu Apr 30 15:48:27 2015
@@ -60,7 +60,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Invalid DER string"
+ new Object[] {"Invalid DER string"}
);
}
arr = derEncoded;
@@ -86,7 +86,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Unsupported DER format"
+ new Object[] {"Unsupported DER format"}
);
}
pos += length;
@@ -118,7 +118,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Invalid DER format"
+ new Object[] {"Invalid DER format"}
);
}
pos++;
@@ -137,7 +137,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Invalid DER format"
+ new Object[] {"Invalid DER format"}
);
}
return arr[pos] == val;
@@ -165,7 +165,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Invalid DER format"
+ new Object[] {"Invalid DER format"}
);
}
int len;
@@ -180,7 +180,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Invalid DER format"
+ new Object[] {"Invalid DER format"}
);
}
byte[] lenBytes = new byte[nbytes];
@@ -206,13 +206,13 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Invalid DER format"
+ new Object[] {"Invalid DER format"}
);
} else if (length < 0) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Unsupported DER format"
+ new Object[] {"Unsupported DER format"}
);
}
byte[] value = new byte[length];
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java Thu Apr 30 15:48:27 2015
@@ -339,7 +339,7 @@ public class Merlin extends CryptoBase {
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "ioError00", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "ioError00");
} finally {
if (is != null) {
is.close();
@@ -372,7 +372,8 @@ public class Merlin extends CryptoBase {
LOG.debug(e.getMessage(), e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "proxyNotFound", e, location
+ WSSecurityException.ErrorCode.FAILURE, e, "proxyNotFound",
+ new Object[] {location}
);
}
}
@@ -405,17 +406,17 @@ public class Merlin extends CryptoBase {
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "ioError00", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "ioError00");
} catch (GeneralSecurityException e) {
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "secError00", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "secError00");
} catch (Exception e) {
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "error00", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "error00");
}
return ks;
}
@@ -540,11 +541,11 @@ public class Merlin extends CryptoBase {
certFactMap.put(factory.getProvider().getName(), factory);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "unsupportedCertType", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "unsupportedCertType"
);
} catch (NoSuchProviderException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "noSecProvider", e
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "noSecProvider"
);
}
}
@@ -585,7 +586,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "keystore", ex
+ WSSecurityException.ErrorCode.FAILURE, ex, "keystore"
);
}
}
@@ -674,10 +675,12 @@ public class Merlin extends CryptoBase {
CallbackHandler callbackHandler
) throws WSSecurityException {
if (keystore == null) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "The keystore is null");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {"The keystore is null"});
}
if (callbackHandler == null) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "The CallbackHandler is null");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {"The CallbackHandler is null"});
}
String identifier = getIdentifier(certificate, keystore);
@@ -686,7 +689,8 @@ public class Merlin extends CryptoBase {
String msg = "Cannot find key for alias: [" + identifier + "]";
String logMsg = createKeyStoreErrorMessage(keystore);
LOG.error(msg + logMsg);
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {msg});
}
String password = getPassword(identifier, callbackHandler);
if (password == null && privatePasswordSet) {
@@ -705,20 +709,24 @@ public class Merlin extends CryptoBase {
String msg = "Key is not a private key, alias: [" + identifier + "]";
String logMsg = createKeyStoreErrorMessage(keystore);
LOG.error(msg + logMsg);
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {msg});
}
return (PrivateKey) keyTmp;
} catch (KeyStoreException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
+ new Object[] {ex.getMessage()}
);
} catch (UnrecoverableKeyException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
+ new Object[] {ex.getMessage()}
);
} catch (NoSuchAlgorithmException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
+ new Object[] {ex.getMessage()}
);
}
}
@@ -735,14 +743,16 @@ public class Merlin extends CryptoBase {
String password
) throws WSSecurityException {
if (keystore == null) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "The keystore is null");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {"The keystore is null"});
}
try {
if (identifier == null || !keystore.isKeyEntry(identifier)) {
String msg = "Cannot find key for alias: [" + identifier + "]";
String logMsg = createKeyStoreErrorMessage(keystore);
LOG.error(msg + logMsg);
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {msg});
}
if (password == null && privatePasswordSet) {
password = properties.getProperty(PREFIX + KEYSTORE_PRIVATE_PASSWORD);
@@ -759,20 +769,24 @@ public class Merlin extends CryptoBase {
String msg = "Key is not a private key, alias: [" + identifier + "]";
String logMsg = createKeyStoreErrorMessage(keystore);
LOG.error(msg + logMsg);
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {msg});
}
return (PrivateKey) keyTmp;
} catch (KeyStoreException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
+ new Object[] {ex.getMessage()}
);
} catch (UnrecoverableKeyException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
+ new Object[] {ex.getMessage()}
);
} catch (NoSuchAlgorithmException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
+ new Object[] {ex.getMessage()}
);
}
}
@@ -811,11 +825,11 @@ public class Merlin extends CryptoBase {
certs[0].checkValidity();
} catch (CertificateExpiredException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_CHECK, "invalidCert", e
+ WSSecurityException.ErrorCode.FAILED_CHECK, e, "invalidCert"
);
} catch (CertificateNotYetValidException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_CHECK, "invalidCert", e
+ WSSecurityException.ErrorCode.FAILED_CHECK, e, "invalidCert"
);
}
if (LOG.isDebugEnabled()) {
@@ -849,7 +863,8 @@ public class Merlin extends CryptoBase {
);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", "No trusted certs found"
+ WSSecurityException.ErrorCode.FAILURE, "certpath",
+ new Object[] {"No trusted certs found"}
);
}
@@ -924,33 +939,33 @@ public class Merlin extends CryptoBase {
validator.validate(path, param);
} catch (NoSuchProviderException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath"
);
} catch (NoSuchAlgorithmException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE,
- "certpath", e, e.getMessage()
+ WSSecurityException.ErrorCode.FAILURE, e,
+ "certpath", new Object[] {e.getMessage()}
);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath"
);
} catch (InvalidAlgorithmParameterException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath"
);
} catch (java.security.cert.CertPathValidatorException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_AUTHENTICATION, "certpath", e
+ WSSecurityException.ErrorCode.FAILED_AUTHENTICATION, e, "certpath"
);
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath"
);
} catch (NullPointerException e) {
// NPE thrown by JDK 1.7 for one of the test cases
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath", e
+ WSSecurityException.ErrorCode.FAILURE, e, "certpath"
);
}
@@ -1085,7 +1100,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "keystore", e
+ WSSecurityException.ErrorCode.FAILURE, e, "keystore"
);
}
return new Certificate[]{};
@@ -1105,7 +1120,7 @@ public class Merlin extends CryptoBase {
sha = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
+ WSSecurityException.ErrorCode.FAILURE, e, "decoding.general"
);
}
Certificate[] certs = null;
@@ -1162,8 +1177,8 @@ public class Merlin extends CryptoBase {
sha.update(x509cert.getEncoded());
} catch (CertificateEncodingException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError",
- ex
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, ex,
+ "encodeError"
);
}
byte[] data = sha.digest();
@@ -1175,7 +1190,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "keystore", e
+ WSSecurityException.ErrorCode.FAILURE, e, "keystore"
);
}
return new Certificate[]{};
@@ -1245,7 +1260,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "keystore", e
+ WSSecurityException.ErrorCode.FAILURE, e, "keystore"
);
}
return new Certificate[]{};
@@ -1333,7 +1348,7 @@ public class Merlin extends CryptoBase {
return null;
}
} catch (KeyStoreException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "keystore", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "keystore");
}
X509Certificate[] x509certs = new X509Certificate[certs.length];
@@ -1413,7 +1428,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "keystore", e
+ WSSecurityException.ErrorCode.FAILURE, e, "keystore"
);
}
return new Certificate[]{};
@@ -1469,7 +1484,7 @@ public class Merlin extends CryptoBase {
}
}
} catch (KeyStoreException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "keystore", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "keystore");
}
return null;
}
@@ -1492,13 +1507,13 @@ public class Merlin extends CryptoBase {
cb.handle(callbacks);
} catch (IOException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE,
- "noPassword", e, identifier
+ WSSecurityException.ErrorCode.FAILURE, e,
+ "noPassword", new Object[] {identifier}
);
} catch (UnsupportedCallbackException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE,
- "noPassword", e, identifier
+ WSSecurityException.ErrorCode.FAILURE, e,
+ "noPassword", new Object[] {identifier}
);
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java Thu Apr 30 15:48:27 2015
@@ -222,7 +222,7 @@ public class MerlinDevice extends Merlin
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "ioError00", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "ioError00");
} finally {
if (is != null) {
is.close();
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java Thu Apr 30 15:48:27 2015
@@ -52,7 +52,7 @@ public class X509SubjectPublicKeyInfo ex
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Support for X.509-encoded public keys only"
+ new Object[] {"Support for X.509-encoded public keys only"}
);
}
}
@@ -86,7 +86,7 @@ public class X509SubjectPublicKeyInfo ex
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Unsupported X.509 public key format"
+ new Object[] {"Unsupported X.509 public key format"}
);
}
skip(algIDlen); // AlgorithmIdentifier contents
@@ -97,7 +97,7 @@ public class X509SubjectPublicKeyInfo ex
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- "Invalid X.509 public key format"
+ new Object[] {"Invalid X.509 public key format"}
);
}
skip(1); // number unused bits
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java Thu Apr 30 15:48:27 2015
@@ -41,7 +41,7 @@ public final class AlgoFactory {
return new P_SHA1();
} else {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "unknownAlgorithm", algorithm);
+ "unknownAlgorithm", new Object[] {algorithm});
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java Thu Apr 30 15:48:27 2015
@@ -64,9 +64,9 @@ public class P_SHA1 implements Derivatio
return key;
} catch (NoSuchAlgorithmException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "errorInKeyDerivation", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "errorInKeyDerivation");
} catch (InvalidKeyException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "errorInKeyDerivation", e);
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "errorInKeyDerivation");
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java Thu Apr 30 15:48:27 2015
@@ -127,61 +127,34 @@ public class WSSecurityException extends
}
private ErrorCode errorCode;
-
- /**
- * Constructor.
- * <p/>
- *
- * @param errorCode
- * @param msgId
- * @param exception
- * @param arguments
- */
- public WSSecurityException(ErrorCode errorCode, String msgId, Exception exception, Object... arguments) {
- super(msgId, arguments, exception);
- this.errorCode = errorCode;
+
+ public WSSecurityException(ErrorCode errorCode) {
+ this(errorCode, errorCode.name());
}
-
- /**
- * Constructor.
- * <p/>
- *
- * @param errorCode
- * @param msgId
- * @param exception
- */
- public WSSecurityException(ErrorCode errorCode, String msgId, Exception exception) {
- super(msgId, exception);
+
+ public WSSecurityException(ErrorCode errorCode, String msgId) {
+ super(msgId, new Object[]{});
this.errorCode = errorCode;
}
-
+
public WSSecurityException(ErrorCode errorCode, Exception exception) {
super(exception);
this.errorCode = errorCode;
}
-
- /**
- * Constructor.
- * <p/>
- *
- * @param errorCode
- * @param msgId
- * @param arguments
- */
- public WSSecurityException(ErrorCode errorCode, String msgId, Object... arguments) {
- super(msgId, arguments);
+
+ public WSSecurityException(ErrorCode errorCode, Exception exception, String msgId) {
+ super(msgId, exception);
this.errorCode = errorCode;
}
+ public WSSecurityException(ErrorCode errorCode, Exception exception, String msgId, Object[] arguments) {
+ super(msgId, arguments, exception);
+ this.errorCode = errorCode;
+ }
- /**
- * Constructor.
- * <p/>
- *
- * @param errorCode
- */
- public WSSecurityException(ErrorCode errorCode) {
- this(errorCode, errorCode.name());
+ public WSSecurityException(ErrorCode errorCode, String msgId, Object[] arguments) {
+ super(msgId, arguments);
+ this.errorCode = errorCode;
}
/**
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java Thu Apr 30 15:48:27 2015
@@ -134,22 +134,22 @@ public class KerberosClientExceptionActi
}
catch (ClassNotFoundException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, "kerberosServiceTicketError", new Object[] {}, e
+ ErrorCode.FAILURE, e, "kerberosServiceTicketError"
);
}
catch (NoSuchMethodException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, "kerberosServiceTicketError", e
+ ErrorCode.FAILURE, e, "kerberosServiceTicketError"
);
}
catch (InvocationTargetException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, "kerberosServiceTicketError", e.getCause()
+ ErrorCode.FAILURE, e, "kerberosServiceTicketError"
);
}
catch (IllegalAccessException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, "kerberosServiceTicketError", new Object[] {}, e
+ ErrorCode.FAILURE, e, "kerberosServiceTicketError"
);
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java Thu Apr 30 15:48:27 2015
@@ -126,22 +126,22 @@ public class KerberosServiceExceptionAct
}
catch (ClassNotFoundException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID, new Object[] {}, e
+ ErrorCode.FAILURE, e, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID
);
}
catch (NoSuchMethodException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID, e
+ ErrorCode.FAILURE, e, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID
);
}
catch (InvocationTargetException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID, e.getCause()
+ ErrorCode.FAILURE, e, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID
);
}
catch (IllegalAccessException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID, new Object[] {}, e
+ ErrorCode.FAILURE, e, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID
);
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java Thu Apr 30 15:48:27 2015
@@ -85,17 +85,20 @@ public final class OpenSAMLUtil {
public static XMLObject fromDom(Element root) throws WSSecurityException {
if (root == null) {
LOG.debug("Attempting to unmarshal a null element!");
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "Error unmarshalling a SAML assertion");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {"Error unmarshalling a SAML assertion"});
}
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(root);
if (unmarshaller == null) {
LOG.debug("Unable to find an unmarshaller for element: " + root.getLocalName());
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "Error unmarshalling a SAML assertion");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {"Error unmarshalling a SAML assertion"});
}
try {
return unmarshaller.unmarshall(root);
} catch (UnmarshallingException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex, "Error unmarshalling a SAML assertion");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
+ new Object[] {"Error unmarshalling a SAML assertion"});
}
}
@@ -146,7 +149,8 @@ public final class OpenSAMLUtil {
element = marshaller.marshall(xmlObject, doc);
}
} catch (MarshallingException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex, "Error marshalling a SAML assertion");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
+ new Object[] {"Error marshalling a SAML assertion"});
}
if (signObject) {
@@ -217,7 +221,8 @@ public final class OpenSAMLUtil {
try {
Signer.signObject(signature);
} catch (SignatureException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex, "Error signing a SAML assertion");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
+ new Object[] {"Error signing a SAML assertion"});
}
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java Thu Apr 30 15:48:27 2015
@@ -274,7 +274,7 @@ public final class SAMLUtil {
if (certs == null || certs.length < 1) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- "cannot get certificate or key"
+ new Object[] {"cannot get certificate or key"}
);
}
return new SAMLKeyInfo(certs);
@@ -284,8 +284,8 @@ public final class SAMLUtil {
}
} catch (Exception ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", ex,
- "cannot get certificate or key"
+ WSSecurityException.ErrorCode.FAILURE, ex, "invalidSAMLsecurity",
+ new Object[] {"cannot get certificate or key"}
);
}
return null;
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java Thu Apr 30 15:48:27 2015
@@ -526,8 +526,10 @@ public class SamlAssertionWrapper {
X509Certificate[] issuerCerts = issuerCrypto.getX509Certificates(cryptoType);
if (issuerCerts == null || issuerCerts.length == 0) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
+ new Object[] {
"No issuer certs were found to sign the SAML Assertion using issuer name: "
- + issuerKeyName);
+ + issuerKeyName
+ });
}
String sigAlgo = signatureAlgorithm;
@@ -550,7 +552,7 @@ public class SamlAssertionWrapper {
}
if (privateKey == null) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
- "No private key was found using issuer name: " + issuerKeyName);
+ new Object[] {"No private key was found using issuer name: " + issuerKeyName});
}
signature.setSignatureAlgorithm(sigAlgo);
@@ -572,8 +574,8 @@ public class SamlAssertionWrapper {
signingCredential);
signature.setKeyInfo(keyInfo);
} catch (org.opensaml.xml.security.SecurityException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
- "Error generating KeyInfo from signing credential");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
+ new Object[] {"Error generating KeyInfo from signing credential"});
}
// add the signature to the assertion
@@ -594,7 +596,7 @@ public class SamlAssertionWrapper {
if (keyInfo == null) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- "cannot get certificate or key"
+ new Object[] {"cannot get certificate or key"}
);
}
SAMLKeyInfo samlKeyInfo =
@@ -617,7 +619,7 @@ public class SamlAssertionWrapper {
if (samlKeyInfo == null) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- "cannot get certificate or key"
+ new Object[] {"cannot get certificate or key"}
);
}
@@ -629,15 +631,15 @@ public class SamlAssertionWrapper {
} else {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- "cannot get certificate or key"
+ new Object[] {"cannot get certificate or key"}
);
}
SignatureValidator sigValidator = new SignatureValidator(credential);
try {
sigValidator.validate(sig);
} catch (ValidationException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", ex, "SAML signature validation failed");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
+ "empty", new Object[] {"SAML signature validation failed"});
}
signatureKeyInfo = samlKeyInfo;
} else {
@@ -657,8 +659,8 @@ public class SamlAssertionWrapper {
try {
validator.validate(sig);
} catch (ValidationException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", ex, "SAML signature validation failed");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
+ "empty", new Object[] {"SAML signature validation failed"});
}
}
}
@@ -760,11 +762,11 @@ public class SamlAssertionWrapper {
return xmlSignature.getSignatureValue();
} catch (XMLSignatureException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", e
+ WSSecurityException.ErrorCode.FAILURE, e, "invalidSAMLsecurity"
);
} catch (XMLSecurityException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", e
+ WSSecurityException.ErrorCode.FAILURE, e, "invalidSAMLsecurity"
);
}
}
@@ -1000,7 +1002,7 @@ public class SamlAssertionWrapper {
} catch (ValidationException e) {
LOG.debug("Saml Validation error: " + e.getMessage(), e);
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", e
+ WSSecurityException.ErrorCode.FAILURE, e, "invalidSAMLsecurity"
);
}
} else if (getSaml2() != null) {
@@ -1014,7 +1016,7 @@ public class SamlAssertionWrapper {
} catch (ValidationException e) {
LOG.debug("Saml Validation error: " + e.getMessage(), e);
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", e
+ WSSecurityException.ErrorCode.FAILURE, e, "invalidSAMLsecurity"
);
}
}
@@ -1091,8 +1093,8 @@ public class SamlAssertionWrapper {
saml1.setAdvice(advice);
}
} catch (org.opensaml.xml.security.SecurityException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
- "Error generating KeyInfo from signing credential"
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
+ new Object[] {"Error generating KeyInfo from signing credential"}
);
}
@@ -1133,8 +1135,8 @@ public class SamlAssertionWrapper {
SAML2ComponentBuilder.createSaml2Subject(samlCallback.getSubject());
saml2.setSubject(subject);
} catch (org.opensaml.xml.security.SecurityException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
- "Error generating KeyInfo from signing credential"
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
+ new Object[] {"Error generating KeyInfo from signing credential"}
);
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java Thu Apr 30 15:48:27 2015
@@ -125,10 +125,9 @@ public class SpnegoTokenContext {
LOG.debug(ex.getMessage(), ex);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE,
+ WSSecurityException.ErrorCode.FAILURE, ex,
"kerberosLoginError",
- ex,
- ex.getMessage());
+ new Object[] {ex.getMessage()});
}
if (LOG.isDebugEnabled()) {
LOG.debug("Successfully authenticated to the TGT");
@@ -140,7 +139,7 @@ public class SpnegoTokenContext {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
"kerberosLoginError",
- "No Client principals found after login");
+ new Object[] {"No Client principals found after login"});
}
// Get the service ticket
@@ -182,7 +181,7 @@ public class SpnegoTokenContext {
throw (WSSecurityException) cause;
} else {
throw new WSSecurityException(
- ErrorCode.FAILURE, "kerberosServiceTicketError", cause
+ ErrorCode.FAILURE, new Exception(cause), "kerberosServiceTicketError"
);
}
}
@@ -239,10 +238,9 @@ public class SpnegoTokenContext {
LOG.debug(ex.getMessage(), ex);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE,
+ WSSecurityException.ErrorCode.FAILURE, ex,
"kerberosLoginError",
- ex,
- ex.getMessage());
+ new Object[] {ex.getMessage()});
}
if (LOG.isDebugEnabled()) {
LOG.debug("Successfully authenticated to the TGT");
@@ -257,7 +255,7 @@ public class SpnegoTokenContext {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
"kerberosLoginError",
- "No Client principals found after login");
+ new Object[] {"No Client principals found after login"});
}
service = principals.iterator().next().getName();
}
@@ -293,7 +291,7 @@ public class SpnegoTokenContext {
throw (WSSecurityException) cause;
} else {
throw new WSSecurityException(
- ErrorCode.FAILURE, "kerberosServiceTicketError", cause
+ ErrorCode.FAILURE, new Exception(cause), "kerberosServiceTicketError"
);
}
}
@@ -340,7 +338,7 @@ public class SpnegoTokenContext {
LOG.debug("Error in cleaning up a GSS context", e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "spnegoKeyError", e
+ WSSecurityException.ErrorCode.FAILURE, e, "spnegoKeyError"
);
}
}
@@ -357,7 +355,7 @@ public class SpnegoTokenContext {
LOG.debug("Error in cleaning up a GSS context", e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "spnegoKeyError", e
+ WSSecurityException.ErrorCode.FAILURE, e, "spnegoKeyError"
);
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java Thu Apr 30 15:48:27 2015
@@ -67,7 +67,7 @@ public final class UsernameTokenUtil {
LOG.debug(e.getMessage(), e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
+ WSSecurityException.ErrorCode.FAILURE, e, "decoding.general"
);
}
//
@@ -105,8 +105,8 @@ public final class UsernameTokenUtil {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", e, "Unable to convert password to UTF-8");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {"Unable to convert password to UTF-8"});
}
}
@@ -144,9 +144,8 @@ public final class UsernameTokenUtil {
try {
return XMLSecurityConstants.generateBytes(length);
} catch (Exception ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", ex,
- "Error in generating nonce of length " + length
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
+ "empty", new Object[] {"Error in generating nonce of length " + length}
);
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java Thu Apr 30 15:48:27 2015
@@ -652,12 +652,12 @@ public class WSSConfig {
if (actionObject instanceof Class<?>) {
try {
return (Action)((Class<?>)actionObject).newInstance();
- } catch (Throwable t) {
+ } catch (Exception ex) {
if (LOG.isDebugEnabled()) {
- LOG.debug(t.getMessage(), t);
+ LOG.debug(ex.getMessage(), ex);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "unableToLoadClass", t, ((Class<?>)actionObject).getName());
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
+ "unableToLoadClass", new Object[] {((Class<?>)actionObject).getName()});
}
} else if (actionObject instanceof Action) {
return (Action)actionObject;
@@ -744,12 +744,12 @@ public class WSSConfig {
if (validatorObject instanceof Class<?>) {
try {
return (Validator)((Class<?>)validatorObject).newInstance();
- } catch (Throwable t) {
+ } catch (Exception ex) {
if (LOG.isDebugEnabled()) {
- LOG.debug(t.getMessage(), t);
+ LOG.debug(ex.getMessage(), ex);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "unableToLoadClass", t, ((Class<?>)validatorObject).getName());
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
+ "unableToLoadClass", new Object[] {((Class<?>)validatorObject).getName()});
}
} else if (validatorObject instanceof Validator) {
return (Validator)validatorObject;
@@ -770,12 +770,12 @@ public class WSSConfig {
if (processorObject instanceof Class<?>) {
try {
return (Processor)((Class<?>)processorObject).newInstance();
- } catch (Throwable t) {
+ } catch (Exception ex) {
if (LOG.isDebugEnabled()) {
- LOG.debug(t.getMessage(), t);
+ LOG.debug(ex.getMessage(), ex);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "unableToLoadClass", t, ((Class<?>)processorObject).getName());
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
+ "unableToLoadClass", new Object[] {((Class<?>)processorObject).getName()});
}
} else if (processorObject instanceof Processor) {
return (Processor)processorObject;
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java Thu Apr 30 15:48:27 2015
@@ -53,14 +53,14 @@ public class CustomTokenAction implement
try {
callbackHandler.handle(new Callback[]{wsPasswordCallback});
} catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", e, "WSHandler: password callback failed");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {"WSHandler: password callback failed"});
}
Element customToken = wsPasswordCallback.getCustomToken();
if (customToken == null) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "resourceNotFound", "CustomToken"
+ WSSecurityException.ErrorCode.FAILURE, "resourceNotFound", new Object[] {"CustomToken"}
);
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java Thu Apr 30 15:48:27 2015
@@ -109,7 +109,8 @@ public class EncryptionAction implements
try {
wsEncrypt.build(doc, encryptionToken.getCrypto(), reqData.getSecHeader());
} catch (WSSecurityException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", e, "Error during encryption: ");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {"Error during encryption: "});
}
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java Thu Apr 30 15:48:27 2015
@@ -127,7 +127,7 @@ public class EncryptionDerivedAction ext
} catch (WSSecurityException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", e, "Error during Encryption: ");
+ "empty", new Object[] {"Error during Encryption: "});
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java Thu Apr 30 15:48:27 2015
@@ -136,7 +136,8 @@ public class SAMLTokenSignedAction imple
reqData.getSecHeader());
reqData.getSignatureValues().add(wsSign.getSignatureValue());
} catch (WSSecurityException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", e, "Error when signing the SAML token: ");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {"Error when signing the SAML token: "});
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java Thu Apr 30 15:48:27 2015
@@ -156,7 +156,8 @@ public class SignatureAction implements
}
reqData.getSignatureValues().add(wsSign.getSignatureValue());
} catch (WSSecurityException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", e, "Error during Signature: ");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {"Error during Signature: "});
}
}
Modified: webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java?rev=1677017&r1=1677016&r2=1677017&view=diff
==============================================================================
--- webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java (original)
+++ webservices/wss4j/branches/2_0_x-fixes/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java Thu Apr 30 15:48:27 2015
@@ -135,7 +135,8 @@ public class SignatureDerivedAction exte
reqData.getSignatureValues().add(wsSign.getSignatureValue());
} catch (WSSecurityException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", e, "Error during Signature: ");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
+ "empty", new Object[] {"Error during Signature: "});
}
}