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/05/08 12:40:21 UTC
svn commit: r1678324 [1/3] - in /webservices/wss4j/trunk:
ws-security-common/src/main/java/org/apache/wss4j/common/bsp/
ws-security-common/src/main/java/org/apache/wss4j/common/crypto/
ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey...
Author: coheigea
Date: Fri May 8 10:40:20 2015
New Revision: 1678324
URL: http://svn.apache.org/r1678324
Log:
Revert "Security Exception refactor"
This reverts commit b6f1b923ff597118df27f4b1d31b501b946618d6.
Modified:
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPEnforcer.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/X509Security.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java
webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SignatureDerivedAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/UsernameTokenSignedAction.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/handler/WSHandler.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncrypt.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecEncryptedKey.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignature.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecSignatureBase.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecUsernameToken.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/KerberosSecurity.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/SignatureConfirmation.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/token/UsernameToken.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/DerivedKeyTokenProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedAssertionProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/EncryptedKeyProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/ReferenceListProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SAMLTokenProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SecurityContextTokenProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/SignatureProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/UsernameTokenProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/processor/X509Util.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSSAMLKeyInfoProcessor.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/saml/WSSecSignatureSAML.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/DerivedKeyTokenSTRParser.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/STRParserUtil.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SecurityTokenRefSTRParser.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/str/SignatureSTRParser.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/transform/STRTransformUtil.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/util/WSSecurityUtil.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/KerberosTokenValidator.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/SamlAssertionValidator.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/TimestampValidator.java
webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/validate/UsernameTokenValidator.java
webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/common/CustomSamlAssertionValidator.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ConfigurationConverter.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/OutboundWSSec.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSConfigurationException.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSCrypto.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/ext/WSSUtils.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/InboundWSSecurityContextImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/BinarySecurityTokenInputHandler.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DecryptInputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/DerivedKeyTokenInputHandler.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/SAMLTokenInputHandler.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/TimestampInputHandler.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/input/WSSSignatureReferenceVerifyInputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/DerivedKeyTokenOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/EncryptedKeyOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SAMLTokenOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/SecurityHeaderReorderProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureEndingOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/processor/output/WSSSignatureOutputProcessor.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/EncryptedKeySha1SecurityTokenImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/ExternalSecurityTokenImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosClientSecurityToken.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/KerberosServiceSecurityTokenImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/SamlSecurityTokenImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509PKIPathv1SecurityTokenImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/impl/securityToken/X509V3SecurityTokenImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/BinarySecurityTokenValidatorImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SamlTokenValidatorImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/SecurityContextTokenValidatorImpl.java
webservices/wss4j/trunk/ws-security-stax/src/main/java/org/apache/wss4j/stax/validate/TimestampValidatorImpl.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/AbstractTestBase.java
webservices/wss4j/trunk/ws-security-stax/src/test/java/org/apache/wss4j/stax/test/UsernameTokenTest.java
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPEnforcer.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPEnforcer.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPEnforcer.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/bsp/BSPEnforcer.java Fri May 8 10:40:20 2015
@@ -54,7 +54,7 @@ public class BSPEnforcer {
if (!ignoredBSPRules.contains(bspRule)) {
throw new WSSecurityException(WSSecurityException.ErrorCode.INVALID_SECURITY, "empty",
- new Object[] {"BSP:" + bspRule.name() + ": " + bspRule.getMsg()}
+ "BSP:" + bspRule.name() + ": " + bspRule.getMsg()
);
} else {
LOG.debug("BSP:" + bspRule.name() + ": " + bspRule.getMsg());
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CertificateStore.java Fri May 8 10:40:20 2015
@@ -199,8 +199,7 @@ public class CertificateStore extends Cr
);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath",
- new Object[] {"No trusted certs found"}
+ WSSecurityException.ErrorCode.FAILURE, "certpath", "No trusted certs found"
);
}
@@ -253,8 +252,8 @@ public class CertificateStore extends Cr
| java.security.InvalidAlgorithmParameterException
| java.security.cert.CertPathValidatorException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "certpath",
- new Object[] {e.getMessage()}
+ WSSecurityException.ErrorCode.FAILURE, "certpath", e,
+ e.getMessage()
);
}
@@ -348,7 +347,7 @@ public class CertificateStore extends Cr
sha = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "decoding.general"
+ WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
);
}
for (X509Certificate trustedCert : trustedCerts) {
@@ -356,7 +355,7 @@ public class CertificateStore extends Cr
sha.update(trustedCert.getEncoded());
} catch (CertificateEncodingException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, ex, "encodeError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", ex
);
}
byte[] data = sha.digest();
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoBase.java Fri May 8 10:40:20 2015
@@ -142,6 +142,7 @@ public abstract class CryptoBase impleme
if (certificateFactory != null) {
return certificateFactory;
}
+
try {
String provider = getCryptoProvider();
if (provider == null || provider.length() == 0) {
@@ -151,11 +152,11 @@ public abstract class CryptoBase impleme
}
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "unsupportedCertType"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "unsupportedCertType", e
);
} catch (NoSuchProviderException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "noSecProvider"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "noSecProvider", e
);
}
@@ -175,7 +176,7 @@ public abstract class CryptoBase impleme
return (X509Certificate) certFactory.generateCertificate(in);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "parseError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "parseError", e
);
}
}
@@ -208,8 +209,8 @@ public abstract class CryptoBase impleme
return digest.digest(value);
} catch (Exception ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN, ex, "noSKIHandling",
- new Object[] {"No SKI certificate extension and no SHA1 message digest available"}
+ WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN, "noSKIHandling", ex,
+ "No SKI certificate extension and no SHA1 message digest available"
);
}
}
@@ -241,11 +242,11 @@ public abstract class CryptoBase impleme
return path.getEncoded();
} catch (CertificateEncodingException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "encodeError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", e
);
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "parseError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "parseError", e
);
}
}
@@ -265,7 +266,7 @@ public abstract class CryptoBase impleme
path = getCertificateFactory().generateCertPath(in);
} catch (CertificateException | IOException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "parseError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "parseError", e
);
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/CryptoFactory.java Fri May 8 10:40:20 2015
@@ -79,8 +79,7 @@ public abstract class CryptoFactory {
LOG.debug("Cannot load Crypto instance as properties object is null");
}
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty",
- new Object[] {"Cannot load Crypto instance as properties object is null"});
+ "empty", null, "Cannot load Crypto instance as properties object is null");
}
return getInstance(properties, Loader.getClassLoader(CryptoFactory.class), null);
}
@@ -112,8 +111,7 @@ public abstract class CryptoFactory {
LOG.debug("Cannot load Crypto instance as properties object is null");
}
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty",
- new Object[] {"Cannot load Crypto instance as properties object is null"});
+ "empty", null, "Cannot load Crypto instance as properties object is null");
}
String cryptoClassName = properties.getProperty("org.apache.wss4j.crypto.provider");
@@ -131,10 +129,9 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to instantiate Merlin", e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
- "empty",
- new Object[] {"Cannot create Crypto class "
- + cryptoClassName});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "empty", e, "Cannot create Crypto class "
+ + cryptoClassName);
}
} else {
try {
@@ -144,8 +141,8 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug(ex.getMessage(), ex);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
- "empty", new Object[] {cryptoClassName + " Not Found"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "empty", ex, cryptoClassName + " Not Found");
}
}
return loadClass(cryptoClass, properties, classLoader);
@@ -234,8 +231,8 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to instantiate: " + cryptoClass.getName(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
- "empty", new Object[] {cryptoClass + " cannot create instance"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "empty", e, cryptoClass + " cannot create instance");
}
}
@@ -270,8 +267,8 @@ public abstract class CryptoFactory {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to instantiate: " + cryptoClass.getName(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
- "empty", new Object[] {cryptoClass + " cannot create instance"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "empty", e, cryptoClass + " cannot create instance");
}
}
@@ -293,7 +290,7 @@ public abstract class CryptoFactory {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
"resourceNotFound",
- new Object[] {propFilename}
+ propFilename
);
}
properties.load(url.openStream());
@@ -302,8 +299,8 @@ public abstract class CryptoFactory {
LOG.debug("Cannot find resource: " + propFilename, e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e,
- "resourceNotFound", new Object[] {propFilename}
+ WSSecurityException.ErrorCode.FAILURE,
+ "resourceNotFound", e, propFilename
);
}
return properties;
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/DERDecoder.java Fri May 8 10:40:20 2015
@@ -60,7 +60,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Invalid DER string"}
+ "Invalid DER string"
);
}
arr = derEncoded;
@@ -86,7 +86,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Unsupported DER format"}
+ "Unsupported DER format"
);
}
pos += length;
@@ -118,7 +118,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Invalid DER format"}
+ "Invalid DER format"
);
}
pos++;
@@ -137,7 +137,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Invalid DER format"}
+ "Invalid DER format"
);
}
return arr[pos] == val;
@@ -165,7 +165,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Invalid DER format"}
+ "Invalid DER format"
);
}
int len;
@@ -180,7 +180,7 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Invalid DER format"}
+ "Invalid DER format"
);
}
byte[] lenBytes = new byte[nbytes];
@@ -206,13 +206,13 @@ public class DERDecoder {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Invalid DER format"}
+ "Invalid DER format"
);
} else if (length < 0) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Unsupported DER format"}
+ "Unsupported DER format"
);
}
byte[] value = new byte[length];
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/Merlin.java Fri May 8 10:40:20 2015
@@ -312,7 +312,7 @@ public class Merlin extends CryptoBase {
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "failedCredentialLoad");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "failedCredentialLoad", e);
}
}
}
@@ -341,8 +341,7 @@ public class Merlin extends CryptoBase {
LOG.debug(e.getMessage(), e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "proxyNotFound",
- new Object[] {location}
+ WSSecurityException.ErrorCode.FAILURE, "proxyNotFound", e, location
);
}
}
@@ -375,7 +374,7 @@ public class Merlin extends CryptoBase {
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "failedCredentialLoad");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "failedCredentialLoad", e);
}
return ks;
}
@@ -482,11 +481,11 @@ public class Merlin extends CryptoBase {
}
} catch (CertificateException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "unsupportedCertType"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "unsupportedCertType", e
);
} catch (NoSuchProviderException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "noSecProvider"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "noSecProvider", e
);
}
@@ -527,7 +526,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, ex, "keystore"
+ WSSecurityException.ErrorCode.FAILURE, "keystore", ex
);
}
}
@@ -616,12 +615,10 @@ public class Merlin extends CryptoBase {
CallbackHandler callbackHandler
) throws WSSecurityException {
if (keystore == null) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
- new Object[] {"The keystore is null"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "The keystore is null");
}
if (callbackHandler == null) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
- new Object[] {"The CallbackHandler is null"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "The CallbackHandler is null");
}
String identifier = getIdentifier(certificate, keystore);
@@ -630,8 +627,7 @@ 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",
- new Object[] {msg});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
}
String password = getPassword(identifier, callbackHandler);
if (password == null && privatePasswordSet) {
@@ -650,14 +646,12 @@ 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",
- new Object[] {msg});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
}
return (PrivateKey) keyTmp;
} catch (KeyStoreException | UnrecoverableKeyException | NoSuchAlgorithmException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
- new Object[] {ex.getMessage()}
+ WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
);
}
}
@@ -674,16 +668,14 @@ public class Merlin extends CryptoBase {
String password
) throws WSSecurityException {
if (keystore == null) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
- new Object[] {"The keystore is null"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "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",
- new Object[] {msg});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
}
if (password == null && privatePasswordSet) {
password = properties.getProperty(PREFIX + KEYSTORE_PRIVATE_PASSWORD);
@@ -700,14 +692,12 @@ 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",
- new Object[] {msg});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", msg);
}
return (PrivateKey) keyTmp;
} catch (KeyStoreException | UnrecoverableKeyException | NoSuchAlgorithmException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, ex, "noPrivateKey",
- new Object[] {ex.getMessage()}
+ WSSecurityException.ErrorCode.FAILURE, "noPrivateKey", ex, ex.getMessage()
);
}
}
@@ -746,7 +736,7 @@ public class Merlin extends CryptoBase {
certs[0].checkValidity();
} catch (CertificateExpiredException | CertificateNotYetValidException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILED_CHECK, e, "invalidCert"
+ WSSecurityException.ErrorCode.FAILED_CHECK, "invalidCert", e
);
}
if (LOG.isDebugEnabled()) {
@@ -780,8 +770,7 @@ public class Merlin extends CryptoBase {
);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "certpath",
- new Object[] {"No trusted certs found"}
+ WSSecurityException.ErrorCode.FAILURE, "certpath", "No trusted certs found"
);
}
@@ -859,7 +848,7 @@ public class Merlin extends CryptoBase {
| java.security.cert.CertPathValidatorException
| KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "certpath"
+ WSSecurityException.ErrorCode.FAILURE, "certpath", e
);
}
@@ -991,7 +980,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "keystore"
+ WSSecurityException.ErrorCode.FAILURE, "keystore", e
);
}
return new Certificate[]{};
@@ -1011,7 +1000,7 @@ public class Merlin extends CryptoBase {
sha = MessageDigest.getInstance("SHA1");
} catch (NoSuchAlgorithmException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "decoding.general"
+ WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
);
}
Certificate[] certs = null;
@@ -1065,8 +1054,8 @@ public class Merlin extends CryptoBase {
sha.update(x509cert.getEncoded());
} catch (CertificateEncodingException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, ex,
- "encodeError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError",
+ ex
);
}
byte[] data = sha.digest();
@@ -1078,7 +1067,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "keystore"
+ WSSecurityException.ErrorCode.FAILURE, "keystore", e
);
}
return new Certificate[]{};
@@ -1145,7 +1134,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "keystore"
+ WSSecurityException.ErrorCode.FAILURE, "keystore", e
);
}
return new Certificate[]{};
@@ -1233,7 +1222,7 @@ public class Merlin extends CryptoBase {
return null;
}
} catch (KeyStoreException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "keystore");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "keystore", e);
}
X509Certificate[] x509certs = new X509Certificate[certs.length];
@@ -1304,7 +1293,7 @@ public class Merlin extends CryptoBase {
}
} catch (KeyStoreException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "keystore"
+ WSSecurityException.ErrorCode.FAILURE, "keystore", e
);
}
return new Certificate[]{};
@@ -1355,7 +1344,7 @@ public class Merlin extends CryptoBase {
}
}
} catch (KeyStoreException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "keystore");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "keystore", e);
}
return null;
}
@@ -1378,13 +1367,13 @@ public class Merlin extends CryptoBase {
cb.handle(callbacks);
} catch (IOException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e,
- "noPassword", new Object[] {identifier}
+ WSSecurityException.ErrorCode.FAILURE,
+ "noPassword", e, identifier
);
} catch (UnsupportedCallbackException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e,
- "noPassword", new Object[] {identifier}
+ WSSecurityException.ErrorCode.FAILURE,
+ "noPassword", e, identifier
);
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/MerlinDevice.java Fri May 8 10:40:20 2015
@@ -206,7 +206,7 @@ public class MerlinDevice extends Merlin
if (DO_DEBUG) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "failedCredentialLoad");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "failedCredentialLoad", e);
}
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/crypto/X509SubjectPublicKeyInfo.java Fri May 8 10:40:20 2015
@@ -52,7 +52,7 @@ public class X509SubjectPublicKeyInfo ex
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
"noSKIHandling",
- new Object[] {"Support for X.509-encoded public keys only"}
+ "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",
- new Object[] {"Unsupported X.509 public key format"}
+ "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",
- new Object[] {"Invalid X.509 public key format"}
+ "Invalid X.509 public key format"
);
}
skip(1); // number unused bits
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/AlgoFactory.java Fri May 8 10:40:20 2015
@@ -41,7 +41,7 @@ public final class AlgoFactory {
return new P_SHA1();
} else {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "unknownAlgorithm", new Object[] {algorithm});
+ "unknownAlgorithm", algorithm);
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/P_SHA1.java Fri May 8 10:40:20 2015
@@ -64,7 +64,7 @@ public class P_SHA1 implements Derivatio
return key;
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "errorInKeyDerivation");
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "errorInKeyDerivation", e);
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/ext/WSSecurityException.java Fri May 8 10:40:20 2015
@@ -127,36 +127,63 @@ public class WSSecurityException extends
}
private ErrorCode errorCode;
-
- public WSSecurityException(ErrorCode errorCode) {
- this(errorCode, errorCode.name());
- }
-
- public WSSecurityException(ErrorCode errorCode, String msgId) {
- super(msgId, new Object[]{});
- this.errorCode = errorCode;
- }
-
- public WSSecurityException(ErrorCode errorCode, Exception exception) {
- super(exception);
+
+ /**
+ * 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, Exception exception, String msgId) {
+
+ /**
+ * Constructor.
+ * <p/>
+ *
+ * @param errorCode
+ * @param msgId
+ * @param exception
+ */
+ public WSSecurityException(ErrorCode errorCode, String msgId, Exception exception) {
super(msgId, exception);
this.errorCode = errorCode;
}
- public WSSecurityException(ErrorCode errorCode, Exception exception, String msgId, Object[] arguments) {
- super(msgId, arguments, exception);
+ public WSSecurityException(ErrorCode errorCode, Exception exception) {
+ super(exception);
this.errorCode = errorCode;
}
- public WSSecurityException(ErrorCode errorCode, String msgId, Object[] arguments) {
+ /**
+ * Constructor.
+ * <p/>
+ *
+ * @param errorCode
+ * @param msgId
+ * @param arguments
+ */
+ public WSSecurityException(ErrorCode errorCode, String msgId, Object... arguments) {
super(msgId, arguments);
this.errorCode = errorCode;
}
+
+ /**
+ * Constructor.
+ * <p/>
+ *
+ * @param errorCode
+ */
+ public WSSecurityException(ErrorCode errorCode) {
+ this(errorCode, errorCode.name());
+ }
+
/**
* Get the error code.
* <p/>
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosClientExceptionAction.java Fri May 8 10:40:20 2015
@@ -132,9 +132,14 @@ public class KerberosClientExceptionActi
krbCtx.setSecretKey(key);
}
- catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, e, "kerberosServiceTicketError"
+ ErrorCode.FAILURE, "kerberosServiceTicketError", e
+ );
+ }
+ catch (InvocationTargetException e) {
+ throw new WSSecurityException(
+ ErrorCode.FAILURE, "kerberosServiceTicketError", e.getCause()
);
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/kerberos/KerberosServiceExceptionAction.java Fri May 8 10:40:20 2015
@@ -124,9 +124,14 @@ public class KerberosServiceExceptionAct
krbServiceCtx.setSessionKey(key);
}
- catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
+ catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException e) {
throw new WSSecurityException(
- ErrorCode.FAILURE, e, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID
+ ErrorCode.FAILURE, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID, e
+ );
+ }
+ catch (InvocationTargetException e) {
+ throw new WSSecurityException(
+ ErrorCode.FAILURE, KERBEROS_TICKET_VALIDATION_ERROR_MSG_ID, e.getCause()
);
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/OpenSAMLUtil.java Fri May 8 10:40:20 2015
@@ -108,20 +108,17 @@ 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",
- new Object[] {"Error unmarshalling a SAML assertion"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "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",
- new Object[] {"Error unmarshalling a SAML assertion"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", "Error unmarshalling a SAML assertion");
}
try {
return unmarshaller.unmarshall(root);
} catch (UnmarshallingException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
- new Object[] {"Error unmarshalling a SAML assertion"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex, "Error unmarshalling a SAML assertion");
}
}
@@ -170,8 +167,7 @@ public final class OpenSAMLUtil {
element = marshaller.marshall(xmlObject, doc);
}
} catch (MarshallingException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
- new Object[] {"Error marshalling a SAML assertion"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex, "Error marshalling a SAML assertion");
}
if (signObject) {
@@ -242,8 +238,7 @@ public final class OpenSAMLUtil {
try {
Signer.signObject(signature);
} catch (SignatureException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
- new Object[] {"Error signing a SAML assertion"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex, "Error signing a SAML assertion");
}
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SAMLUtil.java Fri May 8 10:40:20 2015
@@ -274,7 +274,7 @@ public final class SAMLUtil {
if (certs == null || certs.length < 1) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- new Object[] {"cannot get certificate or key"}
+ "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, ex, "invalidSAMLsecurity",
- new Object[] {"cannot get certificate or key"}
+ WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", ex,
+ "cannot get certificate or key"
);
}
return null;
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/saml/SamlAssertionWrapper.java Fri May 8 10:40:20 2015
@@ -527,10 +527,8 @@ 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;
@@ -553,7 +551,7 @@ public class SamlAssertionWrapper {
}
if (privateKey == null) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty",
- new Object[] {"No private key was found using issuer name: " + issuerKeyName});
+ "No private key was found using issuer name: " + issuerKeyName);
}
signature.setSignatureAlgorithm(sigAlgo);
@@ -574,8 +572,8 @@ public class SamlAssertionWrapper {
signingCredential);
signature.setKeyInfo(keyInfo);
} catch (org.opensaml.security.SecurityException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
- new Object[] {"Error generating KeyInfo from signing credential"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
+ "Error generating KeyInfo from signing credential");
}
// add the signature to the assertion
@@ -596,7 +594,7 @@ public class SamlAssertionWrapper {
if (keyInfo == null) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- new Object[] {"cannot get certificate or key"}
+ "cannot get certificate or key"
);
}
SAMLKeyInfo samlKeyInfo =
@@ -619,7 +617,7 @@ public class SamlAssertionWrapper {
if (samlKeyInfo == null) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- new Object[] {"cannot get certificate or key"}
+ "cannot get certificate or key"
);
}
@@ -631,14 +629,14 @@ public class SamlAssertionWrapper {
} else {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity",
- new Object[] {"cannot get certificate or key"}
+ "cannot get certificate or key"
);
}
try {
SignatureValidator.validate(sig, credential);
} catch (SignatureException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- ex, "empty", new Object[] {"SAML signature validation failed"});
+ "empty", ex, "SAML signature validation failed");
}
signatureKeyInfo = samlKeyInfo;
} else {
@@ -659,7 +657,7 @@ public class SamlAssertionWrapper {
validator.validate(sig);
} catch (SignatureException ex) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- ex, "empty", new Object[] {"SAML signature validation failed"});
+ "empty", ex, "SAML signature validation failed");
}
}
}
@@ -771,7 +769,7 @@ public class SamlAssertionWrapper {
return Base64.decode(signatureValueElement);
} catch (Base64DecodingException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, ex, "invalidSAMLsecurity"
+ WSSecurityException.ErrorCode.FAILURE, "invalidSAMLsecurity", ex
);
}
}
@@ -1061,8 +1059,8 @@ public class SamlAssertionWrapper {
saml1.setAdvice(advice);
}
} catch (org.opensaml.security.SecurityException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
- new Object[] {"Error generating KeyInfo from signing credential"}
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
+ "Error generating KeyInfo from signing credential"
);
}
@@ -1103,8 +1101,8 @@ public class SamlAssertionWrapper {
SAML2ComponentBuilder.createSaml2Subject(samlCallback.getSubject());
saml2.setSubject(subject);
} catch (org.opensaml.security.SecurityException ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex, "empty",
- new Object[] {"Error generating KeyInfo from signing credential"}
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", ex,
+ "Error generating KeyInfo from signing credential"
);
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/spnego/SpnegoTokenContext.java Fri May 8 10:40:20 2015
@@ -125,9 +125,10 @@ public class SpnegoTokenContext {
LOG.debug(ex.getMessage(), ex);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, ex,
+ WSSecurityException.ErrorCode.FAILURE,
"kerberosLoginError",
- new Object[] {ex.getMessage()});
+ ex,
+ ex.getMessage());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Successfully authenticated to the TGT");
@@ -139,7 +140,7 @@ public class SpnegoTokenContext {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
"kerberosLoginError",
- new Object[] {"No Client principals found after login"});
+ "No Client principals found after login");
}
// Get the service ticket
@@ -181,7 +182,7 @@ public class SpnegoTokenContext {
throw (WSSecurityException) cause;
} else {
throw new WSSecurityException(
- ErrorCode.FAILURE, new Exception(cause), "kerberosServiceTicketError"
+ ErrorCode.FAILURE, "kerberosServiceTicketError", cause
);
}
}
@@ -238,9 +239,10 @@ public class SpnegoTokenContext {
LOG.debug(ex.getMessage(), ex);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, ex,
+ WSSecurityException.ErrorCode.FAILURE,
"kerberosLoginError",
- new Object[] {ex.getMessage()});
+ ex,
+ ex.getMessage());
}
if (LOG.isDebugEnabled()) {
LOG.debug("Successfully authenticated to the TGT");
@@ -255,7 +257,7 @@ public class SpnegoTokenContext {
throw new WSSecurityException(
WSSecurityException.ErrorCode.FAILURE,
"kerberosLoginError",
- new Object[] {"No Client principals found after login"});
+ "No Client principals found after login");
}
service = principals.iterator().next().getName();
}
@@ -291,7 +293,7 @@ public class SpnegoTokenContext {
throw (WSSecurityException) cause;
} else {
throw new WSSecurityException(
- ErrorCode.FAILURE, new Exception(cause), "kerberosServiceTicketError"
+ ErrorCode.FAILURE, "kerberosServiceTicketError", cause
);
}
}
@@ -338,7 +340,7 @@ public class SpnegoTokenContext {
LOG.debug("Error in cleaning up a GSS context", e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "spnegoKeyError"
+ WSSecurityException.ErrorCode.FAILURE, "spnegoKeyError", e
);
}
}
@@ -355,7 +357,7 @@ public class SpnegoTokenContext {
LOG.debug("Error in cleaning up a GSS context", e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "spnegoKeyError"
+ WSSecurityException.ErrorCode.FAILURE, "spnegoKeyError", e
);
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/BinarySecurity.java Fri May 8 10:40:20 2015
@@ -61,7 +61,7 @@ public class BinarySecurity {
if (!(el.equals(TOKEN_BST) || el.equals(TOKEN_KI))) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.INVALID_SECURITY_TOKEN,
- "unhandledToken", new Object[] {el});
+ "unhandledToken", el);
}
String encoding = getEncodingType();
if (encoding == null || "".equals(encoding)) {
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/Reference.java Fri May 8 10:40:20 2015
@@ -49,7 +49,7 @@ public class Reference {
QName el = new QName(element.getNamespaceURI(), element.getLocalName());
if (!el.equals(TOKEN)) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "badElement", new Object[] {TOKEN, el}
+ WSSecurityException.ErrorCode.FAILURE, "badElement", TOKEN, el
);
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/SecurityTokenReference.java Fri May 8 10:40:20 2015
@@ -26,6 +26,11 @@ import java.util.Arrays;
import javax.xml.namespace.QName;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
import org.apache.wss4j.common.WSS4JConstants;
import org.apache.wss4j.common.bsp.BSPEnforcer;
import org.apache.wss4j.common.bsp.BSPRule;
@@ -38,10 +43,6 @@ import org.apache.wss4j.common.util.KeyU
import org.apache.wss4j.common.util.XMLUtils;
import org.apache.xml.security.exceptions.Base64DecodingException;
import org.apache.xml.security.utils.Base64;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
/**
* Security Token Reference.
@@ -77,8 +78,7 @@ public class SecurityTokenReference {
element = elem;
QName el = new QName(element.getNamespaceURI(), element.getLocalName());
if (!STR_QNAME.equals(el)) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "badElement",
- new Object[] {STR_QNAME, el});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "badElement", STR_QNAME, el);
}
checkBSPCompliance(bspEnforcer);
@@ -189,7 +189,7 @@ public class SecurityTokenReference {
data = cert.getEncoded();
} catch (CertificateEncodingException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "encodeError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", e
);
}
Text text = doc.createTextNode(Base64.encode(data));
@@ -214,7 +214,7 @@ public class SecurityTokenReference {
if (cert.getVersion() != 3) {
throw new WSSecurityException(
WSSecurityException.ErrorCode.UNSUPPORTED_SECURITY_TOKEN,
- "invalidCertForSKI", new Object[] {cert.getVersion()});
+ "invalidCertForSKI", cert.getVersion());
}
Document doc = element.getOwnerDocument();
@@ -246,7 +246,7 @@ public class SecurityTokenReference {
encodedCert = cert.getEncoded();
} catch (CertificateEncodingException e1) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e1, "encodeError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", e1
);
}
try {
@@ -255,7 +255,7 @@ public class SecurityTokenReference {
createKeyIdentifier(doc, THUMB_URI, text, true);
} catch (WSSecurityException e1) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e1, "decoding.general"
+ WSSecurityException.ErrorCode.FAILURE, "decoding.general", e1
);
}
}
@@ -340,7 +340,7 @@ public class SecurityTokenReference {
thumb = Base64.decode(text);
} catch (Base64DecodingException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "decoding.general"
+ WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
);
}
CryptoType cryptoType = new CryptoType(CryptoType.TYPE.THUMBPRINT_SHA1);
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/X509Security.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/X509Security.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/X509Security.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/token/X509Security.java Fri May 8 10:40:20 2015
@@ -90,14 +90,14 @@ public class X509Security extends Binary
byte[] data = getToken();
if (data == null) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "invalidCertData", new Object[] {"0"});
+ WSSecurityException.ErrorCode.FAILURE, "invalidCertData", 0);
}
try (InputStream in = new ByteArrayInputStream(data)) {
cachedCert = certCrypto.loadCertificate(in);
return cachedCert;
} catch (IOException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "parseError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "parseError", e
);
}
@@ -121,7 +121,7 @@ public class X509Security extends Binary
setToken(cert.getEncoded());
} catch (CertificateEncodingException e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, e, "encodeError"
+ WSSecurityException.ErrorCode.SECURITY_TOKEN_UNAVAILABLE, "encodeError", e
);
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/KeyUtils.java Fri May 8 10:40:20 2015
@@ -135,8 +135,8 @@ public final class KeyUtils {
return Cipher.getInstance(keyAlgorithm, provider);
} catch (NoSuchPaddingException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex, "unsupportedKeyTransp",
- new Object[] {"No such padding: " + cipherAlgo});
+ WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
+ ex, "No such padding: " + cipherAlgo);
} catch (NoSuchAlgorithmException ex) {
// Check to see if an RSA OAEP MGF-1 with SHA-1 algorithm was requested
// Some JDKs don't support RSA/ECB/OAEPPadding
@@ -145,18 +145,18 @@ public final class KeyUtils {
return Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
} catch (Exception e) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, e, "unsupportedKeyTransp",
- new Object[] {"No such algorithm: " + cipherAlgo});
+ WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
+ e, "No such algorithm: " + cipherAlgo);
}
} else {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex, "unsupportedKeyTransp",
- new Object[] {"No such algorithm: " + cipherAlgo});
+ WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
+ ex, "No such algorithm: " + cipherAlgo);
}
} catch (NoSuchProviderException ex) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex, "unsupportedKeyTransp",
- new Object[] {"No such provider " + JCEMapper.getProviderId() + " for: " + cipherAlgo});
+ WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, "unsupportedKeyTransp",
+ ex, "No such provider " + JCEMapper.getProviderId() + " for: " + cipherAlgo);
}
}
@@ -174,8 +174,8 @@ public final class KeyUtils {
}
return digest.digest(inputBytes);
} catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "empty",
- new Object[] {"Error in generating digest"}
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", e,
+ "Error in generating digest"
);
}
}
Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java (original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/util/UsernameTokenUtil.java Fri May 8 10:40:20 2015
@@ -67,7 +67,7 @@ public final class UsernameTokenUtil {
LOG.debug(e.getMessage(), e);
}
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, e, "decoding.general"
+ WSSecurityException.ErrorCode.FAILURE, "decoding.general", e
);
}
//
@@ -105,8 +105,8 @@ public final class UsernameTokenUtil {
if (LOG.isDebugEnabled()) {
LOG.debug(e.getMessage(), e);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
- "empty", new Object[] {"Unable to convert password to UTF-8"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "empty", e, "Unable to convert password to UTF-8");
}
}
@@ -144,8 +144,9 @@ public final class UsernameTokenUtil {
try {
return XMLSecurityConstants.generateBytes(length);
} catch (Exception ex) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
- "empty", new Object[] {"Error in generating nonce of length " + length}
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "empty", ex,
+ "Error in generating nonce of length " + length
);
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/WSSConfig.java Fri May 8 10:40:20 2015
@@ -414,12 +414,12 @@ public class WSSConfig {
if (actionObject instanceof Class<?>) {
try {
return (Action)((Class<?>)actionObject).newInstance();
- } catch (Exception ex) {
+ } catch (Throwable t) {
if (LOG.isDebugEnabled()) {
- LOG.debug(ex.getMessage(), ex);
+ LOG.debug(t.getMessage(), t);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
- "unableToLoadClass", new Object[] {((Class<?>)actionObject).getName()});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "unableToLoadClass", t, ((Class<?>)actionObject).getName());
}
} else if (actionObject instanceof Action) {
return (Action)actionObject;
@@ -506,12 +506,12 @@ public class WSSConfig {
if (validatorObject instanceof Class<?>) {
try {
return (Validator)((Class<?>)validatorObject).newInstance();
- } catch (Exception ex) {
+ } catch (Throwable t) {
if (LOG.isDebugEnabled()) {
- LOG.debug(ex.getMessage(), ex);
+ LOG.debug(t.getMessage(), t);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
- "unableToLoadClass", new Object[] {((Class<?>)validatorObject).getName()});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "unableToLoadClass", t, ((Class<?>)validatorObject).getName());
}
} else if (validatorObject instanceof Validator) {
return (Validator)validatorObject;
@@ -532,12 +532,12 @@ public class WSSConfig {
if (processorObject instanceof Class<?>) {
try {
return (Processor)((Class<?>)processorObject).newInstance();
- } catch (Exception ex) {
+ } catch (Throwable t) {
if (LOG.isDebugEnabled()) {
- LOG.debug(ex.getMessage(), ex);
+ LOG.debug(t.getMessage(), t);
}
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, ex,
- "unableToLoadClass", new Object[] {((Class<?>)processorObject).getName()});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "unableToLoadClass", t, ((Class<?>)processorObject).getName());
}
} else if (processorObject instanceof Processor) {
return (Processor)processorObject;
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/CustomTokenAction.java Fri May 8 10:40:20 2015
@@ -53,14 +53,14 @@ public class CustomTokenAction implement
try {
callbackHandler.handle(new Callback[]{wsPasswordCallback});
} catch (Exception e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
- "empty", new Object[] {"WSHandler: password callback failed"});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
+ "empty", e, "WSHandler: password callback failed");
}
Element customToken = wsPasswordCallback.getCustomToken();
if (customToken == null) {
throw new WSSecurityException(
- WSSecurityException.ErrorCode.FAILURE, "resourceNotFound", new Object[] {"CustomToken"}
+ WSSecurityException.ErrorCode.FAILURE, "resourceNotFound", "CustomToken"
);
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionAction.java Fri May 8 10:40:20 2015
@@ -110,8 +110,7 @@ public class EncryptionAction implements
try {
wsEncrypt.build(doc, encryptionToken.getCrypto(), reqData.getSecHeader());
} catch (WSSecurityException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e,
- "empty", new Object[] {"Error during encryption: "});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", e, "Error during encryption: ");
}
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/EncryptionDerivedAction.java Fri May 8 10:40:20 2015
@@ -121,7 +121,7 @@ public class EncryptionDerivedAction ext
} catch (WSSecurityException e) {
throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE,
- "empty", new Object[] {"Error during Encryption: "});
+ "empty", e, "Error during Encryption: ");
}
}
Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java?rev=1678324&r1=1678323&r2=1678324&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java (original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/action/SAMLTokenSignedAction.java Fri May 8 10:40:20 2015
@@ -130,8 +130,8 @@ public class SAMLTokenSignedAction imple
reqData.getSecHeader());
reqData.getSignatureValues().add(wsSign.getSignatureValue());
} catch (WSSecurityException e) {
- throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, e, "empty",
- new Object[] {"Error when signing the SAML token: "});
+ throw new WSSecurityException(WSSecurityException.ErrorCode.FAILURE, "empty", e,
+ "Error when signing the SAML token: ");
}
}