You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2014/01/19 13:49:47 UTC
git commit: Polished.
Updated Branches:
refs/heads/master 38e1367eb -> 5359727af
Polished.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5359727a
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5359727a
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5359727a
Branch: refs/heads/master
Commit: 5359727af0dcc9179b2184fca89f83576ec33e49
Parents: 38e1367
Author: Babak Vahdat <bv...@apache.org>
Authored: Sun Jan 19 13:37:21 2014 +0100
Committer: Babak Vahdat <bv...@apache.org>
Committed: Sun Jan 19 13:37:21 2014 +0100
----------------------------------------------------------------------
.../impl/DefaultPackageScanClassResolver.java | 1 -
.../validation/ValidatingProcessor.java | 2 -
.../toolbox/FlexibleAggregationStrategy.java | 10 +-
.../camel/converter/jaxp/StaxConverterTest.java | 12 +-
.../FlexibleAggregationStrategiesTest.java | 8 +-
.../org/apache/camel/avro/generated/Key.java | 2 +-
.../org/apache/camel/avro/generated/Value.java | 2 +-
.../avro/AvroMarshalAndUnmarshallTest.java | 1 -
.../aws/swf/SwfComponentSpringTest.java | 2 -
.../camel/bam/model/ProcessDefinition.java | 3 -
.../cxf/transport/CamelTransportFactory.java | 4 +-
.../cxf/common/header/CxfHeaderHelperTest.java | 2 +-
...CxfConsumerPayloadXPathClientServerTest.java | 2 +-
.../cxf/CxfConsumerPayloadXPathTest.java | 4 +-
.../component/cxf/DefaultCxfBindingTest.java | 3 +-
.../camel/component/http/helper/HttpHelper.java | 1 -
.../camel/component/http4/HttpProducer.java | 3 -
.../component/http4/HttpProxyServerTest.java | 4 -
.../JsonPathTransformResultTypeTest.java | 1 -
.../component/sjms/jms/JmsObjectFactory.java | 4 +-
.../component/smpp/SmppDefaultSplitterTest.java | 4 +-
.../blueprint/BlueprintBeanInjectRoute.java | 1 -
.../processor/XmlVerifierProcessor.java | 652 +++++++++----------
.../OSGiJettyCamelContextsClassloaderTest.java | 3 +-
.../jetty/OSGiMulitJettyCamelContextsTest.java | 3 +-
25 files changed, 359 insertions(+), 375 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
index 837d088..0427a43 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultPackageScanClassResolver.java
@@ -48,7 +48,6 @@ import org.apache.camel.support.ServiceSupport;
import org.apache.camel.util.IOHelper;
import org.apache.camel.util.LRUSoftCache;
import org.apache.camel.util.ObjectHelper;
-import org.apache.camel.util.ServiceHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
index 200d0fe..bcbc671 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/validation/ValidatingProcessor.java
@@ -20,7 +20,6 @@ import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.io.StringWriter;
import java.net.URL;
import java.util.Collections;
import javax.xml.XMLConstants;
@@ -32,7 +31,6 @@ import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stax.StAXSource;
-import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/camel-core/src/main/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategy.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategy.java b/camel-core/src/main/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategy.java
index b15dbc5..1348163 100644
--- a/camel-core/src/main/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategy.java
+++ b/camel-core/src/main/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategy.java
@@ -272,14 +272,14 @@ public class FlexibleAggregationStrategy<E extends Object> implements Aggregatio
try {
if (oldValue == null || oldExchange.getProperty(COLLECTION_AGGR_GUARD_PROPERTY, Boolean.class) == null) {
try {
- collection = (Collection<E>) collectionType.newInstance();
+ collection = collectionType.newInstance();
} catch (Exception e) {
LOG.warn("Could not instantiate collection of type {}. Aborting aggregation.", collectionType);
throw ObjectHelper.wrapCamelExecutionException(oldExchange, e);
}
oldExchange.setProperty(COLLECTION_AGGR_GUARD_PROPERTY, Boolean.FALSE);
} else {
- collection = (Collection<E>) collectionType.cast(oldValue);
+ collection = collectionType.cast(oldValue);
}
if (collection != null) {
@@ -345,7 +345,7 @@ public class FlexibleAggregationStrategy<E extends Object> implements Aggregatio
@Override @SuppressWarnings("unchecked")
public Collection<E> getValueAsCollection(Exchange exchange) {
- return (Collection<E>) exchange.getProperty(propertyName, Collection.class);
+ return exchange.getProperty(propertyName, Collection.class);
}
@Override
@@ -380,7 +380,7 @@ public class FlexibleAggregationStrategy<E extends Object> implements Aggregatio
@Override @SuppressWarnings("unchecked")
public Collection<E> getValueAsCollection(Exchange exchange) {
- return (Collection<E>) exchange.getIn().getHeader(headerName, Collection.class);
+ return exchange.getIn().getHeader(headerName, Collection.class);
}
@Override
@@ -411,7 +411,7 @@ public class FlexibleAggregationStrategy<E extends Object> implements Aggregatio
@Override @SuppressWarnings("unchecked")
public Collection<E> getValueAsCollection(Exchange exchange) {
- return (Collection<E>) exchange.getIn().getBody(Collection.class);
+ return exchange.getIn().getBody(Collection.class);
}
@Override
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java b/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
index 1049332..7cd070d 100644
--- a/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
+++ b/camel-core/src/test/java/org/apache/camel/converter/jaxp/StaxConverterTest.java
@@ -22,9 +22,9 @@ import java.nio.charset.Charset;
import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamReader;
import javax.xml.stream.XMLStreamWriter;
-import javax.xml.stream.events.XMLEvent;
import org.apache.camel.ContextTestSupport;
import org.apache.camel.Exchange;
@@ -98,19 +98,19 @@ public class StaxConverterTest extends ContextTestSupport {
while (reader.hasNext()) {
reader.next();
switch (reader.getEventType()) {
- case XMLEvent.START_DOCUMENT:
+ case XMLStreamConstants.START_DOCUMENT:
writer.writeStartDocument();
break;
- case XMLEvent.END_DOCUMENT:
+ case XMLStreamConstants.END_DOCUMENT:
writer.writeEndDocument();
break;
- case XMLEvent.START_ELEMENT:
+ case XMLStreamConstants.START_ELEMENT:
writer.writeStartElement(reader.getName().getLocalPart());
break;
- case XMLEvent.CHARACTERS:
+ case XMLStreamConstants.CHARACTERS:
writer.writeCharacters(reader.getText());
break;
- case XMLEvent.END_ELEMENT:
+ case XMLStreamConstants.END_ELEMENT:
writer.writeEndElement();
break;
default:
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java b/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
index be2dfad..bbb2aa9 100644
--- a/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
+++ b/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java
@@ -54,7 +54,7 @@ public class FlexibleAggregationStrategiesTest extends ContextTestSupport {
assertMockEndpointsSatisfied();
- List<String> resultList = (List<String>) getMockEndpoint("mock:result1").getReceivedExchanges()
+ List<String> resultList = getMockEndpoint("mock:result1").getReceivedExchanges()
.get(0).getIn().getBody(List.class);
for (int i = 0; i < 5; i++) {
@@ -75,7 +75,7 @@ public class FlexibleAggregationStrategiesTest extends ContextTestSupport {
assertMockEndpointsSatisfied();
- List<String> resultList = (List<String>) getMockEndpoint("mock:result1").getReceivedExchanges()
+ List<String> resultList = getMockEndpoint("mock:result1").getReceivedExchanges()
.get(0).getIn().getBody(List.class);
for (int i = 0; i < 3; i++) {
assertEquals("AGGREGATE" + (i + 1), resultList.get(i));
@@ -95,7 +95,7 @@ public class FlexibleAggregationStrategiesTest extends ContextTestSupport {
assertMockEndpointsSatisfied();
- HashSet<String> resultSet = (HashSet<String>) getMockEndpoint("mock:result2").getReceivedExchanges().get(0)
+ HashSet<String> resultSet = getMockEndpoint("mock:result2").getReceivedExchanges().get(0)
.getProperty("AggregationResult", HashSet.class);
assertEquals(3, resultSet.size());
assertTrue(resultSet.contains("AGGREGATE1") && resultSet.contains("AGGREGATE2") && resultSet.contains("AGGREGATE3"));
@@ -195,7 +195,7 @@ public class FlexibleAggregationStrategiesTest extends ContextTestSupport {
assertMockEndpointsSatisfied();
- ArrayList<Node> list = (ArrayList<Node>) getMockEndpoint("mock:result.xpath1").getReceivedExchanges().get(0).getIn().getBody(ArrayList.class);
+ ArrayList<Node> list = getMockEndpoint("mock:result.xpath1").getReceivedExchanges().get(0).getIn().getBody(ArrayList.class);
assertEquals(2, list.size());
assertEquals("ok", list.get(0).getTextContent());
assertEquals("error", list.get(1).getTextContent());
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java b/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java
index d6575b2..7af8846 100644
--- a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java
+++ b/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Key.java
@@ -94,7 +94,7 @@ public class Key extends org.apache.avro.specific.SpecificRecordBase implements
private Builder(org.apache.camel.avro.generated.Key other) {
super(org.apache.camel.avro.generated.Key.SCHEMA$);
if (isValidValue(fields()[0], other.key)) {
- this.key = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.key);
+ this.key = data().deepCopy(fields()[0].schema(), other.key);
fieldSetFlags()[0] = true;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java b/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java
index d61e442..25a2b6b 100644
--- a/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java
+++ b/components/camel-avro/src/test/java/org/apache/camel/avro/generated/Value.java
@@ -94,7 +94,7 @@ public class Value extends org.apache.avro.specific.SpecificRecordBase implement
private Builder(org.apache.camel.avro.generated.Value other) {
super(org.apache.camel.avro.generated.Value.SCHEMA$);
if (isValidValue(fields()[0], other.value)) {
- this.value = (java.lang.CharSequence) data().deepCopy(fields()[0].schema(), other.value);
+ this.value = data().deepCopy(fields()[0].schema(), other.value);
fieldSetFlags()[0] = true;
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java
----------------------------------------------------------------------
diff --git a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java
index 99b4c36..8278384 100644
--- a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java
+++ b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshallTest.java
@@ -17,7 +17,6 @@
package org.apache.camel.dataformat.avro;
import org.apache.camel.CamelException;
-import org.apache.camel.FailedToCreateRouteException;
import org.apache.camel.avro.generated.Value;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/SwfComponentSpringTest.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/SwfComponentSpringTest.java b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/SwfComponentSpringTest.java
index 12b8437..55b8a50 100644
--- a/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/SwfComponentSpringTest.java
+++ b/components/camel-aws/src/test/java/org/apache/camel/component/aws/swf/SwfComponentSpringTest.java
@@ -18,10 +18,8 @@ package org.apache.camel.component.aws.swf;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
import org.apache.camel.Processor;
import org.apache.camel.ProducerTemplate;
-import org.apache.camel.component.aws.sqs.SqsConstants;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.spring.CamelSpringTestSupport;
import org.junit.Test;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
----------------------------------------------------------------------
diff --git a/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java b/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
index abad982..42d73df 100644
--- a/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
+++ b/components/camel-bam/src/main/java/org/apache/camel/bam/model/ProcessDefinition.java
@@ -16,14 +16,11 @@
*/
package org.apache.camel.bam.model;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
import javax.persistence.Table;
import org.apache.camel.bam.QueryUtils;
import org.apache.camel.util.ObjectHelper;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportFactory.java b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportFactory.java
index 06250d8..5b38b45 100644
--- a/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportFactory.java
+++ b/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/transport/CamelTransportFactory.java
@@ -138,13 +138,13 @@ public class CamelTransportFactory extends AbstractTransportFactory implements C
DestinationFactoryManager dfm = bus.getExtension(DestinationFactoryManager.class);
if (null != dfm && getTransportIds() != null) {
for (String ns : getTransportIds()) {
- dfm.registerDestinationFactory(ns, (DestinationFactory)this);
+ dfm.registerDestinationFactory(ns, this);
}
}
ConduitInitiatorManager cim = bus.getExtension(ConduitInitiatorManager.class);
if (cim != null && getTransportIds() != null) {
for (String ns : getTransportIds()) {
- cim.registerConduitInitiator(ns, (ConduitInitiator)this);
+ cim.registerConduitInitiator(ns, this);
}
}
}
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/header/CxfHeaderHelperTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/header/CxfHeaderHelperTest.java b/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/header/CxfHeaderHelperTest.java
index 9698f26..81f2e1d 100755
--- a/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/header/CxfHeaderHelperTest.java
+++ b/components/camel-cxf-transport/src/test/java/org/apache/camel/component/cxf/common/header/CxfHeaderHelperTest.java
@@ -130,7 +130,7 @@ public class CxfHeaderHelperTest extends Assert {
private void verifyHeader(Map<String, List<String>> headers, String name, List<String> value) {
List<String> values = headers.get(name);
assertTrue("The entry must be available", values != null && values.size() == ((List<?>)value).size());
- assertEquals("The value must match", (List<?>)value, values);
+ assertEquals("The value must match", value, values);
}
private void verifyHeader(Map<String, List<String>> headers, String name, String value) {
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java
index 64980a9..edc0e5a 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathClientServerTest.java
@@ -74,7 +74,7 @@ public class CxfConsumerPayloadXPathClientServerTest extends CamelTestSupport {
//attempt 2) in stead of XPATH, browse the DOM-tree
CxfPayload<SoapHeader> payload = (CxfPayload<SoapHeader>) request;
- Element el = (Element) payload.getBody().get(0);
+ Element el = payload.getBody().get(0);
Element el2 = (Element) el.getFirstChild();
Text textnode = (Text) el2.getFirstChild();
receivedMessageByDom = textnode.getNodeValue();
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java
index 00206d6..e21acce 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadXPathTest.java
@@ -158,7 +158,7 @@ public class CxfConsumerPayloadXPathTest extends CamelTestSupport {
Object obj = exchange.getIn().getBody();
@SuppressWarnings("unchecked")
CxfPayload<SoapHeader> payload = (CxfPayload<SoapHeader>) obj;
- Element el = (Element) payload.getBody().get(0);
+ Element el = payload.getBody().get(0);
Text textnode = (Text) el.getFirstChild();
exchange.getOut().setBody(textnode.getNodeValue());
exchange.getOut().setHeaders(exchange.getIn().getHeaders());
@@ -171,7 +171,7 @@ public class CxfConsumerPayloadXPathTest extends CamelTestSupport {
Object obj = exchange.getIn().getBody();
@SuppressWarnings("unchecked")
CxfPayload<SoapHeader> payload = (CxfPayload<SoapHeader>) obj;
- Element el = (Element) payload.getBody().get(0);
+ Element el = payload.getBody().get(0);
Text textnode = (Text) el.getFirstChild();
StringBuilder b = new StringBuilder();
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
index a7e976d..525ec72 100644
--- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/DefaultCxfBindingTest.java
@@ -231,6 +231,7 @@ public class DefaultCxfBindingTest extends Assert {
assertNotNull(camelAttachments.get("att-1"));
}
+
@Test
public void testPopupalteExchangeFromCxfRequestWithHeaderMerged() {
DefaultCxfBinding cxfBinding = new DefaultCxfBinding();
@@ -258,7 +259,7 @@ public class DefaultCxfBindingTest extends Assert {
private void verifyHeader(Map<String, List<String>> headers, String name, List<String> value) {
List<String> values = headers.get(name);
assertTrue("The entry must be available", values != null && values.size() == ((List<?>)value).size());
- assertEquals("The value must match", (List<?>)value, values);
+ assertEquals("The value must match", value, values);
}
private void verifyHeader(Map<String, List<String>> headers, String name, String value) {
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
----------------------------------------------------------------------
diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
index 601696c..dade973 100644
--- a/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
+++ b/components/camel-http/src/main/java/org/apache/camel/component/http/helper/HttpHelper.java
@@ -21,7 +21,6 @@ import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
index dbe578f..3480aad 100644
--- a/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
+++ b/components/camel-http4/src/main/java/org/apache/camel/component/http4/HttpProducer.java
@@ -49,8 +49,6 @@ import org.apache.camel.util.URISupport;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.Credentials;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpRequestBase;
@@ -61,7 +59,6 @@ import org.apache.http.entity.FileEntity;
import org.apache.http.entity.InputStreamEntity;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.auth.BasicScheme;
-import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
----------------------------------------------------------------------
diff --git a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
index 1d7a449..7fc0d2d 100644
--- a/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
+++ b/components/camel-http4/src/test/java/org/apache/camel/component/http4/HttpProxyServerTest.java
@@ -32,7 +32,6 @@ import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.Header;
import org.apache.http.HttpException;
-import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpResponse;
@@ -40,9 +39,6 @@ import org.apache.http.HttpResponseInterceptor;
import org.apache.http.HttpStatus;
import org.apache.http.ProtocolException;
import org.apache.http.auth.AUTH;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.localserver.LocalTestServer;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.ImmutableHttpProcessor;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-jsonpath/src/test/java/org/apache/camel/jsonpath/JsonPathTransformResultTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jsonpath/src/test/java/org/apache/camel/jsonpath/JsonPathTransformResultTypeTest.java b/components/camel-jsonpath/src/test/java/org/apache/camel/jsonpath/JsonPathTransformResultTypeTest.java
index b734bb8..7d96d1b 100644
--- a/components/camel-jsonpath/src/test/java/org/apache/camel/jsonpath/JsonPathTransformResultTypeTest.java
+++ b/components/camel-jsonpath/src/test/java/org/apache/camel/jsonpath/JsonPathTransformResultTypeTest.java
@@ -17,7 +17,6 @@
package org.apache.camel.jsonpath;
import java.io.File;
-import java.util.List;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
----------------------------------------------------------------------
diff --git a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
index 93040d5..3ed3a24 100644
--- a/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
+++ b/components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/JmsObjectFactory.java
@@ -127,9 +127,9 @@ public final class JmsObjectFactory {
}
} else {
if (ObjectHelper.isNotEmpty(messageSelector)) {
- messageConsumer = session.createConsumer((Topic)destination, messageSelector, noLocal);
+ messageConsumer = session.createConsumer(destination, messageSelector, noLocal);
} else {
- messageConsumer = session.createConsumer((Topic)destination);
+ messageConsumer = session.createConsumer(destination);
}
}
} else {
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java
----------------------------------------------------------------------
diff --git a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java
index 26c868b..3a6324a 100644
--- a/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java
+++ b/components/camel-smpp/src/test/java/org/apache/camel/component/smpp/SmppDefaultSplitterTest.java
@@ -29,7 +29,7 @@ public class SmppDefaultSplitterTest {
+ "12345678901234567890123456789012345678901234567890123456789012345678901234567890";
SmppSplitter splitter = new SmppDefaultSplitter(message.length());
- SmppDefaultSplitter.resetCurrentReferenceNumber();
+ SmppSplitter.resetCurrentReferenceNumber();
byte[][] result = splitter.split(message.getBytes());
assertEquals(1, result.length);
@@ -47,7 +47,7 @@ public class SmppDefaultSplitterTest {
+ "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901";
SmppSplitter splitter = new SmppDefaultSplitter(message.length());
- SmppDefaultSplitter.resetCurrentReferenceNumber();
+ SmppSplitter.resetCurrentReferenceNumber();
byte[][] result = splitter.split(message.getBytes());
assertEquals(2, result.length);
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintBeanInjectRoute.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintBeanInjectRoute.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintBeanInjectRoute.java
index 6517970..41e6f95 100644
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintBeanInjectRoute.java
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintBeanInjectRoute.java
@@ -19,7 +19,6 @@ package org.apache.camel.test.blueprint;
import org.apache.camel.BeanInject;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
-import org.apache.camel.PropertyInject;
import org.apache.camel.builder.RouteBuilder;
public class BlueprintBeanInjectRoute extends RouteBuilder {
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlVerifierProcessor.java
----------------------------------------------------------------------
diff --git a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlVerifierProcessor.java b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlVerifierProcessor.java
index 386e795..a7106bb 100644
--- a/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlVerifierProcessor.java
+++ b/components/camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/processor/XmlVerifierProcessor.java
@@ -1,326 +1,326 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.xmlsecurity.processor;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.NoSuchProviderException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.crypto.KeySelector;
-import javax.xml.crypto.XMLStructure;
-import javax.xml.crypto.dsig.Manifest;
-import javax.xml.crypto.dsig.Reference;
-import javax.xml.crypto.dsig.SignedInfo;
-import javax.xml.crypto.dsig.XMLObject;
-import javax.xml.crypto.dsig.XMLSignature;
-import javax.xml.crypto.dsig.XMLSignature.SignatureValue;
-import javax.xml.crypto.dsig.XMLSignatureException;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.dom.DOMValidateContext;
-import javax.xml.crypto.dsig.keyinfo.KeyInfo;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.component.xmlsecurity.api.ValidationFailedHandler;
-import org.apache.camel.component.xmlsecurity.api.XmlSignature2Message;
-import org.apache.camel.component.xmlsecurity.api.XmlSignatureChecker;
-import org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException;
-import org.apache.camel.component.xmlsecurity.api.XmlSignatureHelper;
-import org.apache.camel.component.xmlsecurity.api.XmlSignatureInvalidException;
-import org.apache.camel.util.IOHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * XML signature verifier. Assumes that the input XML contains exactly one
- * Signature element.
- */
-public class XmlVerifierProcessor extends XmlSignatureProcessor {
-
- private static final Logger LOG = LoggerFactory
- .getLogger(XmlVerifierProcessor.class);
-
- private final XmlVerifierConfiguration config;
-
- public XmlVerifierProcessor(XmlVerifierConfiguration config) {
- super();
- this.config = config;
- }
-
- @Override
- public XmlVerifierConfiguration getConfiguration() {
- return config;
- }
-
- @Override
- public void process(Exchange exchange) throws Exception {
-
- InputStream stream = exchange.getIn().getMandatoryBody(InputStream.class);
- try {
- // lets setup the out message before we invoke the signing
- // so that it can mutate it if necessary
- Message out = exchange.getOut();
- out.copyFrom(exchange.getIn());
- verify(stream, out);
- clearMessageHeaders(out);
- } catch (Exception e) {
- // remove OUT message, as an exception occurred
- exchange.setOut(null);
- throw e;
- } finally {
- IOHelper.close(stream, "input stream");
- }
- }
-
- protected void verify(InputStream input, final Message out)
- throws Exception {
-
- LOG.debug("Verification of XML signature document started");
- final Document doc = parseInput(input);
-
- Node signatureNode = getSignatureNode(doc);
-
- XMLSignatureFactory fac;
- // Try to install the Santuario Provider - fall back to the JDK provider if this does
- // not work
- try {
- fac = XMLSignatureFactory.getInstance("DOM", "ApacheXMLDSig");
- } catch (NoSuchProviderException ex) {
- fac = XMLSignatureFactory.getInstance("DOM");
- }
-
- KeySelector selector = getConfiguration().getKeySelector();
- if (selector == null) {
- throw new IllegalStateException("Wrong configuration. Key selector is missing.");
- }
-
- DOMValidateContext valContext = new DOMValidateContext(selector, signatureNode);
- valContext.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE);
- valContext.setProperty("org.jcp.xml.dsig.validateManifests", Boolean.TRUE);
-
- if (getConfiguration().getSecureValidation() == Boolean.TRUE) {
- valContext.setProperty("org.apache.jcp.xml.dsig.secureValidation", Boolean.TRUE);
- valContext.setProperty("org.jcp.xml.dsig.secureValidation", Boolean.TRUE);
- }
- setUriDereferencerAndBaseUri(valContext);
-
- setCryptoContextProperties(valContext);
-
- final XMLSignature signature = fac.unmarshalXMLSignature(valContext);
-
- executeApplicationCheck(out, doc, signature);
-
- boolean coreValidity;
- try {
- coreValidity = signature.validate(valContext);
- } catch (XMLSignatureException se) {
- throw getConfiguration().getValidationFailedHandler().onXMLSignatureException(se);
- }
- // Check core validation status
- boolean goon = coreValidity;
- if (!coreValidity) {
- goon = handleSignatureValidationFailed(valContext, signature);
- }
- if (goon) {
- LOG.debug("XML signature verified");
- map2Message(signature, out, doc);
- } else {
- throw new XmlSignatureInvalidException("");
- }
- }
-
- private void executeApplicationCheck(final Message out, final Document doc,
- final XMLSignature signature) throws Exception {
- if (getConfiguration().getXmlSignatureChecker() != null) {
- XmlSignatureChecker.Input checkerInput = new XmlSignatureChecker.Input() {
-
- @Override
- public SignedInfo getSignedInfo() {
- return signature.getSignedInfo();
- }
-
- @Override
- public SignatureValue getSignatureValue() {
- return signature.getSignatureValue();
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public List<? extends XMLObject> getObjects() {
- return (List<? extends XMLObject>) signature.getObjects();
- }
-
- @Override
- public Document getMessageBodyDocument() {
- return doc;
- }
-
- @Override
- public Message getMessage() {
- return out;
- }
-
- @Override
- public KeyInfo getKeyInfo() {
- return signature.getKeyInfo();
- }
- };
- getConfiguration().getXmlSignatureChecker().checkBeforeCoreValidation(checkerInput);
- }
- }
-
- private void map2Message(XMLSignature signature, Message out,
- final Document messageBodyDocument) throws Exception {
- @SuppressWarnings("unchecked")
- final List<Reference> refs = new ArrayList<Reference>(signature.getSignedInfo().getReferences());
- @SuppressWarnings("unchecked")
- final List<XMLObject> objs = new ArrayList<XMLObject>(signature.getObjects());
- XmlSignature2Message.Input refsAndObjects = new XmlSignature2Message.Input() {
-
- @Override
- public List<Reference> getReferences() {
- return refs;
- }
-
- @Override
- public List<XMLObject> getObjects() {
- return objs;
- }
-
- @Override
- public Document getMessageBodyDocument() {
- return messageBodyDocument;
- }
-
- @Override
- public Boolean omitXmlDeclaration() {
- return getConfiguration().getOmitXmlDeclaration();
- }
-
- @Override
- public Object getOutputNodeSearch() {
- return getConfiguration().getOutputNodeSearch();
- }
-
- @Override
- public String getOutputNodeSearchType() {
- return getConfiguration().getOutputNodeSearchType();
- }
-
- public Boolean getRemoveSignatureElements() {
- return getConfiguration().getRemoveSignatureElements();
- }
-
- };
- getConfiguration().getXmlSignature2Message().mapToMessage(refsAndObjects, out);
- }
-
- private Node getSignatureNode(Document doc) throws IOException,
- ParserConfigurationException, XmlSignatureFormatException {
-
- // Find Signature element
- NodeList nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
- if (nl.getLength() == 0) {
- throw new XmlSignatureFormatException(
- "Message is not a correct XML signature document: 'Signature' element is missing. Check the sent message.");
- }
-
- if (nl.getLength() != 1) {
- throw new XmlSignatureFormatException(
- "XML signature document is not supported; it contains more than one signature element. Check the sent message.");
- }
- Node signatureNode = nl.item(0);
- LOG.debug("Signature element found");
- return signatureNode;
- }
-
- @SuppressWarnings("unchecked")
- protected boolean handleSignatureValidationFailed(DOMValidateContext valContext,
- XMLSignature signature) throws Exception {
- ValidationFailedHandler handler = getConfiguration().getValidationFailedHandler();
- LOG.debug("handleSignatureValidationFailed called");
- try {
- handler.start();
-
- // first check signature value, see
- // https://www.isecpartners.com/media/12012/XMLDSIG_Command_Injection.pdf
- SignatureValue sigValue = signature.getSignatureValue();
- boolean sv = sigValue.validate(valContext);
- if (!sv) {
- handler.signatureValueValidationFailed(sigValue);
- }
-
- // then the references!
- // check the validation status of each Reference
- for (Reference ref : (List<Reference>) signature.getSignedInfo().getReferences()) {
- boolean refValid = ref.validate(valContext);
- if (!refValid) {
- handler.referenceValidationFailed(ref);
- }
- }
-
- // validate Manifests, if property set
- if (Boolean.TRUE.equals(valContext.getProperty("org.jcp.xml.dsig.validateManifests"))) {
- for (XMLObject xo : (List<XMLObject>) signature.getObjects()) {
- List<XMLStructure> content = xo.getContent();
- for (XMLStructure xs : content) {
- if (xs instanceof Manifest) {
- Manifest man = (Manifest) xs;
- for (Reference ref : (List<Reference>) man
- .getReferences()) {
- boolean refValid = ref.validate(valContext);
- if (!refValid) {
- handler.manifestReferenceValidationFailed(ref);
- }
- }
- }
- }
- }
- }
- boolean goon = handler.ignoreCoreValidationFailure();
- LOG.debug("Ignore Core Validation failure: {}", goon);
- return goon;
- } finally {
- handler.end();
- }
-
- }
-
- protected Document parseInput(InputStream is)
- throws XmlSignatureFormatException, ParserConfigurationException,
- IOException {
- try {
- Document doc =
- XmlSignatureHelper.newDocumentBuilder(getConfiguration().getDisallowDoctypeDecl()).parse(is);
- return doc;
- } catch (SAXException e) {
- throw new XmlSignatureFormatException(
- "Message has wrong format, it is not a XML signature document. Check the sent message.",
- e
- );
- }
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.xmlsecurity.processor;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.NoSuchProviderException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.crypto.KeySelector;
+import javax.xml.crypto.XMLStructure;
+import javax.xml.crypto.dsig.Manifest;
+import javax.xml.crypto.dsig.Reference;
+import javax.xml.crypto.dsig.SignedInfo;
+import javax.xml.crypto.dsig.XMLObject;
+import javax.xml.crypto.dsig.XMLSignature;
+import javax.xml.crypto.dsig.XMLSignature.SignatureValue;
+import javax.xml.crypto.dsig.XMLSignatureException;
+import javax.xml.crypto.dsig.XMLSignatureFactory;
+import javax.xml.crypto.dsig.dom.DOMValidateContext;
+import javax.xml.crypto.dsig.keyinfo.KeyInfo;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.component.xmlsecurity.api.ValidationFailedHandler;
+import org.apache.camel.component.xmlsecurity.api.XmlSignature2Message;
+import org.apache.camel.component.xmlsecurity.api.XmlSignatureChecker;
+import org.apache.camel.component.xmlsecurity.api.XmlSignatureFormatException;
+import org.apache.camel.component.xmlsecurity.api.XmlSignatureHelper;
+import org.apache.camel.component.xmlsecurity.api.XmlSignatureInvalidException;
+import org.apache.camel.util.IOHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * XML signature verifier. Assumes that the input XML contains exactly one
+ * Signature element.
+ */
+public class XmlVerifierProcessor extends XmlSignatureProcessor {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(XmlVerifierProcessor.class);
+
+ private final XmlVerifierConfiguration config;
+
+ public XmlVerifierProcessor(XmlVerifierConfiguration config) {
+ super();
+ this.config = config;
+ }
+
+ @Override
+ public XmlVerifierConfiguration getConfiguration() {
+ return config;
+ }
+
+ @Override
+ public void process(Exchange exchange) throws Exception {
+
+ InputStream stream = exchange.getIn().getMandatoryBody(InputStream.class);
+ try {
+ // lets setup the out message before we invoke the signing
+ // so that it can mutate it if necessary
+ Message out = exchange.getOut();
+ out.copyFrom(exchange.getIn());
+ verify(stream, out);
+ clearMessageHeaders(out);
+ } catch (Exception e) {
+ // remove OUT message, as an exception occurred
+ exchange.setOut(null);
+ throw e;
+ } finally {
+ IOHelper.close(stream, "input stream");
+ }
+ }
+
+ protected void verify(InputStream input, final Message out)
+ throws Exception {
+
+ LOG.debug("Verification of XML signature document started");
+ final Document doc = parseInput(input);
+
+ Node signatureNode = getSignatureNode(doc);
+
+ XMLSignatureFactory fac;
+ // Try to install the Santuario Provider - fall back to the JDK provider if this does
+ // not work
+ try {
+ fac = XMLSignatureFactory.getInstance("DOM", "ApacheXMLDSig");
+ } catch (NoSuchProviderException ex) {
+ fac = XMLSignatureFactory.getInstance("DOM");
+ }
+
+ KeySelector selector = getConfiguration().getKeySelector();
+ if (selector == null) {
+ throw new IllegalStateException("Wrong configuration. Key selector is missing.");
+ }
+
+ DOMValidateContext valContext = new DOMValidateContext(selector, signatureNode);
+ valContext.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE);
+ valContext.setProperty("org.jcp.xml.dsig.validateManifests", Boolean.TRUE);
+
+ if (getConfiguration().getSecureValidation() == Boolean.TRUE) {
+ valContext.setProperty("org.apache.jcp.xml.dsig.secureValidation", Boolean.TRUE);
+ valContext.setProperty("org.jcp.xml.dsig.secureValidation", Boolean.TRUE);
+ }
+ setUriDereferencerAndBaseUri(valContext);
+
+ setCryptoContextProperties(valContext);
+
+ final XMLSignature signature = fac.unmarshalXMLSignature(valContext);
+
+ executeApplicationCheck(out, doc, signature);
+
+ boolean coreValidity;
+ try {
+ coreValidity = signature.validate(valContext);
+ } catch (XMLSignatureException se) {
+ throw getConfiguration().getValidationFailedHandler().onXMLSignatureException(se);
+ }
+ // Check core validation status
+ boolean goon = coreValidity;
+ if (!coreValidity) {
+ goon = handleSignatureValidationFailed(valContext, signature);
+ }
+ if (goon) {
+ LOG.debug("XML signature verified");
+ map2Message(signature, out, doc);
+ } else {
+ throw new XmlSignatureInvalidException("");
+ }
+ }
+
+ private void executeApplicationCheck(final Message out, final Document doc,
+ final XMLSignature signature) throws Exception {
+ if (getConfiguration().getXmlSignatureChecker() != null) {
+ XmlSignatureChecker.Input checkerInput = new XmlSignatureChecker.Input() {
+
+ @Override
+ public SignedInfo getSignedInfo() {
+ return signature.getSignedInfo();
+ }
+
+ @Override
+ public SignatureValue getSignatureValue() {
+ return signature.getSignatureValue();
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<? extends XMLObject> getObjects() {
+ return signature.getObjects();
+ }
+
+ @Override
+ public Document getMessageBodyDocument() {
+ return doc;
+ }
+
+ @Override
+ public Message getMessage() {
+ return out;
+ }
+
+ @Override
+ public KeyInfo getKeyInfo() {
+ return signature.getKeyInfo();
+ }
+ };
+ getConfiguration().getXmlSignatureChecker().checkBeforeCoreValidation(checkerInput);
+ }
+ }
+
+ private void map2Message(XMLSignature signature, Message out,
+ final Document messageBodyDocument) throws Exception {
+ @SuppressWarnings("unchecked")
+ final List<Reference> refs = new ArrayList<Reference>(signature.getSignedInfo().getReferences());
+ @SuppressWarnings("unchecked")
+ final List<XMLObject> objs = new ArrayList<XMLObject>(signature.getObjects());
+ XmlSignature2Message.Input refsAndObjects = new XmlSignature2Message.Input() {
+
+ @Override
+ public List<Reference> getReferences() {
+ return refs;
+ }
+
+ @Override
+ public List<XMLObject> getObjects() {
+ return objs;
+ }
+
+ @Override
+ public Document getMessageBodyDocument() {
+ return messageBodyDocument;
+ }
+
+ @Override
+ public Boolean omitXmlDeclaration() {
+ return getConfiguration().getOmitXmlDeclaration();
+ }
+
+ @Override
+ public Object getOutputNodeSearch() {
+ return getConfiguration().getOutputNodeSearch();
+ }
+
+ @Override
+ public String getOutputNodeSearchType() {
+ return getConfiguration().getOutputNodeSearchType();
+ }
+
+ public Boolean getRemoveSignatureElements() {
+ return getConfiguration().getRemoveSignatureElements();
+ }
+
+ };
+ getConfiguration().getXmlSignature2Message().mapToMessage(refsAndObjects, out);
+ }
+
+ private Node getSignatureNode(Document doc) throws IOException,
+ ParserConfigurationException, XmlSignatureFormatException {
+
+ // Find Signature element
+ NodeList nl = doc.getElementsByTagNameNS(XMLSignature.XMLNS, "Signature");
+ if (nl.getLength() == 0) {
+ throw new XmlSignatureFormatException(
+ "Message is not a correct XML signature document: 'Signature' element is missing. Check the sent message.");
+ }
+
+ if (nl.getLength() != 1) {
+ throw new XmlSignatureFormatException(
+ "XML signature document is not supported; it contains more than one signature element. Check the sent message.");
+ }
+ Node signatureNode = nl.item(0);
+ LOG.debug("Signature element found");
+ return signatureNode;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected boolean handleSignatureValidationFailed(DOMValidateContext valContext,
+ XMLSignature signature) throws Exception {
+ ValidationFailedHandler handler = getConfiguration().getValidationFailedHandler();
+ LOG.debug("handleSignatureValidationFailed called");
+ try {
+ handler.start();
+
+ // first check signature value, see
+ // https://www.isecpartners.com/media/12012/XMLDSIG_Command_Injection.pdf
+ SignatureValue sigValue = signature.getSignatureValue();
+ boolean sv = sigValue.validate(valContext);
+ if (!sv) {
+ handler.signatureValueValidationFailed(sigValue);
+ }
+
+ // then the references!
+ // check the validation status of each Reference
+ for (Reference ref : (List<Reference>) signature.getSignedInfo().getReferences()) {
+ boolean refValid = ref.validate(valContext);
+ if (!refValid) {
+ handler.referenceValidationFailed(ref);
+ }
+ }
+
+ // validate Manifests, if property set
+ if (Boolean.TRUE.equals(valContext.getProperty("org.jcp.xml.dsig.validateManifests"))) {
+ for (XMLObject xo : (List<XMLObject>) signature.getObjects()) {
+ List<XMLStructure> content = xo.getContent();
+ for (XMLStructure xs : content) {
+ if (xs instanceof Manifest) {
+ Manifest man = (Manifest) xs;
+ for (Reference ref : (List<Reference>) man
+ .getReferences()) {
+ boolean refValid = ref.validate(valContext);
+ if (!refValid) {
+ handler.manifestReferenceValidationFailed(ref);
+ }
+ }
+ }
+ }
+ }
+ }
+ boolean goon = handler.ignoreCoreValidationFailure();
+ LOG.debug("Ignore Core Validation failure: {}", goon);
+ return goon;
+ } finally {
+ handler.end();
+ }
+
+ }
+
+ protected Document parseInput(InputStream is)
+ throws XmlSignatureFormatException, ParserConfigurationException,
+ IOException {
+ try {
+ Document doc =
+ XmlSignatureHelper.newDocumentBuilder(getConfiguration().getDisallowDoctypeDecl()).parse(is);
+ return doc;
+ } catch (SAXException e) {
+ throw new XmlSignatureFormatException(
+ "Message has wrong format, it is not a XML signature document. Check the sent message.",
+ e
+ );
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java
index ae94f21..2d81f61 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiJettyCamelContextsClassloaderTest.java
@@ -22,7 +22,8 @@ import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.swissbox.tinybundles.dp.Constants;
+
+import org.osgi.framework.Constants;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.OptionUtils.combine;
http://git-wip-us.apache.org/repos/asf/camel/blob/5359727a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java
----------------------------------------------------------------------
diff --git a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java
index 1c57437..81d1e12 100644
--- a/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java
+++ b/tests/camel-itest-osgi/src/test/java/org/apache/camel/itest/osgi/jetty/OSGiMulitJettyCamelContextsTest.java
@@ -23,7 +23,8 @@ import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;
-import org.ops4j.pax.swissbox.tinybundles.dp.Constants;
+
+import org.osgi.framework.Constants;
import static org.ops4j.pax.exam.CoreOptions.provision;
import static org.ops4j.pax.exam.OptionUtils.combine;