Permalink
Browse files

Fix URL generation for endpoints with a single parameter but multiple…

… values.
  • Loading branch information...
1 parent 6e8b4ad commit c957a74b9426fcad1decc0b36f2ae9ce4cde0c84 Ryan Morgan committed Jul 21, 2009
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/org/hyperic/hq/hqapi1/HQConnection.java
@@ -145,16 +145,16 @@ private String urlEncode(String s)
uri.append("?");
}
- int idx = 0;
- for (Iterator i = params.keySet().iterator(); i.hasNext(); idx++) {
- String key = (String)i.next();
+ boolean append = false;
+ for (String key : params.keySet()) {
String[] vals = params.get(key);
for (String val : vals) {
if (val != null) {
- if (idx > 0) {
+ if (append) {
uri.append("&");
}
uri.append(key).append("=").append(urlEncode(val));
+ append = true;
}
}
}

0 comments on commit c957a74

Please sign in to comment.