Replace StringBuffer.toString() in concatenation
In addition to being confusing, this code performs String allocation and copying, which is unnecessary as of JDK1.4
This commit is contained in:
parent
ca60148431
commit
4c90f4aef3
7 changed files with 9 additions and 9 deletions
|
@ -166,7 +166,7 @@ public class LiveMonitoringHelper {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
httpclient.getConnectionManager().shutdown();
|
httpclient.getConnectionManager().shutdown();
|
||||||
log.info("Montior response : " + responseBody.toString());
|
log.info("Montior response : " + responseBody);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ public class SearchAddressOnlineFragment extends SherlockFragment implements Sea
|
||||||
b.append("?format=xml&addressdetails=0&accept-language=").append(Locale.getDefault().getLanguage()); //$NON-NLS-1$
|
b.append("?format=xml&addressdetails=0&accept-language=").append(Locale.getDefault().getLanguage()); //$NON-NLS-1$
|
||||||
b.append("&q=").append(URLEncoder.encode(search, "UTF-8")); //$NON-NLS-1$
|
b.append("&q=").append(URLEncoder.encode(search, "UTF-8")); //$NON-NLS-1$
|
||||||
|
|
||||||
log.info("Searching address at : " + b.toString()); //$NON-NLS-1$
|
log.info("Searching address at : " + b); //$NON-NLS-1$
|
||||||
URL url = new URL(b.toString());
|
URL url = new URL(b.toString());
|
||||||
URLConnection conn = url.openConnection();
|
URLConnection conn = url.openConnection();
|
||||||
conn.setDoInput(true);
|
conn.setDoInput(true);
|
||||||
|
|
|
@ -811,8 +811,8 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
StringBuilder value = new StringBuilder();
|
StringBuilder value = new StringBuilder();
|
||||||
MapRenderingTypes.getDefault().getAmenityTagValue(amenity.getType(), amenity.getSubType(),
|
MapRenderingTypes.getDefault().getAmenityTagValue(amenity.getType(), amenity.getSubType(),
|
||||||
tag, value);
|
tag, value);
|
||||||
if(RenderingIcons.containsBigIcon(tag.toString() + "_" + value.toString())) {
|
if(RenderingIcons.containsBigIcon(tag + "_" + value)) {
|
||||||
icon.setImageResource(RenderingIcons.getBigIconResourceId(tag.toString() + "_" + value.toString()));
|
icon.setImageResource(RenderingIcons.getBigIconResourceId(tag + "_" + value));
|
||||||
} else if(RenderingIcons.containsBigIcon(value.toString())) {
|
} else if(RenderingIcons.containsBigIcon(value.toString())) {
|
||||||
icon.setImageResource(RenderingIcons.getBigIconResourceId(value.toString()));
|
icon.setImageResource(RenderingIcons.getBigIconResourceId(value.toString()));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -505,7 +505,7 @@ public class SearchTransportFragment extends SherlockFragment implements SearchA
|
||||||
|
|
||||||
int dist = locationToStart == null ? 0 : (int) (MapUtils.getDistance(stop.getStart().getLocation(), locationToStart));
|
int dist = locationToStart == null ? 0 : (int) (MapUtils.getDistance(stop.getStart().getLocation(), locationToStart));
|
||||||
String distance = OsmAndFormatter.getFormattedDistance(dist, (ClientContext) getApplication()) + " "; //$NON-NLS-1$
|
String distance = OsmAndFormatter.getFormattedDistance(dist, (ClientContext) getApplication()) + " "; //$NON-NLS-1$
|
||||||
label.setText(distance + labelW.toString(), TextView.BufferType.SPANNABLE);
|
label.setText(distance + labelW, TextView.BufferType.SPANNABLE);
|
||||||
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(getResources().getColor(R.color.color_distance)), 0, distance.length() - 1, 0);
|
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(getResources().getColor(R.color.color_distance)), 0, distance.length() - 1, 0);
|
||||||
return (row);
|
return (row);
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,7 +289,7 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
||||||
b.append(",").append(rightLongitude); //$NON-NLS-1$
|
b.append(",").append(rightLongitude); //$NON-NLS-1$
|
||||||
b.append(",").append(topLatitude); //$NON-NLS-1$
|
b.append(",").append(topLatitude); //$NON-NLS-1$
|
||||||
try {
|
try {
|
||||||
log.info("Loading bugs " + b.toString()); //$NON-NLS-1$
|
log.info("Loading bugs " + b); //$NON-NLS-1$
|
||||||
URL url = new URL(b.toString());
|
URL url = new URL(b.toString());
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||||
|
|
|
@ -107,11 +107,11 @@ public class OsmBugsRemoteUtil implements OsmBugsUtil {
|
||||||
responseBody.append(s);
|
responseBody.append(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("Response : " + responseBody.toString()); //$NON-NLS-1$
|
log.info("Response : " + responseBody); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
connection.disconnect();
|
connection.disconnect();
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return msg + "\n" + responseBody.toString();
|
return msg + "\n" + responseBody;
|
||||||
}
|
}
|
||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
// that's tricky case why NPE is thrown to fix that problem httpClient could be used
|
// that's tricky case why NPE is thrown to fix that problem httpClient could be used
|
||||||
|
|
|
@ -630,7 +630,7 @@ public class RouteProvider {
|
||||||
// TODO if we would get instructions from the service, we could use this language setting
|
// TODO if we would get instructions from the service, we could use this language setting
|
||||||
// .append("&language=").append(Locale.getDefault().getLanguage());
|
// .append("&language=").append(Locale.getDefault().getLanguage());
|
||||||
|
|
||||||
log.info("URL route " + request.toString());
|
log.info("URL route " + request);
|
||||||
URI uri = URI.create(request.toString());
|
URI uri = URI.create(request.toString());
|
||||||
URL url = uri.toURL();
|
URL url = uri.toURL();
|
||||||
URLConnection connection = url.openConnection();
|
URLConnection connection = url.openConnection();
|
||||||
|
|
Loading…
Reference in a new issue