Skip to content

Commit

Permalink
Multiple quality improvements - squid:S1643, squid:S1155, squid:S2864
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohamed Ezzat committed Jun 9, 2016
1 parent e879113 commit 21874fb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ protected void addParameter(String name, Object value)

protected String constructCommand(String commandName, String content)
{
String parameterValue = parameterMap.keySet().size() == 0 ? "" : "?";
for(String key : parameterMap.keySet())
StringBuilder parameterValue = new StringBuilder();
parameterValue.append(parameterMap.isEmpty() ? "" : "?");

for(Map.Entry<String, String> stringStringEntry : parameterMap.entrySet())
{
try
{
parameterValue += key + "=" + URLEncoder.encode(parameterMap.get(key), "utf-8");
parameterValue.append(stringStringEntry.getKey()).append("=").append(URLEncoder.encode(stringStringEntry.getValue(), "utf-8"));
}
catch(UnsupportedEncodingException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public Collection<Speaker> getSpeakers() throws Exception
*/
public void setSpeakers(final Collection<Speaker> speakers) throws Exception
{
String idsString = "";
StringBuilder idsString = new StringBuilder();
boolean first = true;
// The list of speakers to activate is a comma-separated string with
// the hex versions of the speakers' IDs
Expand All @@ -158,13 +158,13 @@ public void setSpeakers(final Collection<Speaker> speakers) throws Exception
{
if(!first)
{
idsString += ",";
idsString.append(",");
}
else
{
first = false;
}
idsString += speaker.getIdAsHex();
idsString.append(speaker.getIdAsHex());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public DmapTypeDefinition getType()
@Override
public String toString(final int indent)
{
String val = "{";
StringBuilder val = new StringBuilder("{");
for(int i = 0; i < value.length - 1; i++)
{
val += (int)value[i] + ", ";
val.append((int)value[i]).append(", ");
}
val += (int)value[value.length - 1] + "}";
val.append((int)value[value.length - 1]).append("}");
return indent(indent) + name + "(" + getContentCodeString() + "; raw)=" + val;
}

Expand Down

0 comments on commit 21874fb

Please sign in to comment.