changeset 831:598bb5f76f4f

bugfix
author Devel 1
date Fri, 19 Jan 2018 13:32:18 +0100
parents 611ffdc69f04
children 879035bd33f3
files stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTransformer.java
diffstat 1 files changed, 23 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTransformer.java	Fri Jan 19 12:44:39 2018 +0100
+++ b/stress-tester/src/main/java/com/passus/st/client/http/filter/HttpMessageModificationFilterTransformer.java	Fri Jan 19 13:32:18 2018 +0100
@@ -99,6 +99,8 @@
         AddParamOperation op = null;
         if (validateType(nodeTuple.getNode(), NodeType.MAP, errors)) {
             List<CTupleNode> tuples = ((CMapNode) nodeTuple.getNode()).getChildren();
+            String paramName = null;
+            Object value = null;
             boolean escape = true;
             for (CTupleNode tuple : tuples) {
                 String name = tuple.getName().toLowerCase();
@@ -107,31 +109,21 @@
                         escape = ConfigurationUtils.extractBoolean(tuple, errors);
                         break;
                     default:
-                        try {
-                            CNode valNode = tuple.getNode();
-                            Object value = null;
-                            if (valNode.getType() == NodeType.VALUE) {
-                                value = ((CValueNode) valNode).getValue().toString();
-                            } else if (valNode.getType() == NodeType.LIST) {
-                                CListNode listNode = (CListNode) valNode;
-                                List<String> values = new ArrayList<>(listNode.size());
-                                for (CNode lValNode : listNode.getChildren()) {
-                                    values.add(((CValueNode) lValNode).getValue().toString());
-                                }
-
-                                value = values;
-                            } else {
-                                throw new RuntimeException("Value or List node required.");
+                        paramName = tuple.getName();
+                        CNode valNode = tuple.getNode();
+                        if (valNode.getType() == NodeType.VALUE) {
+                            value = ((CValueNode) valNode).getValue().toString();
+                        } else if (valNode.getType() == NodeType.LIST) {
+                            CListNode listNode = (CListNode) valNode;
+                            List<String> values = new ArrayList<>(listNode.size());
+                            for (CNode lValNode : listNode.getChildren()) {
+                                values.add(((CValueNode) lValNode).getValue().toString());
                             }
 
-                            op = clazz
-                                    .getConstructor(CharSequence.class, Object.class)
-                                    .newInstance(tuple.getName(), value);
-                            op.setEscape(escape);
-                        } catch (Exception e) {
-                            throw new RuntimeException(e.getMessage(), e);
+                            value = values;
+                        } else {
+                            throw new RuntimeException("Value or List node required.");
                         }
-
                         break;
                 }
 
@@ -139,6 +131,15 @@
                     break;
                 }
             }
+            try {
+                op = clazz
+                        .getConstructor(CharSequence.class, Object.class)
+                        .newInstance(paramName, value);
+                op.setEscape(escape);
+            } catch (Exception e) {
+                throw new RuntimeException(e.getMessage(), e);
+            }
+
         }
 
         return op;