diff --git a/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java b/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java index 0a163d80d40..f8f11a1a31f 100644 --- a/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java +++ b/samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java @@ -26,6 +26,11 @@ public class ApiInvoker { private static ApiInvoker INSTANCE = new ApiInvoker(); private Map hostMap = new HashMap(); private Map defaultHeaderMap = new HashMap(); + private boolean isDebug = false; + + public void enableDebug() { + isDebug = true; + } public static ApiInvoker getInstance() { return INSTANCE; @@ -124,8 +129,8 @@ public class ApiInvoker { StringBuilder formParamBuilder = new StringBuilder(); // encode the form params - for(String key : headerParams.keySet()) { - String value = headerParams.get(key); + for(String key : formParams.keySet()) { + String value = formParams.get(key); if(value != null && !"".equals(value.trim())) { if(formParamBuilder.length() > 0) { formParamBuilder.append("&"); @@ -169,7 +174,8 @@ public class ApiInvoker { private Client getClient(String host) { if(!hostMap.containsKey(host)) { Client client = Client.create(); - client.addFilter(new LoggingFilter()); + if(isDebug) + client.addFilter(new LoggingFilter()); hostMap.put(host, client); } return hostMap.get(host);