You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2022/10/13 15:53:48 UTC

[camel] branch main updated (bec70630184 -> d2b43a44c60)

This is an automated email from the ASF dual-hosted git repository.

orpiske pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


    from bec70630184 (chores) camel-avro-rpc: avoid shadowing variables
     new a149d9d2031 (chores) camel-xpath: avoid shadowing variables
     new d2b43a44c60 (chores) camel-base: avoid shadowing variables

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../apache/camel/language/xpath/XPathBuilder.java    | 17 ++++++++---------
 .../component/properties/PropertiesComponent.java    | 20 ++++++++++----------
 2 files changed, 18 insertions(+), 19 deletions(-)


[camel] 01/02: (chores) camel-xpath: avoid shadowing variables

Posted by or...@apache.org.
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 a149d9d20311ed390f6d4bc59013e9a9567c82d9
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Oct 13 14:45:48 2022 +0200

    (chores) camel-xpath: avoid shadowing variables
---
 .../org/apache/camel/language/xpath/XPathBuilder.java   | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
index cea74e57d03..846ae337d49 100644
--- a/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
+++ b/components/camel-xpath/src/main/java/org/apache/camel/language/xpath/XPathBuilder.java
@@ -659,8 +659,8 @@ public class XPathBuilder extends ServiceSupport
                 if (!list.isEmpty()) {
                     Object value = list.get(0);
                     if (value != null) {
-                        String text = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
-                        return exchange.get().getIn().getHeader(text);
+                        String headerText = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
+                        return exchange.get().getIn().getHeader(headerText);
                     }
                 }
                 return null;
@@ -719,8 +719,8 @@ public class XPathBuilder extends ServiceSupport
                 if (exchange.get() != null && !list.isEmpty()) {
                     Object value = list.get(0);
                     if (value != null) {
-                        String text = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
-                        return exchange.get().getOut().getHeader(text);
+                        String headerText = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
+                        return exchange.get().getOut().getHeader(headerText);
                     }
                 }
                 return null;
@@ -751,11 +751,11 @@ public class XPathBuilder extends ServiceSupport
                 if (!list.isEmpty()) {
                     Object value = list.get(0);
                     if (value != null) {
-                        String text = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
+                        String propertyText = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
                         try {
                             // use the property placeholder resolver to lookup
                             // the property for us
-                            Object answer = exchange.get().getContext().resolvePropertyPlaceholders("{{" + text + "}}");
+                            Object answer = exchange.get().getContext().resolvePropertyPlaceholders("{{" + propertyText + "}}");
                             return answer;
                         } catch (Exception e) {
                             throw new XPathFunctionException(e);
@@ -791,9 +791,9 @@ public class XPathBuilder extends ServiceSupport
                 if (!list.isEmpty()) {
                     Object value = list.get(0);
                     if (value != null) {
-                        String text = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
+                        String exprText = exchange.get().getContext().getTypeConverter().convertTo(String.class, value);
                         Language simple = exchange.get().getContext().resolveLanguage("simple");
-                        Expression exp = simple.createExpression(text);
+                        Expression exp = simple.createExpression(exprText);
                         Object answer = exp.evaluate(exchange.get(), Object.class);
                         return answer;
                     }
@@ -1012,7 +1012,6 @@ public class XPathBuilder extends ServiceSupport
 
             // Check if we need to apply the XPath expression to a header
             if (ObjectHelper.isNotEmpty(getHeaderName())) {
-                String headerName = getHeaderName();
                 // only convert to input stream if really needed
                 if (isInputStreamNeeded(exchange, headerName)) {
                     is = exchange.getIn().getHeader(headerName, InputStream.class);


[camel] 02/02: (chores) camel-base: avoid shadowing variables

Posted by or...@apache.org.
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 d2b43a44c60cb1430c64f8bb8113821223b6e93e
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Oct 13 14:51:18 2022 +0200

    (chores) camel-base: avoid shadowing variables
---
 .../component/properties/PropertiesComponent.java    | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java b/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
index 47737b59e11..f2ea6628935 100644
--- a/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
+++ b/core/camel-base/src/main/java/org/apache/camel/component/properties/PropertiesComponent.java
@@ -359,14 +359,14 @@ public class PropertiesComponent extends ServiceSupport
      * locations from this option.
      */
     public void setLocations(String[] locationStrings) {
-        List<PropertiesLocation> locations = new ArrayList<>();
+        List<PropertiesLocation> propertiesLocations = new ArrayList<>();
         if (locationStrings != null) {
             for (String locationString : locationStrings) {
-                locations.add(new PropertiesLocation(locationString));
+                propertiesLocations.add(new PropertiesLocation(locationString));
             }
         }
 
-        setLocations(locations);
+        setLocations(propertiesLocations);
     }
 
     public void addLocation(PropertiesLocation location) {
@@ -794,23 +794,23 @@ public class PropertiesComponent extends ServiceSupport
     private List<PropertiesLocation> parseLocations(List<PropertiesLocation> locations) {
         List<PropertiesLocation> answer = new ArrayList<>();
 
-        for (PropertiesLocation location : locations) {
-            LOG.trace("Parsing location: {}", location);
+        for (PropertiesLocation propertiesLocation : locations) {
+            LOG.trace("Parsing location: {}", propertiesLocation);
 
             try {
-                String path = FilePathResolver.resolvePath(location.getPath());
+                String path = FilePathResolver.resolvePath(propertiesLocation.getPath());
                 LOG.debug("Parsed location: {}", path);
                 if (ObjectHelper.isNotEmpty(path)) {
                     answer.add(new PropertiesLocation(
-                            location.getResolver(),
+                            propertiesLocation.getResolver(),
                             path,
-                            location.isOptional()));
+                            propertiesLocation.isOptional()));
                 }
             } catch (IllegalArgumentException e) {
-                if (!ignoreMissingLocation && !location.isOptional()) {
+                if (!ignoreMissingLocation && !propertiesLocation.isOptional()) {
                     throw e;
                 } else {
-                    LOG.debug("Ignored missing location: {}", location);
+                    LOG.debug("Ignored missing location: {}", propertiesLocation);
                 }
             }
         }