ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1732860 - in /webservices/wss4j/trunk: ws-security-common/src/main/java/org/apache/wss4j/common/crypto/ ws-security-common/src/main/java/org/apache/wss4j/common/util/ ws-security-common/src/main/resources/messages/ ws-security-dom/src/test...
Date Mon, 29 Feb 2016 11:26:03 GMT
Author: coheigea
Date: Mon Feb 29 11:26:03 2016
New Revision: 1732860

URL: http://svn.apache.org/viewvc?rev=1732860&view=rev
Log:
Improves the error message

This adds some quotes around some data which would make it easy to spot
whitespace errors. Also, the error message that the given JCE provider
does not handle X.509 is now more vocal and tells the developer that
the following exception is not the end of the world and he did nothing
wrong at that point.

Modified:
    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/util/KeyUtils.java
    webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java

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=1732860&r1=1732859&r2=1732860&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
Mon Feb 29 11:26:03 2016
@@ -317,7 +317,6 @@ public class Merlin extends CryptoBase {
         }
     }
 
-
     /**
      * Load a KeyStore object as an InputStream, using the ClassLoader and location arguments
      */
@@ -468,7 +467,8 @@ public class Merlin extends CryptoBase {
                                 "X.509", mapKeystoreProviderToCertProvider(keyStoreProvider)
                             );
                     } catch (Exception ex) {
-                        LOG.debug(ex.getMessage(), ex);
+                        LOG.debug("The keystore provider '" + keyStoreProvider + "' does
not support X.509 because \""
+                                + ex.getMessage() + "\". As next your JVM's default provider
is tried out!", ex);
                         //Ignore, we'll just use the default since they didn't specify one.
                         //Hopefully that will work for them.
                     }

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=1732860&r1=1732859&r2=1732860&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
Mon Feb 29 11:26:03 2016
@@ -136,7 +136,7 @@ public final class KeyUtils {
         } catch (NoSuchPaddingException ex) {
             throw new WSSecurityException(
                 WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex, "unsupportedKeyTransp",
-                new Object[] {"No such padding: " + cipherAlgo});
+                new Object[] {"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
@@ -146,17 +146,17 @@ public final class KeyUtils {
                 } catch (Exception e) {
                     throw new WSSecurityException(
                         WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, e, "unsupportedKeyTransp",
-                        new Object[] {"No such algorithm: " + cipherAlgo});
+                        new Object[] {"No such algorithm: \"" + cipherAlgo + "\""});
                 }
             } else {
                 throw new WSSecurityException(
                     WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM, ex, "unsupportedKeyTransp",
-                    new Object[] {"No such algorithm: " + cipherAlgo});
+                    new Object[] {"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});
+                new Object[] {"No such provider " + JCEMapper.getProviderId() + " for: \""
+ cipherAlgo + "\""});
         }
     }
 

Modified: webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties?rev=1732860&r1=1732859&r2=1732860&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
(original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/resources/messages/wss4j_errors.properties
Mon Feb 29 11:26:03 2016
@@ -74,26 +74,26 @@ notASOAPMessage = Request is not a valid
 noToken = Referenced Token \"{0}\" not found
 noTokenUser = Token user is not set
 noUser = User is not set
-noUserCertsFound = No certificates for user {0} were found for {1}
+noUserCertsFound = No certificates for user \"{0}\" were found for {1}
 noXMLSig = Cannot setup signature data structure
 parseError = Cannot parse/decode the certificate data
 proxyNotFound = Proxy file ({0}) not found.
-resourceNotFound = Cannot load the resource {0}
+resourceNotFound = Cannot load the resource \"{0}\"
 signatureCryptoFailure = SignatureCrypto instantiation failed
 signatureKeyStoreNotSet = Signature KeyStore is not set
 signatureVerificationCryptoFailure = SignatureVerificationCrypto instantiation failed
 signatureVerificationKeyStoreNotSet = Signature verification KeyStore is not set
 spnegoKeyError = An error occurred in trying to unwrap a SPNEGO key
-unknownAlgorithm = An unknown algorithm was specified: {0}
+unknownAlgorithm = An unknown algorithm was specified: \"{0}\"
 unableToLoadClass = Unable to load class {0}
 unhandledToken = Security token supported but currently not handled \"{0}\"
 unknownSignatureAlgorithm = An unknown signature algorithm was specified: {0}
 unsupportedBinaryTokenType = Token type \\"{0}\\"
 unsupportedCertType = Certificate type not supported by security provider
-unsupportedKeyId = Unsupported key identification: {0}
+unsupportedKeyId = Unsupported key identification: \"{0}\"
 unsupportedKeyInfo = Unsupported KeyInfo type
 unsupportedKeyTransp = unsupported key transport encryption algorithm: {0}
-unsupportedSecurityToken = Unsupported SecurityToken {0}
+unsupportedSecurityToken = Unsupported SecurityToken \"{0}\"
 secureProcessing.AllowRSA15KeyTransportAlgorithm = The use of RSAv1.5 key transport algorithm
is discouraged. Nonetheless can it be enabled via the \"AllowRSA15KeyTransportAlgorithm\"
property in the configuration.
 invalidSTRParserParameter = A required parameter was not supplied to an STRParser implementation
 

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java?rev=1732860&r1=1732859&r2=1732860&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/CertErrorTest.java
Mon Feb 29 11:26:03 2016
@@ -57,7 +57,7 @@ public class CertErrorTest extends org.j
             builder.build(doc, CryptoFactory.getInstance(), secHeader);
             fail("Expected failure on a bad username");
         } catch (WSSecurityException ex) {
-            String expectedError = "No certificates for user bob were found for signature";
+            String expectedError = "No certificates for user \"bob\" were found for signature";
             assertTrue(ex.getMessage().contains(expectedError));
         }
     }
@@ -76,7 +76,7 @@ public class CertErrorTest extends org.j
             builder.build(doc, CryptoFactory.getInstance(), secHeader);
             fail("Expected failure on a bad username");
         } catch (WSSecurityException ex) {
-            String expectedError = "No certificates for user alice were found for encryption";
+            String expectedError = "No certificates for user \"alice\" were found for encryption";
             assertTrue(ex.getMessage().contains(expectedError));
         }
     }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java?rev=1732860&r1=1732859&r2=1732860&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/misc/FaultCodeTest.java
Mon Feb 29 11:26:03 2016
@@ -101,7 +101,7 @@ public class FaultCodeTest extends org.j
             fail("Failure expected on an unsupported algorithm");
         } catch (WSSecurityException ex) {
             assertTrue(ex.getErrorCode() == WSSecurityException.ErrorCode.UNSUPPORTED_ALGORITHM);
-            assertEquals("unsupported key transport encryption algorithm: No such algorithm:
Bad Algorithm", ex.getMessage());
+            assertEquals("unsupported key transport encryption algorithm: No such algorithm:
\"Bad Algorithm\"", ex.getMessage());
             QName faultCode = new QName(WSConstants.WSSE_NS, "UnsupportedAlgorithm");
             assertTrue(ex.getFaultCode().equals(faultCode));
         }



Mime
View raw message