This is an automated email from the ASF dual-hosted git repository. lburgazzoli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-k-runtime.git
commit bcb74a2bf1a2057746aac25ddb45e555469d763f Author: lburgazzoli <lburgazz...@gmail.com> AuthorDate: Tue Jun 25 14:08:51 2019 +0200 checkstyle: fix camel-k-runtime-core violations --- .../java/org/apache/camel/k/ContextCustomizer.java | 2 +- .../src/main/java/org/apache/camel/k/Source.java | 15 ++++++------- .../camel/k/listener/AbstractPhaseListener.java | 2 -- .../apache/camel/k/support/PropertiesSupport.java | 17 +++++++-------- .../org/apache/camel/k/support/RuntimeSupport.java | 25 +++++++++++----------- .../org/apache/camel/k/support/URIResolver.java | 4 +++- .../apache/camel/k/support/RuntimeSupportTest.java | 4 ++-- 7 files changed, 33 insertions(+), 36 deletions(-) diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/ContextCustomizer.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/ContextCustomizer.java index bc74c65..e64b131 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/ContextCustomizer.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/ContextCustomizer.java @@ -20,7 +20,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.Ordered; @FunctionalInterface -public interface ContextCustomizer extends Ordered, Comparable<ContextCustomizer>{ +public interface ContextCustomizer extends Ordered, Comparable<ContextCustomizer> { /** * Perform CamelContext customization. * diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java index 354d5b4..6f34870 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/Source.java @@ -22,7 +22,7 @@ import org.apache.camel.util.ObjectHelper; import org.apache.camel.util.URISupport; import org.apache.commons.lang3.StringUtils; -public class Source { +public final class Source { private final String name; private final String location; private final String language; @@ -53,18 +53,17 @@ public class Source { @Override public String toString() { - return "Source{" + - "location='" + location + '\'' + - ", language=" + language + - ", compressed=" + compressed + - '}'; + return "Source{" + + "location='" + location + '\'' + + ", language=" + language + + " , compressed=" + compressed + + '}'; } public static Source create(String uri) throws Exception { final String location = StringUtils.substringBefore(uri, "?"); - if (!location.startsWith(Constants.SCHEME_CLASSPATH) && - !location.startsWith(Constants.SCHEME_FILE)) { + if (!location.startsWith(Constants.SCHEME_CLASSPATH) && !location.startsWith(Constants.SCHEME_FILE)) { throw new IllegalArgumentException("No valid resource format, expected scheme:path, found " + uri); } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/AbstractPhaseListener.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/AbstractPhaseListener.java index 43f7402..d39656b 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/AbstractPhaseListener.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/listener/AbstractPhaseListener.java @@ -17,8 +17,6 @@ package org.apache.camel.k.listener; import org.apache.camel.k.Runtime; -import org.apache.camel.CamelContext; -import org.apache.camel.k.ContextCustomizer; public abstract class AbstractPhaseListener implements Runtime.Listener { private final Runtime.Phase phase; diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java index 0380fe7..2bd59ca 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/PropertiesSupport.java @@ -59,18 +59,17 @@ public final class PropertiesSupport { .filter(entry -> entry.getValue() != null) .filter(entry -> ((String)entry.getKey()).startsWith(prefix)) .forEach(entry -> { - final String key = ((String)entry.getKey()).substring(prefix.length()); - final Object val = entry.getValue(); + final String key = ((String)entry.getKey()).substring(prefix.length()); + final Object val = entry.getValue(); - try { - if (PropertyBindingSupport.bindProperty(context, target, key, val)) { - count.incrementAndGet(); - } - } catch (Exception ex) { - throw new RuntimeException(ex); + try { + if (PropertyBindingSupport.bindProperty(context, target, key, val)) { + count.incrementAndGet(); } + } catch (Exception ex) { + throw new RuntimeException(ex); } - ); + }); return count.get(); } diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java index 334409b..8f9a6b4 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/RuntimeSupport.java @@ -91,21 +91,20 @@ public final class RuntimeSupport { .filter(entry -> entry.getKey() instanceof String) .filter(entry -> entry.getValue() != null) .forEach(entry -> { - final String key = (String)entry.getKey(); - final Object val = entry.getValue(); - final Matcher matcher = pattern.matcher(key); - - if (matcher.matches() && matcher.groupCount() == 1) { - if (Boolean.valueOf(String.valueOf(val))) { - // - // Do not override customizers eventually found - // in the registry - // - customizers.computeIfAbsent(matcher.group(1), id -> lookupCustomizerByID(context, id)); - } + final String key = (String)entry.getKey(); + final Object val = entry.getValue(); + final Matcher matcher = pattern.matcher(key); + + if (matcher.matches() && matcher.groupCount() == 1) { + if (Boolean.valueOf(String.valueOf(val))) { + // + // Do not override customizers eventually found + // in the registry + // + customizers.computeIfAbsent(matcher.group(1), id -> lookupCustomizerByID(context, id)); } } - ); + }); } return customizers; diff --git a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java index 39f097b..c67c981 100644 --- a/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java +++ b/camel-k-runtime-core/src/main/java/org/apache/camel/k/support/URIResolver.java @@ -26,7 +26,9 @@ import org.apache.camel.spi.ClassResolver; import org.apache.camel.support.ResourceHelper; -public class URIResolver { +public final class URIResolver { + private URIResolver() { + } public static InputStream resolve(CamelContext ctx, Source source) throws Exception { if (source.getLocation() == null) { diff --git a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java index b5f4310..ace7e8f 100644 --- a/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java +++ b/camel-k-runtime-core/src/test/java/org/apache/camel/k/support/RuntimeSupportTest.java @@ -16,8 +16,6 @@ */ package org.apache.camel.k.support; -import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import java.util.Properties; @@ -30,6 +28,8 @@ import org.apache.camel.k.Constants; import org.apache.camel.k.ContextCustomizer; import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; + public class RuntimeSupportTest { @Test