CAMEL-7487 Fixed the CS errors of camel-core
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a7cd3b78 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a7cd3b78 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a7cd3b78 Branch: refs/heads/master Commit: a7cd3b78fd0406b87d2e415b71988f17f4e7aa95 Parents: ef4d0a7 Author: Willem Jiang <[email protected]> Authored: Tue Jun 17 10:08:46 2014 +0800 Committer: Willem Jiang <[email protected]> Committed: Wed Jun 18 14:56:15 2014 +0800 ---------------------------------------------------------------------- .../camel/util/component/ApiMethodHelper.java | 16 ++++++++-------- .../camel/util/component/ApiMethodParser.java | 6 +++--- .../util/component/ApiMethodPropertiesHelper.java | 8 ++++---- .../util/component/ArgumentSubstitutionParser.java | 16 ++++++++++++++++ .../camel/util/component/ApiMethodHelperTest.java | 2 +- .../component/ApiMethodPropertiesHelperTest.java | 2 +- .../component/ArgumentSubstitutionParserTest.java | 16 ++++++++++++++++ 7 files changed, 49 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/a7cd3b78/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodHelper.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodHelper.java b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodHelper.java index 27ba116..b4401eb 100644 --- a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodHelper.java @@ -51,7 +51,7 @@ public final class ApiMethodHelper<T extends Enum<T> & ApiMethod> { private final Map<String, Class<?>> validArguments = new HashMap<String, Class<?>>(); // maps aliases to actual method names - private final HashMap<String, Set<String>> aliases = new HashMap<String, Set<String>>(); + private final HashMap<String, Set<String>> aliasesMap = new HashMap<String, Set<String>>(); /** * Create a helper to work with a {@link ApiMethod}, using optional method aliases. @@ -95,10 +95,10 @@ public final class ApiMethodHelper<T extends Enum<T> & ApiMethod> { builder.append(Character.toLowerCase(firstChar)).append(alias.substring(1)); alias = builder.toString(); } - Set<String> names = this.aliases.get(alias); + Set<String> names = aliasesMap.get(alias); if (names == null) { names = new HashSet<String>(); - this.aliases.put(alias, names); + aliasesMap.put(alias, names); } names.add(name); } @@ -158,9 +158,9 @@ public final class ApiMethodHelper<T extends Enum<T> & ApiMethod> { public List<ApiMethod> getCandidateMethods(String name, String... argNames) { List<T> methods = methodMap.get(name); if (methods == null) { - if (aliases.containsKey(name)) { + if (aliasesMap.containsKey(name)) { methods = new ArrayList<T>(); - for (String method : aliases.get(name)) { + for (String method : aliasesMap.get(name)) { methods.addAll(methodMap.get(method)); } } @@ -241,9 +241,9 @@ public final class ApiMethodHelper<T extends Enum<T> & ApiMethod> { public List<Object> getArguments(final String name) throws IllegalArgumentException { List<Object> arguments = argumentsMap.get(name); if (arguments == null) { - if (aliases.containsKey(name)) { + if (aliasesMap.containsKey(name)) { arguments = new ArrayList<Object>(); - for (String method : aliases.get(name)) { + for (String method : aliasesMap.get(name)) { arguments.addAll(argumentsMap.get(method)); } } @@ -279,7 +279,7 @@ public final class ApiMethodHelper<T extends Enum<T> & ApiMethod> { * @return alias names mapped to method names. */ public Map<String, Set<String>> getAliases() { - return Collections.unmodifiableMap(aliases); + return Collections.unmodifiableMap(aliasesMap); } /** http://git-wip-us.apache.org/repos/asf/camel/blob/a7cd3b78/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java index 1003df4..03c9124 100644 --- a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java +++ b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodParser.java @@ -138,9 +138,9 @@ public abstract class ApiMethodParser<T> { allArguments.put(name, type); } else { if (argClass != type) { - throw new IllegalArgumentException("Argument [" + name + - "] is used in multiple methods with different types " + - argClass.getCanonicalName() + ", " + type.getCanonicalName()); + throw new IllegalArgumentException("Argument [" + name + + "] is used in multiple methods with different types " + + argClass.getCanonicalName() + ", " + type.getCanonicalName()); } } } http://git-wip-us.apache.org/repos/asf/camel/blob/a7cd3b78/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodPropertiesHelper.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodPropertiesHelper.java b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodPropertiesHelper.java index 4cd692c..e5e9441 100644 --- a/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodPropertiesHelper.java +++ b/camel-core/src/main/java/org/apache/camel/util/component/ApiMethodPropertiesHelper.java @@ -33,10 +33,10 @@ import org.slf4j.LoggerFactory; */ public abstract class ApiMethodPropertiesHelper<C> { - protected Logger LOG = LoggerFactory.getLogger(ApiMethodPropertiesHelper.class); + protected static final Logger LOG = LoggerFactory.getLogger(ApiMethodPropertiesHelper.class); // set of field names which are specific to the api, to be excluded from method argument considerations - protected final Set<String> COMPONENT_CONFIG_FIELDS = new HashSet<String>(); + protected final Set<String> componentConfigFields = new HashSet<String>(); protected final Class<?> componentConfigClass; protected final String propertyPrefix; @@ -47,7 +47,7 @@ public abstract class ApiMethodPropertiesHelper<C> { this.propertyPrefix = propertyPrefix; for (Field field : componentConfiguration.getDeclaredFields()) { - COMPONENT_CONFIG_FIELDS.add(field.getName()); + componentConfigFields.add(field.getName()); } } @@ -77,7 +77,7 @@ public abstract class ApiMethodPropertiesHelper<C> { if (IntrospectionSupport.getProperties(endpointConfiguration, properties, null, false)) { final Set<String> names = properties.keySet(); // remove component config properties so we only have endpoint properties - names.removeAll(COMPONENT_CONFIG_FIELDS); + names.removeAll(componentConfigFields); } if (LOG.isDebugEnabled()) { final Set<String> names = properties.keySet(); http://git-wip-us.apache.org/repos/asf/camel/blob/a7cd3b78/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java ---------------------------------------------------------------------- diff --git a/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java b/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java index 2544dff..d9686e9 100644 --- a/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.java +++ b/camel-core/src/main/java/org/apache/camel/util/component/ArgumentSubstitutionParser.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.util.component; import java.util.ArrayList; http://git-wip-us.apache.org/repos/asf/camel/blob/a7cd3b78/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java index 1fb84b7..601b671 100644 --- a/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java +++ b/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodHelperTest.java @@ -28,7 +28,7 @@ import static org.junit.Assert.assertEquals; public class ApiMethodHelperTest { - private static TestMethod[] sayHis = new TestMethod[] { TestMethod.SAYHI, TestMethod.SAYHI_1}; + private static TestMethod[] sayHis = new TestMethod[] {TestMethod.SAYHI, TestMethod.SAYHI_1}; private static ApiMethodHelper<TestMethod> apiMethodHelper; static { http://git-wip-us.apache.org/repos/asf/camel/blob/a7cd3b78/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodPropertiesHelperTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodPropertiesHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodPropertiesHelperTest.java index 65b7538..9a78421 100644 --- a/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodPropertiesHelperTest.java +++ b/camel-core/src/test/java/org/apache/camel/util/component/ApiMethodPropertiesHelperTest.java @@ -38,7 +38,7 @@ public class ApiMethodPropertiesHelperTest { private static final String VALUE_4 = "true"; private static ApiMethodPropertiesHelper propertiesHelper = - new ApiMethodPropertiesHelper<TestComponentConfiguration>(TestComponentConfiguration.class, TEST_PREFIX){}; + new ApiMethodPropertiesHelper<TestComponentConfiguration>(TestComponentConfiguration.class, TEST_PREFIX) { }; @Test public void testGetExchangeProperties() throws Exception { http://git-wip-us.apache.org/repos/asf/camel/blob/a7cd3b78/camel-core/src/test/java/org/apache/camel/util/component/ArgumentSubstitutionParserTest.java ---------------------------------------------------------------------- diff --git a/camel-core/src/test/java/org/apache/camel/util/component/ArgumentSubstitutionParserTest.java b/camel-core/src/test/java/org/apache/camel/util/component/ArgumentSubstitutionParserTest.java index a9487c0..6f095b4 100644 --- a/camel-core/src/test/java/org/apache/camel/util/component/ArgumentSubstitutionParserTest.java +++ b/camel-core/src/test/java/org/apache/camel/util/component/ArgumentSubstitutionParserTest.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.util.component; import java.util.ArrayList;
