You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2014/12/19 19:46:33 UTC

camel git commit: Fix the checkstyle issues in the jetty9 code

Repository: camel
Updated Branches:
  refs/heads/temp-jetty9 ea4d82462 -> 41e3c0db4


Fix the checkstyle issues in the jetty9 code


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/41e3c0db
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/41e3c0db
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/41e3c0db

Branch: refs/heads/temp-jetty9
Commit: 41e3c0db40e051eccbd501feb839cf6423fb4d0c
Parents: ea4d824
Author: Daniel Kulp <dk...@apache.org>
Authored: Fri Dec 19 13:44:48 2014 -0500
Committer: Daniel Kulp <dk...@apache.org>
Committed: Fri Dec 19 13:44:48 2014 -0500

----------------------------------------------------------------------
 .../component/jetty/DefaultJettyHttpBinding.java    |  2 +-
 .../camel/component/jetty/JettyHttpComponent.java   | 16 ++++++++--------
 .../camel/component/jetty8/CamelHttpClient8.java    | 16 ++++++++++++++++
 .../camel/component/jetty8/JettyHttpComponent8.java | 16 ++++++++++++++++
 .../component/jetty9/JettyContentExchange9.java     | 12 ++++++------
 .../camel/component/jetty9/JettyHttpComponent9.java | 16 ++++++++++++++++
 .../component/jetty/JettyHttpContentTypeTest.java   | 11 +++++++----
 .../org/apache/camel/test/junit4/TestSupport.java   | 10 +++++-----
 8 files changed, 75 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
