diff options
author | Martin Fietz <martin.fietz@gmail.com> | 2018-01-21 13:15:43 +0100 |
---|---|---|
committer | Martin Fietz <martin.fietz@gmail.com> | 2018-01-21 13:15:43 +0100 |
commit | dde04c5a01980c324027a66308768375f545fa9f (patch) | |
tree | 588be2e976351782e60612cd4a53cebd80fcb997 /app | |
parent | b4d8868e9dabdd505960259229358b7424778178 (diff) | |
download | AntennaPod-dde04c5a01980c324027a66308768375f545fa9f.zip |
Use temporary StringBuilder for string concatenation in loop
Diffstat (limited to 'app')
-rw-r--r-- | app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java b/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java index 995f53988..3d4c96467 100644 --- a/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java +++ b/app/src/androidTest/java/de/test/antennapod/util/service/download/NanoHTTPD.java @@ -1138,17 +1138,19 @@ public abstract class NanoHTTPD { String value = ""; if (item.get("content-type") == null) { + StringBuilder tmp = new StringBuilder(); while (mpline != null && !mpline.contains(boundary)) { mpline = in.readLine(); if (mpline != null) { int d = mpline.indexOf(boundary); if (d == -1) { - value += mpline; + tmp.append(mpline); } else { - value += mpline.substring(0, d - 2); + tmp.append(mpline.substring(0, d - 2)); } } } + value = tmp.toString(); } else { if (boundarycount > bpositions.length) { throw new ResponseException(Response.Status.INTERNAL_ERROR, "Error processing request"); @@ -1156,8 +1158,7 @@ public abstract class NanoHTTPD { int offset = stripMultipartHeaders(fbuf, bpositions[boundarycount - 2]); String path = saveTmpFile(fbuf, offset, bpositions[boundarycount - 1] - offset - 4); files.put(pname, path); - value = disposition.get("filename"); - value = value.substring(1, value.length() - 1); + value = disposition.get("filename").substring(1, value.length() - 1); do { mpline = in.readLine(); } while (mpline != null && !mpline.contains(boundary)); |