From 265e116a3410273a33d7dc1bde892eb65fba8472 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 21 Aug 2017 12:32:18 +0300 Subject: api: cleanup unused injections --- .../src/main/java/com/juick/server/util/HttpUtils.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'juick-server-web/src') diff --git a/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java b/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java index bf08f31e..971587a8 100644 --- a/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java +++ b/juick-server-web/src/main/java/com/juick/server/util/HttpUtils.java @@ -17,6 +17,7 @@ package com.juick.server.util; import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -82,11 +83,7 @@ public class HttpUtils { attachmentFName = DigestUtils.md5Hex(UUID.randomUUID().toString()) + "." + attachmentType; fos = new FileOutputStream(Paths.get(tmpDir, attachmentFName).toString()); - byte[] buffer = new byte[10240]; - int len; - while ((len = is.read(buffer)) > 0) { - fos.write(buffer, 0, len); - } + IOUtils.copy(is, fos); } catch (Exception e) { ex = e; attachmentFName = null; -- cgit v1.2.3