index 77328f5..73684d8 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/DefaultJettyHttpBinding.java
@@ -186,7 +186,7 @@ public class DefaultJettyHttpBinding implements JettyHttpBinding {
     }
 
     Map<String, String> getSimpleMap(Map<String, Collection<String>> headers) {
-        Map<String, String> result = new HashMap<String ,String>();
+        Map<String, String> result = new HashMap<String, String>();
         for (String key : headers.keySet()) {
             Collection<String> valueCol = headers.get(key);
             String value = (valueCol == null) ? null : valueCol.iterator().next();

http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
index fd98e43..5e72d76 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java
@@ -528,12 +528,12 @@ public abstract class JettyHttpComponent extends HttpComponent implements RestCo
         if (sslSocketConnectors != null) {
             SslContextFactory con = sslSocketConnectors.get(endpoint.getPort());
             if (con != null) {
-                    SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(con, null);
-                    @SuppressWarnings("resource")
-                    ServerConnector sc = new ServerConnector(server, sslConnectionFactory);
-                    sc.setPort(endpoint.getPort());
-                    sc.setHost(endpoint.getHttpUri().getHost());
-                    answer = sc;
+                SslConnectionFactory sslConnectionFactory = new SslConnectionFactory(con, null);
+                @SuppressWarnings("resource")
+                ServerConnector sc = new ServerConnector(server, sslConnectionFactory);
+                sc.setPort(endpoint.getPort());
+                sc.setHost(endpoint.getHttpUri().getHost());
+                answer = sc;
             }
         }
         if (answer == null) {
@@ -631,7 +631,7 @@ public abstract class JettyHttpComponent extends HttpComponent implements RestCo
             httpConfig.setSendDateHeader(endpoint.isSendDateHeader());
             
             if (requestBufferSize != null) {
-            	// Does not work
+                // Does not work
                 //httpConfig.setRequestBufferSize(requestBufferSize);
             }
             if (requestHeaderSize != null) {
@@ -658,7 +658,7 @@ public abstract class JettyHttpComponent extends HttpComponent implements RestCo
             result.setConnectionFactories(connectionFactories);
             result.setPort(porto);
             if (hosto != null) {
-            	result.setHost(hosto);
+                result.setHost(hosto);
             }
             /*
             if (getSocketConnectorProperties() != null && !"https".equals(endpoint.getProtocol())) {

http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/CamelHttpClient8.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/CamelHttpClient8.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/CamelHttpClient8.java
index 5845be0..bb00fe0 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/CamelHttpClient8.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/CamelHttpClient8.java
@@ -1,3 +1,19 @@
+/**
+ * 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.jetty8;
 
 import java.util.concurrent.Executor;

http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/JettyHttpComponent8.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/JettyHttpComponent8.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/JettyHttpComponent8.java
index d1d49c0..f228540 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/JettyHttpComponent8.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty8/JettyHttpComponent8.java
@@ -1,3 +1,19 @@
+/**
+ * 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.jetty8;
 
 import org.apache.camel.component.jetty.CamelHttpClient;

http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
index e4bcf2f..8c881d8 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyContentExchange9.java
@@ -102,7 +102,7 @@ public class JettyContentExchange9 implements JettyContentExchange {
         } catch (Exception e) {
             exchange.setException(e);
         } finally {
-        	callback.done(false);
+            callback.done(false);
         }
     }
 
@@ -145,7 +145,7 @@ public class JettyContentExchange9 implements JettyContentExchange {
         try {
             return this.request.getURI().toURL().toExternalForm();
         } catch (MalformedURLException e) {
-                throw new IllegalStateException(e.getMessage(), e);
+            throw new IllegalStateException(e.getMessage(), e);
         }
     }
     
@@ -202,7 +202,7 @@ public class JettyContentExchange9 implements JettyContentExchange {
      * @see org.apache.camel.component.jetty.JettyContentExchangeI#setTimeout(long)
      */
     public void setTimeout(long timeout) {
-    	this.request.timeout(timeout, TimeUnit.MILLISECONDS);
+        this.request.timeout(timeout, TimeUnit.MILLISECONDS);
     }
     
     /* (non-Javadoc)
@@ -216,15 +216,15 @@ public class JettyContentExchange9 implements JettyContentExchange {
      * @see org.apache.camel.component.jetty.JettyContentExchangeI#setRequestContent(byte[])
      */
     public void setRequestContent(byte[] byteArray) {
-    	this.request.content(new BytesContentProvider(byteArray), this.requestContentType);
+        this.request.content(new BytesContentProvider(byteArray), this.requestContentType);
     }
 
     /* (non-Javadoc)
      * @see org.apache.camel.component.jetty.JettyContentExchangeI#setRequestContent(java.lang.String, java.lang.String)
      */
     public void setRequestContent(String data, String charset) throws UnsupportedEncodingException {
-    	StringContentProvider cp = charset != null ? new StringContentProvider(data, charset) : new StringContentProvider(data);
-    	this.request.content(cp, this.requestContentType);
+        StringContentProvider cp = charset != null ? new StringContentProvider(data, charset) : new StringContentProvider(data);
+        this.request.content(cp, this.requestContentType);
     }
     /* (non-Javadoc)
      * @see org.apache.camel.component.jetty.JettyContentExchangeI#setRequestContent(java.io.InputStream)

http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
index fc6bb15..23c8160 100644
--- a/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
+++ b/components/camel-jetty/src/main/java/org/apache/camel/component/jetty9/JettyHttpComponent9.java
@@ -1,3 +1,19 @@
+/**
+ * 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.jetty9;
 
 import org.apache.camel.component.jetty.CamelHttpClient;

http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
----------------------------------------------------------------------
diff --git a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
index c0cfb2b..21cb0b2 100644
--- a/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
+++ b/components/camel-jetty/src/test/java/org/apache/camel/component/jetty/JettyHttpContentTypeTest.java
@@ -30,9 +30,11 @@ public class JettyHttpContentTypeTest extends BaseJettyTest {
     @Test
     public void testContentType() throws Exception {
         getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
-        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE, "text/plain; charset=\"" + CHARSET +"\"");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE,
+                                                             "text/plain; charset=\"" + CHARSET + "\"");
         getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING, CHARSET);
-        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, "http://0.0.0.0:" + getPort() + "/foo");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL,
+                                                             "http://0.0.0.0:" + getPort() + "/foo");
         getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, CHARSET);
 
         byte[] data = "Hello World".getBytes(Charset.forName(CHARSET));
@@ -49,14 +51,15 @@ public class JettyHttpContentTypeTest extends BaseJettyTest {
     @Test
     public void testContentTypeWithAction() throws Exception {
         getMockEndpoint("mock:input").expectedBodiesReceived("Hello World");
-        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE, "text/plain;charset=\""+ CHARSET + "\";action=\"http://somewhere.com/foo\"");
+        getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.CONTENT_TYPE,
+                                                             "text/plain;charset=\"" + CHARSET + "\";action=\"http://somewhere.com/foo\"");
         getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_CHARACTER_ENCODING, CHARSET);
         getMockEndpoint("mock:input").expectedHeaderReceived(Exchange.HTTP_URL, "http://0.0.0.0:" + getPort() + "/foo");
         getMockEndpoint("mock:input").expectedPropertyReceived(Exchange.CHARSET_NAME, CHARSET);
 
         byte[] data = "Hello World".getBytes(Charset.forName(CHARSET));
         String out = template.requestBodyAndHeader("jetty:http://0.0.0.0:{{port}}/foo", data,
-                "content-type", "text/plain;charset=\""+ CHARSET + "\";action=\"http://somewhere.com/foo\"", String.class);
+                "content-type", "text/plain;charset=\"" + CHARSET + "\";action=\"http://somewhere.com/foo\"", String.class);
         assertEquals("Bye World", out);
 
         assertMockEndpointsSatisfied();

http://git-wip-us.apache.org/repos/asf/camel/blob/41e3c0db/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
index f086c82..0df328a 100644
--- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
+++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java
@@ -149,11 +149,11 @@ public abstract class TestSupport extends Assert {
     }
     
     public static <T extends Throwable> T assertThrowable(Class<T> expectedType, Throwable t) {
-    	assertNotNull("Expected an exinstance of type: " + expectedType.getName() + " but was null", t);
-    	if (!expectedType.isInstance(t)) {
-    		throw new AssertionError("Unexpected throwable", t);
-    	}
-    	return expectedType.cast(t);
+        assertNotNull("Expected an exinstance of type: " + expectedType.getName() + " but was null", t);
+        if (!expectedType.isInstance(t)) {
+            throw new AssertionError("Unexpected throwable", t);
+        }
+        return expectedType.cast(t);
     }
 
     public static void assertEndpointUri(Endpoint endpoint, String uri) {