jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 02/07: Remove useless assignment of variable
Date Sat, 28 Sep 2019 19:30:14 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit cbf8eb4e0df08ed35d2f53902927a0d4ee4a8e6b
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Sat Sep 28 21:06:58 2019 +0200

    Remove useless assignment of variable
    
    In the case of a single element, the variable i was always 0. Make that
    explicit. Now we can narrow the scope of the variable i closer to the
    for loop.
---
 .../apache/jmeter/extractor/json/render/RenderAsJmesPathRenderer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/src/main/java/org/apache/jmeter/extractor/json/render/RenderAsJmesPathRenderer.java
b/src/components/src/main/java/org/apache/jmeter/extractor/json/render/RenderAsJmesPathRenderer.java
index e4a9004..1b05b7d 100644
--- a/src/components/src/main/java/org/apache/jmeter/extractor/json/render/RenderAsJmesPathRenderer.java
+++ b/src/components/src/main/java/org/apache/jmeter/extractor/json/render/RenderAsJmesPathRenderer.java
@@ -61,13 +61,13 @@ public class RenderAsJmesPathRenderer extends AbstractRenderAsJsonRenderer
{
                 return NO_MATCH; //$NON-NLS-1$
             } else {
                 StringBuilder builder = new StringBuilder();
-                int i = 0;
                 if (result.isArray()) {
+                    int i = 0;
                     for (JsonNode element : (ArrayNode) result) {
                         builder.append("Result[").append(i++).append("]=").append(writeJsonNode(OBJECT_MAPPER,
element)).append("\n");
                     }
                 } else {
-                    builder.append("Result[").append(i++).append("]=").append(writeJsonNode(OBJECT_MAPPER,
result)).append("\n");
+                    builder.append("Result[").append(0).append("]=").append(writeJsonNode(OBJECT_MAPPER,
result)).append("\n");
                 }
                 return builder.toString();
             }


Mime
View raw message