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 8ac4b1edb02f32679a9608cda4f4ac11ecf27845 Author: Otavio Rodolfo Piske <angusyo...@gmail.com> AuthorDate: Mon Mar 7 15:51:58 2022 +0100 CAMEL-15520: fixed deprecated usage of HttpOperationFailedException in camel-http, camel-jetty-common, camel-netty-http and camel-undertow compoonents --- .../http/common/HttpOperationFailedException.java | 31 ---------------------- .../common/HttpOperationFailedExceptionTest.java | 1 + .../camel/component/http/HttpPollingConsumer.java | 2 +- .../apache/camel/component/http/HttpProducer.java | 2 +- .../camel/component/http/HeaderFilteringTest.java | 2 +- .../component/http/HttpDefaultPortNumberTest.java | 2 +- .../camel/component/http/HttpRedirectTest.java | 2 +- .../camel/component/http/HttpSNIHostNameTest.java | 2 +- .../http/HttpThrowExceptionOnFailureTest.java | 2 +- .../camel/component/jetty/JettyHttpBinding.java | 4 +-- .../http/rest/RestNettyMethodNotAllowedTest.java | 2 +- .../undertow/UndertowPrefixMatchingTest.java | 2 +- .../rest/RestUndertowMethodNotAllowedTest.java | 2 +- 13 files changed, 13 insertions(+), 43 deletions(-) diff --git a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpOperationFailedException.java b/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpOperationFailedException.java deleted file mode 100644 index cb754a6..0000000 --- a/components/camel-http-common/src/main/java/org/apache/camel/http/common/HttpOperationFailedException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.http.common; - -import java.util.Map; - -/** - * @deprecated use org.apache.camel.http.base.HttpOperationFailedException - */ -@Deprecated -public class HttpOperationFailedException extends org.apache.camel.http.base.HttpOperationFailedException { - - public HttpOperationFailedException(String uri, int statusCode, String statusText, String location, - Map<String, String> responseHeaders, String responseBody) { - super(uri, statusCode, statusText, location, responseHeaders, responseBody); - } -} diff --git a/components/camel-http-common/src/test/java/org/apache/camel/http/common/HttpOperationFailedExceptionTest.java b/components/camel-http-common/src/test/java/org/apache/camel/http/common/HttpOperationFailedExceptionTest.java index 1c014aa..cfcc2ab 100644 --- a/components/camel-http-common/src/test/java/org/apache/camel/http/common/HttpOperationFailedExceptionTest.java +++ b/components/camel-http-common/src/test/java/org/apache/camel/http/common/HttpOperationFailedExceptionTest.java @@ -16,6 +16,7 @@ */ package org.apache.camel.http.common; +import org.apache.camel.http.base.HttpOperationFailedException; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertFalse; diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java index 4359d8d..d86f6d3 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpPollingConsumer.java @@ -91,7 +91,7 @@ public class HttpPollingConsumer extends PollingConsumerSupport { Object body = HttpHelper.cacheResponseBodyFromInputStream(responseEntity.getContent(), exchange); // lets store the result in the output message. - Message message = exchange.getOut(); + Message message = exchange.getMessage(); message.setBody(body); // lets set the headers diff --git a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java index b6dabfa..b5fb2b2 100644 --- a/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java +++ b/components/camel-http/src/main/java/org/apache/camel/component/http/HttpProducer.java @@ -43,8 +43,8 @@ import org.apache.camel.TypeConverter; import org.apache.camel.component.file.GenericFile; import org.apache.camel.component.http.helper.HttpMethodHelper; import org.apache.camel.converter.stream.CachedOutputStream; +import org.apache.camel.http.base.HttpOperationFailedException; import org.apache.camel.http.common.HttpHelper; -import org.apache.camel.http.common.HttpOperationFailedException; import org.apache.camel.http.common.HttpProtocolHeaderFilterStrategy; import org.apache.camel.spi.HeaderFilterStrategy; import org.apache.camel.support.DefaultProducer; diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HeaderFilteringTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HeaderFilteringTest.java index d190653..195aecd 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HeaderFilteringTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HeaderFilteringTest.java @@ -29,7 +29,7 @@ import java.util.Collections; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpServer; import org.apache.camel.Producer; -import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.http.base.HttpOperationFailedException; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.spi.RestConfiguration; import org.apache.camel.support.DefaultExchange; diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpDefaultPortNumberTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpDefaultPortNumberTest.java index 49a10ef..6c5a5a7 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpDefaultPortNumberTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpDefaultPortNumberTest.java @@ -146,7 +146,7 @@ public class HttpDefaultPortNumberTest extends BaseHttpTest { } private void assertRefused(Exchange exchange, String portExt) { - Map<String, Object> headers = exchange.getOut().getHeaders(); + Map<String, Object> headers = exchange.getMessage().getHeaders(); //no http response: assertNull(headers.get(Exchange.HTTP_RESPONSE_CODE)); //and got an exception: diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRedirectTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRedirectTest.java index d4dcd32..71e5ab4 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRedirectTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpRedirectTest.java @@ -20,7 +20,7 @@ import java.io.IOException; import org.apache.camel.Exchange; import org.apache.camel.component.http.handler.BasicValidationHandler; -import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.http.base.HttpOperationFailedException; import org.apache.http.HttpException; import org.apache.http.HttpRequest; import org.apache.http.HttpResponse; diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSNIHostNameTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSNIHostNameTest.java index 72797a0..8bfb32d 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSNIHostNameTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpSNIHostNameTest.java @@ -17,7 +17,7 @@ package org.apache.camel.component.http; import org.apache.camel.CamelExecutionException; -import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.http.base.HttpOperationFailedException; import org.apache.camel.test.spring.junit5.CamelSpringTestSupport; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpThrowExceptionOnFailureTest.java b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpThrowExceptionOnFailureTest.java index 120e021..1dcd41f 100644 --- a/components/camel-http/src/test/java/org/apache/camel/component/http/HttpThrowExceptionOnFailureTest.java +++ b/components/camel-http/src/test/java/org/apache/camel/component/http/HttpThrowExceptionOnFailureTest.java @@ -21,7 +21,7 @@ import java.util.Map; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.component.http.handler.BasicValidationHandler; -import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.http.base.HttpOperationFailedException; import org.apache.http.HttpStatus; import org.apache.http.impl.bootstrap.HttpServer; import org.apache.http.impl.bootstrap.ServerBootstrap; diff --git a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java index a5516f6..097c79f 100644 --- a/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java +++ b/components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpBinding.java @@ -50,7 +50,7 @@ public interface JettyHttpBinding { void setHeaderFilterStrategy(HeaderFilterStrategy headerFilterStrategy); /** - * Whether to throw {@link org.apache.camel.http.common.HttpOperationFailedException} in case of response code != + * Whether to throw {@link org.apache.camel.http.base.HttpOperationFailedException} in case of response code != * 200. * * @param throwExceptionOnFailure <tt>true</tt> to throw exception @@ -58,7 +58,7 @@ public interface JettyHttpBinding { void setThrowExceptionOnFailure(boolean throwExceptionOnFailure); /** - * Whether to throw {@link org.apache.camel.http.common.HttpOperationFailedException} in case of response code != + * Whether to throw {@link org.apache.camel.http.base.HttpOperationFailedException} in case of response code != * 200. * * @return <tt>true</tt> to throw exception diff --git a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyMethodNotAllowedTest.java b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyMethodNotAllowedTest.java index dbca4bb..a5140bb 100644 --- a/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyMethodNotAllowedTest.java +++ b/components/camel-netty-http/src/test/java/org/apache/camel/component/netty/http/rest/RestNettyMethodNotAllowedTest.java @@ -19,7 +19,7 @@ package org.apache.camel.component.netty.http.rest; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.netty.http.BaseNettyTest; -import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.http.base.HttpOperationFailedException; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java index b99d66d..de88316 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowPrefixMatchingTest.java @@ -19,7 +19,7 @@ package org.apache.camel.component.undertow; import org.apache.camel.CamelExecutionException; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.http.base.HttpOperationFailedException; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf; diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowMethodNotAllowedTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowMethodNotAllowedTest.java index dfc57fd..75271b8 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowMethodNotAllowedTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowMethodNotAllowedTest.java @@ -19,7 +19,7 @@ package org.apache.camel.component.undertow.rest; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.undertow.BaseUndertowTest; -import org.apache.camel.http.common.HttpOperationFailedException; +import org.apache.camel.http.base.HttpOperationFailedException; import org.junit.jupiter.api.Test; import static org.apache.camel.test.junit5.TestSupport.assertIsInstanceOf;