You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/03/10 16:30:35 UTC
[camel] 02/14: CAMEL-17763: cleaned up unused exceptions in camel-xmlsecurity
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 83adf8f41904fb1e9b5202d695a9df5332487369
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Mar 10 15:29:12 2022 +0100
CAMEL-17763: cleaned up unused exceptions in camel-xmlsecurity
---
.../component/xmlsecurity/ECDSASignatureTest.java | 21 ++++----
.../xmlsecurity/SignatureAlgorithmTest.java | 42 ++++++++--------
.../xmlsecurity/SignatureDigestMethodTest.java | 30 +++++------
.../xmlsecurity/SpringXmlSignatureTest.java | 4 +-
.../xmlsecurity/XAdESSignaturePropertiesTest.java | 52 +++++++++----------
.../component/xmlsecurity/XmlSignatureTest.java | 58 +++++++++++-----------
...idationFailedHandlerIgnoreManifestFailures.java | 4 +-
...ature2Message2MessageWithTimestampProperty.java | 2 +-
.../camel/dataformat/xmlsecurity/TestHelper.java | 6 +--
.../xmlsecurity/XMLSecurityConcurrencyTest.java | 2 +-
10 files changed, 110 insertions(+), 111 deletions(-)
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java
index c332e94..981f955 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/ECDSASignatureTest.java
@@ -67,7 +67,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
+ "<root xmlns=\"http://test/test\"><test>Test Message</test></root>";
}
- public ECDSASignatureTest() throws Exception {
+ public ECDSASignatureTest() {
try {
// BouncyCastle is required for some algorithms
if (Security.getProvider("BC") == null) {
@@ -105,13 +105,13 @@ public class ECDSASignatureTest extends CamelTestSupport {
}
@Override
- protected RouteBuilder[] createRouteBuilders() throws Exception {
+ protected RouteBuilder[] createRouteBuilders() {
if (!canTest) {
return new RouteBuilder[] {};
}
return new RouteBuilder[] { new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: ecdsa signature algorithm
from("direct:ecdsa_sha1")
.to("xmlsecurity-sign:ecdsa_sha1?keyAccessor=#accessor"
@@ -122,7 +122,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
// END SNIPPET: ecdsa signature algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: ecdsa signature algorithm
from("direct:ecdsa_sha224")
.to("xmlsecurity-sign:ecdsa_sha224?keyAccessor=#accessor"
@@ -132,7 +132,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
// END SNIPPET: ecdsa signature algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: ecdsa signature algorithm
from("direct:ecdsa_sha256")
.to("xmlsecurity-sign:ecdsa_sha256?keyAccessor=#accessor"
@@ -142,7 +142,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
// END SNIPPET: ecdsa signature algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: ecdsa signature algorithm
from("direct:ecdsa_sha384")
.to("xmlsecurity-sign:ecdsa_sha384?keyAccessor=#accessor"
@@ -152,7 +152,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
// END SNIPPET: ecdsa signature algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: ecdsa signature algorithm
from("direct:ecdsa_sha512")
.to("xmlsecurity-sign:ecdsa_sha512?keyAccessor=#accessor"
@@ -162,7 +162,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
// END SNIPPET: ecdsa signature algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: ecdsa signature algorithm
from("direct:ecdsa_ripemd160")
.to("xmlsecurity-sign:ecdsa_ripemd160?keyAccessor=#accessor"
@@ -256,7 +256,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
@Override
@BeforeEach
- public void setUp() throws Exception {
+ public void setUp() {
disableJMX();
try {
super.setUp();
@@ -293,8 +293,7 @@ public class ECDSASignatureTest extends CamelTestSupport {
@Override
public KeyInfo getKeyInfo(
Message mess, Node messageBody,
- KeyInfoFactory keyInfoFactory)
- throws Exception {
+ KeyInfoFactory keyInfoFactory) {
return null;
}
};
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java
index 56c5bf5f..b179186 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureAlgorithmTest.java
@@ -143,9 +143,9 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
}
@Override
- protected RouteBuilder[] createRouteBuilders() throws Exception {
+ protected RouteBuilder[] createRouteBuilders() {
return new RouteBuilder[] { new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:hmacsha1")
.to("xmlsecurity-sign:hmacsha1?keyAccessor=#secretKeyAccessor"
@@ -155,7 +155,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:hmacsha224")
.to("xmlsecurity-sign:hmacsha224?keyAccessor=#secretKeyAccessor"
@@ -164,7 +164,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:hmacsha256")
.to("xmlsecurity-sign:hmacsha256?keyAccessor=#secretKeyAccessor"
@@ -173,7 +173,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:hmacsha384")
.to("xmlsecurity-sign:hmacsha384?keyAccessor=#secretKeyAccessor"
@@ -182,7 +182,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:hmacsha512")
.to("xmlsecurity-sign:hmacsha512?keyAccessor=#secretKeyAccessor"
@@ -191,7 +191,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:hmacripemd160")
.to("xmlsecurity-sign:hmacripemd160?keyAccessor=#secretKeyAccessor"
@@ -200,7 +200,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha1")
.to("xmlsecurity-sign:rsasha1?keyAccessor=#accessor"
@@ -209,7 +209,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha224")
.to("xmlsecurity-sign:rsasha224?keyAccessor=#accessor"
@@ -218,7 +218,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha256")
.to("xmlsecurity-sign:rsasha256?keyAccessor=#accessor"
@@ -227,7 +227,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha384")
.to("xmlsecurity-sign:rsasha384?keyAccessor=#accessor"
@@ -236,7 +236,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha512")
.to("xmlsecurity-sign:rsasha512?keyAccessor=#accessor"
@@ -245,7 +245,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsaripemd160")
.to("xmlsecurity-sign:rsaripemd160?keyAccessor=#accessor"
@@ -254,7 +254,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha1_mgf1")
.to("xmlsecurity-sign:rsasha1_mgf1?keyAccessor=#accessor"
@@ -263,7 +263,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha224_mgf1")
.to("xmlsecurity-sign:rsasha224_mgf1?keyAccessor=#accessor"
@@ -272,7 +272,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha256_mgf1")
.to("xmlsecurity-sign:rsasha256_mgf1?keyAccessor=#accessor"
@@ -281,7 +281,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha384_mgf1")
.to("xmlsecurity-sign:rsasha384_mgf1?keyAccessor=#accessor"
@@ -290,7 +290,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:rsasha512_mgf1")
.to("xmlsecurity-sign:rsasha512_mgf1?keyAccessor=#accessor"
@@ -478,7 +478,7 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
super.setUp();
}
- public void setUpKeys(String algorithm, int keylength) throws Exception {
+ public void setUpKeys(String algorithm, int keylength) {
keyPair = getKeyPair(algorithm, keylength);
}
@@ -519,12 +519,12 @@ public class SignatureAlgorithmTest extends CamelTestSupport {
KeyAccessor accessor = new KeyAccessor() {
@Override
- public KeySelector getKeySelector(Message message) throws Exception {
+ public KeySelector getKeySelector(Message message) {
return KeySelector.singletonKeySelector(key);
}
@Override
- public KeyInfo getKeyInfo(Message mess, Node messageBody, KeyInfoFactory keyInfoFactory) throws Exception {
+ public KeyInfo getKeyInfo(Message mess, Node messageBody, KeyInfoFactory keyInfoFactory) {
return null;
}
};
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java
index ea5c509..8f07dba 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SignatureDigestMethodTest.java
@@ -138,9 +138,9 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
}
@Override
- protected RouteBuilder[] createRouteBuilders() throws Exception {
+ protected RouteBuilder[] createRouteBuilders() {
return new RouteBuilder[] { new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha1")
.to("xmlsecurity-sign:sha1?keyAccessor=#accessor"
@@ -149,7 +149,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha224")
.to("xmlsecurity-sign:sha224?keyAccessor=#accessor"
@@ -158,7 +158,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha256")
.to("xmlsecurity-sign:sha256?keyAccessor=#accessor"
@@ -167,7 +167,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha384")
.to("xmlsecurity-sign:sha384?keyAccessor=#accessor"
@@ -176,7 +176,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha512")
.to("xmlsecurity-sign:sha512?keyAccessor=#accessor"
@@ -185,7 +185,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:ripemd160")
.to("xmlsecurity-sign:ripemd160?keyAccessor=#accessor"
@@ -194,7 +194,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:whirlpool")
.to("xmlsecurity-sign:whirlpool?keyAccessor=#accessor"
@@ -203,7 +203,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha3_224")
.to("xmlsecurity-sign:sha3_224?keyAccessor=#accessor"
@@ -212,7 +212,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha3_256")
.to("xmlsecurity-sign:sha3_256?keyAccessor=#accessor"
@@ -221,7 +221,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha3_384")
.to("xmlsecurity-sign:sha3_384?keyAccessor=#accessor"
@@ -230,7 +230,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:sha3_512")
.to("xmlsecurity-sign:sha3_512?keyAccessor=#accessor"
@@ -370,7 +370,7 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
super.setUp();
}
- public void setUpKeys(String algorithm, int keylength) throws Exception {
+ public void setUpKeys(String algorithm, int keylength) {
keyPair = getKeyPair(algorithm, keylength);
}
@@ -411,12 +411,12 @@ public class SignatureDigestMethodTest extends CamelTestSupport {
KeyAccessor accessor = new KeyAccessor() {
@Override
- public KeySelector getKeySelector(Message message) throws Exception {
+ public KeySelector getKeySelector(Message message) {
return KeySelector.singletonKeySelector(privateKey);
}
@Override
- public KeyInfo getKeyInfo(Message mess, Node messageBody, KeyInfoFactory keyInfoFactory) throws Exception {
+ public KeyInfo getKeyInfo(Message mess, Node messageBody, KeyInfoFactory keyInfoFactory) {
return null;
}
};
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java
index be8044d..89468b1 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java
@@ -65,12 +65,12 @@ public class SpringXmlSignatureTest extends XmlSignatureTest {
}
@Override
- protected Registry createCamelRegistry() throws Exception {
+ protected Registry createCamelRegistry() {
return new SimpleRegistry();
}
@Override
- protected RouteBuilder[] createRouteBuilders() throws Exception {
+ protected RouteBuilder[] createRouteBuilders() {
return new RouteBuilder[] {};
}
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
index 41f5504..a9938c7 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XAdESSignaturePropertiesTest.java
@@ -117,23 +117,23 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Override
- protected RouteBuilder[] createRouteBuilders() throws Exception {
+ protected RouteBuilder[] createRouteBuilders() {
return new RouteBuilder[] { new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:enveloped")
.to("xmlsecurity-sign:xades?keyAccessor=#keyAccessorDefault&properties=#xmlSignatureProperties&parentLocalName=root&parentNamespace=http://test/test")
.to("mock:result");
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:enveloping")
.to("xmlsecurity-sign:xades?keyAccessor=#keyAccessorDefault&properties=#xmlSignatureProperties")
.to("mock:result");
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:emptySignatureId").to(
"xmlsecurity-sign:xades?keyAccessor=#keyAccessorDefault&properties=#xmlSignatureProperties&signatureId=")
@@ -141,7 +141,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
"mock:result");
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(Exception.class).handled(false).to("mock:exception");
from("direct:detached").to(
"xmlsecurity-sign:detached?keyAccessor=#keyAccessorDefault&xpathsToIdAttributes=#xpathsToIdAttributes&"//
@@ -667,28 +667,28 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void namespaceNull() throws Exception {
+ public void namespaceNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class, () -> xAdESSignatureProperties.setNamespace(null));
}
@Test
- public void signingCertificateURIsNull() throws Exception {
+ public void signingCertificateURIsNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class, () -> xAdESSignatureProperties.setSigningCertificateURIs(null));
}
@Test
- public void sigPolicyInvalid() throws Exception {
+ public void sigPolicyInvalid() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class, () -> xAdESSignatureProperties.setSignaturePolicy("invalid"));
}
@Test
- public void sigPolicyIdDocumentationReferencesNull() throws Exception {
+ public void sigPolicyIdDocumentationReferencesNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class,
@@ -696,7 +696,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void sigPolicyIdDocumentationReferencesNullEntry() throws Exception {
+ public void sigPolicyIdDocumentationReferencesNullEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> sigPolicyIdDocumentationReferences = Collections.<String> singletonList(null);
@@ -705,7 +705,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void sigPolicyIdDocumentationReferencesEmptyEntry() throws Exception {
+ public void sigPolicyIdDocumentationReferencesEmptyEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> sigPolicyIdDocumentationReferences = Collections.singletonList("");
@@ -714,7 +714,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void dataObjectFormatIdentifierDocumentationReferencesNull() throws Exception {
+ public void dataObjectFormatIdentifierDocumentationReferencesNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class,
@@ -722,7 +722,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void dataObjectFormatIdentifierDocumentationReferencesNullEntry() throws Exception {
+ public void dataObjectFormatIdentifierDocumentationReferencesNullEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> dataObjectFormatIdentifierDocumentationReferences = Collections.singletonList(null);
@@ -732,7 +732,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void dataObjectFormatIdentifierDocumentationReferencesEmptyEntry() throws Exception {
+ public void dataObjectFormatIdentifierDocumentationReferencesEmptyEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> dataObjectFormatIdentifierDocumentationReferences = Collections.singletonList("");
@@ -742,14 +742,14 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void signerClaimedRolesNull() throws Exception {
+ public void signerClaimedRolesNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class, () -> xAdESSignatureProperties.setSignerClaimedRoles(null));
}
@Test
- public void signerClaimedRolesNullEntry() throws Exception {
+ public void signerClaimedRolesNullEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> signerClaimedRoles = Collections.singletonList(null);
@@ -758,7 +758,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void signerClaimedRolesEmptyEntry() throws Exception {
+ public void signerClaimedRolesEmptyEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> signerClaimedRoles = Collections.singletonList("");
@@ -767,14 +767,14 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void signerCertifiedRolesNull() throws Exception {
+ public void signerCertifiedRolesNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class, () -> xAdESSignatureProperties.setSignerCertifiedRoles(null));
}
@Test
- public void signerCertifiedRolesNullEntry() throws Exception {
+ public void signerCertifiedRolesNullEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<XAdESEncapsulatedPKIData> signerCertifiedRoles = Collections.singletonList(null);
@@ -783,7 +783,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void commitmentTypeIdDocumentationReferencesNull() throws Exception {
+ public void commitmentTypeIdDocumentationReferencesNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class,
@@ -791,7 +791,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void commitmentTypeIdDocumentationReferencesNullEntry() throws Exception {
+ public void commitmentTypeIdDocumentationReferencesNullEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> commitmentTypeIdDocumentationReferences = Collections.singletonList(null);
@@ -800,7 +800,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void commitmentTypeIdDocumentationReferencesEmptyEntry() throws Exception {
+ public void commitmentTypeIdDocumentationReferencesEmptyEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> commitmentTypeIdDocumentationReferences = Collections.singletonList("");
@@ -809,14 +809,14 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void commitmentTypeQualifiersNull() throws Exception {
+ public void commitmentTypeQualifiersNull() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
assertThrows(IllegalArgumentException.class, () -> xAdESSignatureProperties.setCommitmentTypeQualifiers(null));
}
@Test
- public void commitmentTypeQualifiersNullEntry() throws Exception {
+ public void commitmentTypeQualifiersNullEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> commitmentTypeQualifiers = Collections.singletonList(null);
@@ -825,7 +825,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Test
- public void commitmentTypeQualifiersEmptyEntry() throws Exception {
+ public void commitmentTypeQualifiersEmptyEntry() {
final XAdESSignatureProperties xAdESSignatureProperties = new XAdESSignatureProperties();
final List<String> commitmentTypeQualifiers = Collections.singletonList("");
@@ -1039,7 +1039,7 @@ public class XAdESSignaturePropertiesTest extends CamelTestSupport {
}
@Override
- protected X509Certificate getSigningCertificate() throws Exception {
+ protected X509Certificate getSigningCertificate() {
return null;
}
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java
index 7b9bf7e..b8c2482 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/XmlSignatureTest.java
@@ -160,9 +160,9 @@ public class XmlSignatureTest extends CamelTestSupport {
}
@Override
- protected RouteBuilder[] createRouteBuilders() throws Exception {
+ protected RouteBuilder[] createRouteBuilders() {
return new RouteBuilder[] { new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: enveloping XML signature
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:enveloping").to(getSignerEndpointURIEnveloping()).to("mock:signed")
@@ -171,7 +171,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: enveloping XML signature
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: enveloping XML signature with plain text
// message body
onException(XmlSignatureException.class).handled(true).to("mock:exception");
@@ -182,7 +182,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// body
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: enveloped XML signature
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:enveloped").to(getSignerEndpointURIEnveloped()).to("mock:signed")
@@ -191,7 +191,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: enveloped XML signature
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: canonicalization
// we can set the configuration properties explicitly on the
// endpoint instances.
@@ -209,7 +209,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: canonicalization
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signature and digest algorithm
from("direct:signaturedigestalgorithm")
.to("xmlsecurity-sign:signaturedigestalgorithm?keyAccessor=#accessor"
@@ -219,7 +219,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: signature and digest algorithm
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: transforms XPath2
from("direct:transformsXPath2").to(
"xmlsecurity-sign:transformsXPath2?keyAccessor=#accessor&transformMethods=#transformsXPath2",
@@ -227,7 +227,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: transform XPath
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: transforms XSLT,XPath
onException(XmlSignatureException.class).handled(false).to("mock:exception");
from("direct:transformsXsltXPath").to(
@@ -236,7 +236,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: transforms XSLT,XPath
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: transforms XSLT,XPath - secure Validation
// disabled
from("direct:transformsXsltXPathSecureValDisabled")
@@ -247,7 +247,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// disabled
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: cryptocontextprops
onException(XmlSignatureException.class).handled(false).to("mock:exception");
from("direct:cryptocontextprops")
@@ -256,7 +256,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: cryptocontextprops
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: URI dereferencer
from("direct:uridereferencer")
.to("xmlsecurity-sign:uriderferencer?keyAccessor=#accessor&uriDereferencer=#uriDereferencer")
@@ -265,7 +265,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: URI dereferencer
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: keyAccessorKeySelectorDefault
from("direct:keyAccessorKeySelectorDefault")
.to("xmlsecurity-sign:keyAccessorKeySelectorDefault?keyAccessor=#keyAccessorDefault&addKeyInfoReference=true")
@@ -274,7 +274,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: keyAccessorKeySelectorDefault
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: xmlSignatureChecker
onException(XmlSignatureInvalidException.class).handled(false).to("mock:exception");
from("direct:xmlSignatureChecker")
@@ -283,7 +283,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: xmlSignatureChecker
}
}, new RouteBuilder() {
- public void configure() throws Exception { //
+ public void configure() { //
// START SNIPPET: properties
from("direct:props")
.to("xmlsecurity-sign:properties?keyAccessor=#accessor&properties=#signatureProperties")
@@ -292,7 +292,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: properties
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: verify output node search element name
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:outputnodesearchelementname").to(
@@ -302,7 +302,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: verify output node search element name
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: verify output node search xpath
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:outputnodesearchxpath")
@@ -311,7 +311,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: verify output node search xpath
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: validationFailedHandler
from("direct:validationFailedHandler")
.to("xmlsecurity-verify:validationFailedHandler?keySelector=#selectorKeyValue&validationFailedHandler=#validationFailedHandlerIgnoreManifestFailures")
@@ -319,7 +319,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: validationFailedHandler
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: further parameters
from("direct:furtherparams")
.to("xmlsecurity-sign:furtherparams?keyAccessor=#accessor&prefixForXmlSignatureNamespace=digsig&disallowDoctypeDecl=false")
@@ -328,7 +328,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: further parameters
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signer invalid keyexception
onException(XmlSignatureInvalidKeyException.class).handled(true).to("mock:exception");
from("direct:signexceptioninvalidkey").to(
@@ -337,7 +337,7 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: signer invalid keyexception
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: signer exceptions
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:signexceptions")
@@ -346,27 +346,27 @@ public class XmlSignatureTest extends CamelTestSupport {
// END SNIPPET: signer exceptions
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(XmlSignatureException.class).handled(true).to("mock:exception");
from("direct:noSuchAlgorithmException")
.to("xmlsecurity-sign:noSuchAlgorithmException?keyAccessor=#accessor&signatureAlgorithm=wrongalgorithm&digestAlgorithm=http://www.w3.org/2001/04/xmlenc#sha512")
.to("mock:result");
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(XmlSignatureException.class).handled(false).to("mock:exception");
from("direct:verifyexceptions").to("xmlsecurity-verify:verifyexceptions?keySelector=#selector")
.to("mock:result");
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(XmlSignatureException.class).handled(false).to("mock:exception");
from("direct:verifyInvalidKeyException")
.to("xmlsecurity-verify:verifyInvalidKeyException?keySelector=#selector").to(
"mock:result");
}
}, new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
onException(XmlSignatureException.class).handled(false).to("mock:exception");
from("direct:invalidhash").to(
"xmlsecurity-verify:invalidhash?keySelector=#selectorKeyValue&baseUri=#baseUri&secureValidation=false")
@@ -378,7 +378,7 @@ public class XmlSignatureTest extends CamelTestSupport {
RouteBuilder createDetachedRoute() {
return new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: detached XML signature
onException(Exception.class).handled(false).to("mock:exception");
from("direct:detached")
@@ -394,7 +394,7 @@ public class XmlSignatureTest extends CamelTestSupport {
private RouteBuilder createRouteForEnvelopedWithParentXpath() {
return new RouteBuilder() {
- public void configure() throws Exception {
+ public void configure() {
// START SNIPPET: enveloped XML signature with parent XPath
onException(XmlSignatureException.class).handled(false).to("mock:exception");
from("direct:envelopedParentXpath")
@@ -1456,7 +1456,7 @@ public class XmlSignatureTest extends CamelTestSupport {
super.setUp();
}
- public void setUpKeys(String algorithm, int keylength) throws Exception {
+ public void setUpKeys(String algorithm, int keylength) {
keyPair = getKeyPair(algorithm, keylength);
}
@@ -1539,12 +1539,12 @@ public class XmlSignatureTest extends CamelTestSupport {
KeyAccessor accessor = new KeyAccessor() {
@Override
- public KeySelector getKeySelector(Message message) throws Exception {
+ public KeySelector getKeySelector(Message message) {
return KeySelector.singletonKeySelector(privateKey);
}
@Override
- public KeyInfo getKeyInfo(Message mess, Node messageBody, KeyInfoFactory keyInfoFactory) throws Exception {
+ public KeyInfo getKeyInfo(Message mess, Node messageBody, KeyInfoFactory keyInfoFactory) {
return null;
}
};
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/ValidationFailedHandlerIgnoreManifestFailures.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/ValidationFailedHandlerIgnoreManifestFailures.java
index d70486b..40cc571 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/ValidationFailedHandlerIgnoreManifestFailures.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/ValidationFailedHandlerIgnoreManifestFailures.java
@@ -26,12 +26,12 @@ import org.apache.camel.component.xmlsecurity.api.DefaultValidationFailedHandler
public class ValidationFailedHandlerIgnoreManifestFailures extends DefaultValidationFailedHandler {
@Override
- public void manifestReferenceValidationFailed(Reference ref) throws Exception {
+ public void manifestReferenceValidationFailed(Reference ref) {
// do nothing
}
@Override
- public boolean ignoreCoreValidationFailure() throws Exception {
+ public boolean ignoreCoreValidationFailure() {
return true;
}
}
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/XmlSignature2Message2MessageWithTimestampProperty.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/XmlSignature2Message2MessageWithTimestampProperty.java
index 339edb6..297a14b 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/XmlSignature2Message2MessageWithTimestampProperty.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/util/XmlSignature2Message2MessageWithTimestampProperty.java
@@ -30,7 +30,7 @@ import org.apache.camel.component.xmlsecurity.api.DefaultXmlSignature2Message;
public class XmlSignature2Message2MessageWithTimestampProperty extends DefaultXmlSignature2Message {
@Override
- protected List<Reference> getReferencesForMessageMapping(Input input) throws Exception {
+ protected List<Reference> getReferencesForMessageMapping(Input input) {
List<Reference> result = new ArrayList<>(1);
for (Reference ref : input.getReferences()) {
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java
index eccc651..83e2503 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/TestHelper.java
@@ -113,11 +113,11 @@ public class TestHelper {
Logger log = LoggerFactory.getLogger(TestHelper.class);
- protected void sendText(final String fragment, CamelContext context) throws Exception {
+ protected void sendText(final String fragment, CamelContext context) {
ProducerTemplate template = context.createProducerTemplate();
template.start();
template.send("direct:start", new Processor() {
- public void process(Exchange exchange) throws Exception {
+ public void process(Exchange exchange) {
// Set the property of the charset encoding
exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
Message in = exchange.getIn();
@@ -184,7 +184,7 @@ public class TestHelper {
assertFalse(hasEncryptedData(inDoc), "The XML message has encrypted data.");
}
- private boolean hasEncryptedData(Document doc) throws Exception {
+ private boolean hasEncryptedData(Document doc) {
NodeList nodeList = doc.getElementsByTagNameNS("http://www.w3.org/2001/04/xmlenc#", "EncryptedData");
return nodeList.getLength() > 0;
}
diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityConcurrencyTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityConcurrencyTest.java
index 2643aa1..86f92cb 100644
--- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityConcurrencyTest.java
+++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/dataformat/xmlsecurity/XMLSecurityConcurrencyTest.java
@@ -53,7 +53,7 @@ public class XMLSecurityConcurrencyTest extends CamelTestSupport {
for (int i = 0; i < files; i++) {
final int index = i;
executor.submit(new Callable<Object>() {
- public Object call() throws Exception {
+ public Object call() {
String body = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><body>you can not read me " + index + "</body>";
template.sendBody("direct:start", body);
return null;