Skip to content
This repository
Browse code

o remove commons-io usage and use Guava instead

  • Loading branch information...
commit 755e0467064e7a6a758ec2c3faeafb1bd086f02d 1 parent 1aa00a8
Jason van Zyl authored
6 pom.xml
@@ -123,12 +123,6 @@
123 123 </dependency>
124 124
125 125 <dependency>
126   - <groupId>commons-io</groupId>
127   - <artifactId>commons-io</artifactId>
128   - <version>1.4</version>
129   - </dependency>
130   -
131   - <dependency>
132 126 <groupId>commons-collections</groupId>
133 127 <artifactId>commons-collections</artifactId>
134 128 <version>20040616</version>
42 sitebricks-mail/src/main/java/com/google/sitebricks/mail/imap/MessageBodyExtractor.java
... ... @@ -1,27 +1,35 @@
1 1 package com.google.sitebricks.mail.imap;
2 2
3   -import com.google.common.base.Preconditions;
4   -import com.google.common.collect.Lists;
5   -import com.google.common.collect.Maps;
6   -import com.google.common.collect.Multimap;
7   -import org.apache.commons.io.IOUtils;
8   -import org.apache.james.mime4j.codec.DecodeMonitor;
9   -import org.apache.james.mime4j.codec.DecoderUtil;
10   -import org.jetbrains.annotations.TestOnly;
11   -import org.slf4j.Logger;
12   -import org.slf4j.LoggerFactory;
13   -
14   -import javax.mail.MessagingException;
15   -import javax.mail.internet.MimeUtility;
16 3 import java.io.ByteArrayInputStream;
17 4 import java.io.IOException;
  5 +import java.io.InputStreamReader;
18 6 import java.io.UnsupportedEncodingException;
19 7 import java.text.ParseException;
20   -import java.util.*;
  8 +import java.util.Collection;
  9 +import java.util.List;
  10 +import java.util.ListIterator;
  11 +import java.util.Map;
  12 +import java.util.Queue;
21 13 import java.util.concurrent.atomic.AtomicInteger;
22 14 import java.util.regex.Matcher;
23 15 import java.util.regex.Pattern;
24 16
  17 +import javax.mail.MessagingException;
  18 +import javax.mail.internet.MimeUtility;
  19 +
  20 +import org.apache.james.mime4j.codec.DecodeMonitor;
  21 +import org.apache.james.mime4j.codec.DecoderUtil;
  22 +import org.jetbrains.annotations.TestOnly;
  23 +import org.slf4j.Logger;
  24 +import org.slf4j.LoggerFactory;
  25 +
  26 +import com.google.common.base.Preconditions;
  27 +import com.google.common.collect.Lists;
  28 +import com.google.common.collect.Maps;
  29 +import com.google.common.collect.Multimap;
  30 +import com.google.common.io.ByteStreams;
  31 +import com.google.common.io.CharStreams;
  32 +
25 33 /**
26 34 * Extracts a full Message body from an IMAP fetch. Specifically
27 35 * a "fetch body[]" command which comes back with the raw content of the
@@ -496,8 +504,8 @@ private static String decode(String body, String encoding, String charset) {
496 504 // Second time around. Apparently some are slipping through.
497 505 charset = Parsing.stripQuotes(charset);
498 506
499   - return IOUtils.toString(
500   - MimeUtility.decode(new ByteArrayInputStream(body.getBytes(charset)), encoding), charset);
  507 + return CharStreams.toString(
  508 + new InputStreamReader(MimeUtility.decode(new ByteArrayInputStream(body.getBytes(charset)), encoding), charset));
501 509 } catch (UnsupportedEncodingException e) {
502 510 // In this case, just return it as is and look it up later.
503 511 log.warn("Encountered unknown encoding '{}'. Treating it as a raw string.", charset, e);
@@ -539,7 +547,7 @@ static String boundary(String mimeType) {
539 547 // Decode if this is encoded as binary-to-text.
540 548 if (null != transferEncoding)
541 549 try {
542   - bytes = IOUtils.toByteArray(MimeUtility.decode(new ByteArrayInputStream(bytes),
  550 + bytes = ByteStreams.toByteArray(MimeUtility.decode(new ByteArrayInputStream(bytes),
543 551 transferEncoding));
544 552 } catch (MessagingException e) {
545 553 log.error("Unable to decode message body, proceeding with raw bytes.", e);
38 sitebricks-mail/src/test/java/com/google/sitebricks/mail/imap/MessageBodyExtractorTest.java
... ... @@ -1,17 +1,15 @@
1 1 package com.google.sitebricks.mail.imap;
2 2
3   -import com.google.common.base.Charsets;
4   -import com.google.common.collect.Multimap;
5   -import com.google.common.io.Resources;
6   -import org.apache.commons.io.IOUtils;
7   -import org.apache.commons.lang.builder.ToStringBuilder;
8   -import org.testng.annotations.Test;
  3 +import static org.testng.Assert.assertEquals;
  4 +import static org.testng.Assert.assertFalse;
  5 +import static org.testng.Assert.assertNotNull;
  6 +import static org.testng.Assert.assertNull;
  7 +import static org.testng.Assert.assertTrue;
9 8
10   -import javax.mail.MessagingException;
11   -import javax.mail.internet.MimeUtility;
12 9 import java.io.ByteArrayInputStream;
13 10 import java.io.IOException;
14 11 import java.io.InputStream;
  12 +import java.io.InputStreamReader;
15 13 import java.net.URL;
16 14 import java.text.ParseException;
17 15 import java.util.Collection;
@@ -20,7 +18,17 @@
20 18 import java.util.regex.Matcher;
21 19 import java.util.regex.Pattern;
22 20
23   -import static org.testng.Assert.*;
  21 +import javax.mail.MessagingException;
  22 +import javax.mail.internet.MimeUtility;
  23 +
  24 +import org.apache.commons.lang.builder.ToStringBuilder;
  25 +import org.testng.annotations.Test;
  26 +
  27 +import com.google.common.base.Charsets;
  28 +import com.google.common.collect.Multimap;
  29 +import com.google.common.io.ByteStreams;
  30 +import com.google.common.io.CharStreams;
  31 +import com.google.common.io.Resources;
24 32
25 33 /**
26 34 * @author dhanji@gmail.com (Dhanji R. Prasanna)
@@ -90,7 +98,7 @@ public final void testAwkwardGmailEmailStream(boolean forceTruncatorGroping) thr
90 98 // Folded headers with tabs + spaces, repeat headers, one body.
91 99 Message message = extract.get(0);
92 100 String expectedHeaders =
93   - IOUtils.toString(MessageBodyExtractorTest.class.getResourceAsStream("fetch_headers_1.txt"));
  101 + CharStreams.toString(new InputStreamReader(MessageBodyExtractorTest.class.getResourceAsStream("fetch_headers_1.txt")));
94 102 assertEquals(message.getHeaders().toString(), expectedHeaders);
95 103
96 104 assertEquals(1, message.getBodyParts().size());
@@ -100,9 +108,9 @@ public final void testAwkwardGmailEmailStream(boolean forceTruncatorGroping) thr
100 108
101 109 // We have to compare the raw bytes because the encoded string comes in as ISO-8859-1
102 110 // And Java literals are encoded as UTF-8.
103   - assertEquals(part1.getBody().getBytes(), IOUtils.toByteArray(
  111 + assertEquals(part1.getBody().getBytes(), ByteStreams.toByteArray(
104 112 MessageBodyExtractorTest.class.getResourceAsStream("fetch_body_1_raw.dat")));
105   - assertEquals(new String(part1.getBody().getBytes()), new String(IOUtils.toByteArray(
  113 + assertEquals(new String(part1.getBody().getBytes()), new String(ByteStreams.toByteArray(
106 114 MessageBodyExtractorTest.class.getResourceAsStream("fetch_body_1_raw.dat"))));
107 115
108 116 // ------------------------------------------------------------
@@ -119,8 +127,8 @@ public final void testAwkwardGmailEmailStream(boolean forceTruncatorGroping) thr
119 127 part1 = message.getBodyParts().get(0);
120 128 assertTrue(part1.getHeaders().isEmpty());
121 129 assertNull(part1.getBinBody());
122   - assertEquals(part1.getBody(), IOUtils.toString(
123   - MessageBodyExtractorTest.class.getResourceAsStream("fetch_body_2.txt")));
  130 + assertEquals(part1.getBody(), CharStreams.toString(
  131 + new InputStreamReader(MessageBodyExtractorTest.class.getResourceAsStream("fetch_body_2.txt"))));
124 132
125 133 // ------------------------------------------------------------
126 134 // Third message.
@@ -771,7 +779,7 @@ public final void testDecoding() throws MessagingException, IOException {
771 779 String charset = "ISO-8859-1";
772 780 final byte[] bytes = body.getBytes(charset);
773 781 final InputStream decoded = MimeUtility.decode(new ByteArrayInputStream(bytes), encoding);
774   - String result = IOUtils.toString(decoded, charset);
  782 + String result = CharStreams.toString(new InputStreamReader(decoded, charset));
775 783 assertEquals(result, body);
776 784 }
777 785 }
41 sitebricks-mail/src/test/java/com/google/sitebricks/mail/imap/MessageStatusExtractorTest.java
... ... @@ -1,12 +1,10 @@
1 1 package com.google.sitebricks.mail.imap;
2 2
3   -import com.google.common.base.Charsets;
4   -import com.google.common.collect.ImmutableList;
5   -import com.google.common.collect.ImmutableSet;
6   -import com.google.common.collect.Lists;
7   -import com.google.common.io.Resources;
8   -import org.apache.commons.io.IOUtils;
9   -import org.testng.annotations.Test;
  3 +import static org.testng.Assert.assertEquals;
  4 +import static org.testng.Assert.assertFalse;
  5 +import static org.testng.Assert.assertNotNull;
  6 +import static org.testng.Assert.assertNull;
  7 +import static org.testng.Assert.assertTrue;
10 8
11 9 import java.io.IOException;
12 10 import java.io.StringReader;
@@ -17,11 +15,14 @@
17 15 import java.util.List;
18 16 import java.util.Queue;
19 17
20   -import static org.testng.Assert.assertEquals;
21   -import static org.testng.Assert.assertFalse;
22   -import static org.testng.Assert.assertNotNull;
23   -import static org.testng.Assert.assertNull;
24   -import static org.testng.Assert.assertTrue;
  18 +import org.testng.annotations.Test;
  19 +
  20 +import com.google.common.base.Charsets;
  21 +import com.google.common.collect.ImmutableList;
  22 +import com.google.common.collect.ImmutableSet;
  23 +import com.google.common.collect.Lists;
  24 +import com.google.common.io.CharStreams;
  25 +import com.google.common.io.Resources;
25 26
26 27 /**
27 28 * @author dhanji@gmail.com (Dhanji R. Prasanna)
@@ -104,7 +105,7 @@ public final void testSizeMarkerRegex() throws IOException, ParseException {
104 105 public final void testMultilineUnquotedSubjectWithCrLfs() throws IOException, ParseException {
105 106 @SuppressWarnings("unchecked")
106 107 final List<MessageStatus> extract =
107   - new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  108 + new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
108 109 "* 27012 FETCH (X-GM-THRID 1279068049360518352 X-GM-MSGID 1279068049360518352 X-GM-LABELS () UID 60961 RFC822.SIZE 24305 INTERNALDATE \"27-Aug-2008 05:19:07 +0000\" FLAGS (\\Seen) ENVELOPE (\"27 Aug 2008 01:19:06 -0400\" {93}\n" +
109 110 "Ttkii Regency The quick brown fox ran over AK 7 Day Arrival Notice\n" +
110 111 " - BATTY SCORTI - 16257294 ((\"Ttkii E-Concierge\" NIL \"Concierge\" \"quickcolamakerXL.com\")) ((\"Ttkii E-Concierge\" NIL \"Concierge\" \"quickcolamakerXL.com\")) ((\"Ttkii E-Concierge\" NIL \"Concierge\" \"quickcolamakerXL.com\")) ((NIL NIL \"BATTY.SCORTI\" \"gmail.com\")) NIL NIL NIL \"<20010927011966.SM02008@CDC0044>\"))\n" +
@@ -149,7 +150,7 @@ public final void testMultilineUnquotedSubjectWithCrLfs() throws IOException, Pa
149 150 public final void testMultilineUnquotedSubjectWithLfs() throws IOException, ParseException {
150 151 @SuppressWarnings("unchecked")
151 152 final List<MessageStatus> extract =
152   - new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  153 + new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
153 154 "* 4017 FETCH (X-GM-THRID 13603320389284585 X-GM-MSGID 1460332038925224585 X-GM-LABELS (\"\\\\Inbox\") UID 5474 RFC822.SIZE 24864 INTERNALDATE \"10-Feb-2011 04:55:27 +0000\" FLAGS (\\Seen) ENVELOPE (\"Thu, 10 Feb 2011 15:55:20 +1100\" {96}\n" +
154 155 "ASIX News - Social Innovation Sydney Barcamp - Hub Melbourne news - Social\n" +
155 156 "Impact Scholarships ((\"ASIX - Australian Social Innovation eXchange\" NIL \"contact\" \"asix.org.au\")) ((\"ASIX - Australian Social Innovation eXchange\" NIL \"contact\" \"asix.org.au\")) ((\"ASIX - Australian Social Innovation eXchange\" NIL \"contact\" \"asix.org.au\")) ((\"dhanji\" NIL \"mick\" \"rethrick.com\")) NIL NIL NIL \"<E1123Yq-756Z-Fs@c.consumer.fluent.io>\"))\n" +
@@ -193,7 +194,7 @@ public final void testMultilineUnquotedSubjectWithLfs() throws IOException, Pars
193 194 @Test
194 195 public void testMutlilineUnquotedWithEmbeddedQuote() throws Exception {
195 196 @SuppressWarnings("unchecked")
196   - final List<MessageStatus> extract = new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  197 + final List<MessageStatus> extract = new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
197 198 "* 234 FETCH (X-GM-THRID 23432423423 X-GM-MSGID 23432423 X-GM-LABELS () UID 210140 RFC822.SIZE 58816" +
198 199 " INTERNALDATE \"17-Oct-2009 17:27:26 +0000\" FLAGS () ENVELOPE (\"17 Oct 2009 13:27:22 -0400\" {75}\n" +
199 200 "A Reminder to attend \"The Windows Vista Positioning Disaster:\n" +
@@ -208,7 +209,7 @@ public void testMutlilineUnquotedWithEmbeddedQuote() throws Exception {
208 209 @Test
209 210 public void testMutlilineUnquotedWithEmbeddedQuote2() throws Exception {
210 211 @SuppressWarnings("unchecked")
211   - final List<MessageStatus> extract = new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  212 + final List<MessageStatus> extract = new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
212 213 "* 28468 FETCH (X-GM-THRID 34543535 X-GM-MSGID 345435435 X-GM-LABELS (\"\\\\Important\" Notifications) UID 345534 RFC822.SIZE 84553 INTERNALDATE \"04-Oct-2011 07:30:02 +0000\" FLAGS (\\Seen) ENVELOPE (\"04 Oct 2011 00:30:00 -0700\" {998}\n" +
213 214 "<html>\n" +
214 215 "<head>\n" +
@@ -266,7 +267,7 @@ public void testMutlilineUnquotedWithEmbeddedQuote2() throws Exception {
266 267 public void testMultilineWithWhitespace() throws Exception {
267 268 @SuppressWarnings("unchecked")
268 269 final List<MessageStatus> extract =
269   - new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  270 + new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
270 271 "* 5553 FETCH (X-GM-THRID 234324 X-GM-MSGID 2343242 X-GM-LABELS () UID 1213437 RFC822.SIZE 1494343 INTERNALDATE \"08-Jun-2006 22:48:06 +0000\" FLAGS () ENVELOPE (\"Fri, 09 Jun 2006 06:50:32 +0800\" \"RE: Long game\" ((NIL NIL \"foo\" \"bar.com.au\")) ((NIL NIL \"foo\" \"bar.com.au\")) ((NIL NIL \"foo\" \"bar.com.au\")) ((NIL NIL \"foo\" \"bar.com.au\"))" +
271 272 "(({23}\n" +
272 273 "abcdef,\n" +
@@ -284,7 +285,7 @@ public void testMultilineWithWhitespace() throws Exception {
284 285 public void testMultilineUnquotedCC() throws Exception {
285 286 @SuppressWarnings("unchecked")
286 287 final List<MessageStatus> extract =
287   - new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  288 + new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
288 289 "* 67236 FETCH (X-GM-THRID 132443254747 X-GM-MSGID 13256345038 X-GM-LABELS (\"\\\\Inbox\") UID 197888 RFC822.SIZE 34646 INTERNALDATE \"23-Jan-2010 05:06:26 +0000\" FLAGS (\\Seen) " +
289 290 "ENVELOPE (\"Sat, 23 Jan 2010 05:04:06 +0000\" \"QUOTED SUBJECT\" (({14}\n" +
290 291 "Other\n" +
@@ -306,7 +307,7 @@ public void testMultilineUnquotedCC() throws Exception {
306 307 public void testMultilineNewlineEdgeCase() throws Exception {
307 308 @SuppressWarnings("unchecked")
308 309 final List<MessageStatus> extract =
309   - new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  310 + new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
310 311 "* 44788 FETCH (X-GM-THRID 34543534 X-GM-MSGID 34545 X-GM-LABELS (\"\\\\Inbox\") UID 61056 RFC822.SIZE 6154 INTERNALDATE \"17-May-2007 22:23:15 +0000\" FLAGS () ENVELOPE (\"Thu, 17 May 2007 15:23:14 -0700\" {29}\n" +
311 312 "Google Analytics New Version\n" +
312 313 " ((NIL NIL \"noreply\" \"google.com\")) ((NIL NIL \"noreply\" \"google.com\")) ((NIL NIL \"noreply\" \"google.com\")) ((NIL NIL \"foo\" \"gmail.com\")) NIL NIL NIL \"<345435@google.com>\"))")));
@@ -320,7 +321,7 @@ public void testMultilineNewlineEdgeCase() throws Exception {
320 321 public void testMultilineUnquotedMonster() throws Exception {
321 322 @SuppressWarnings("unchecked")
322 323 final List<MessageStatus> extract =
323   - new MessageStatusExtractor().extract(IOUtils.readLines(new StringReader(
  324 + new MessageStatusExtractor().extract(CharStreams.readLines(new StringReader(
324 325 "* 17594 FETCH (X-GM-THRID 876876876 X-GM-MSGID 876876876876 X-GM-LABELS " +
325 326 "(Beer \"\\\\Important\") UID 99879 RFC822.SIZE 2535649 INTERNALDATE \"20-Jul-2011 11:57:32 +0000\" " +
326 327 "FLAGS (\\Seen) ENVELOPE (\"Wed, 20 Jul 2011 21:57:32 +1000\" \"subject\" ((\"dude\" NIL \"foo\" \"bar.com.au\")) ((\"dude\" NIL \"foo\" \"bar.com.au\")) ((\"dude\" NIL \"foo\" \"bar.com.au\")) ((\"dude\" NIL \"foo\" \"bar.com.au\")) NIL NIL {1319}\n" +
4 sitebricks/pom.xml
@@ -61,10 +61,6 @@
61 61 <artifactId>async-http-client</artifactId>
62 62 </dependency>
63 63 <dependency>
64   - <groupId>commons-io</groupId>
65   - <artifactId>commons-io</artifactId>
66   - </dependency>
67   - <dependency>
68 64 <groupId>commons-lang</groupId>
69 65 <artifactId>commons-lang</artifactId>
70 66 </dependency>
19 sitebricks/src/main/java/com/google/sitebricks/ServletRequestProvider.java
... ... @@ -1,7 +1,16 @@
1 1 package com.google.sitebricks;
2 2
  3 +import java.io.IOException;
  4 +import java.io.OutputStream;
  5 +import java.lang.annotation.Annotation;
  6 +import java.util.Enumeration;
  7 +import java.util.Map;
  8 +
  9 +import javax.servlet.http.HttpServletRequest;
  10 +
3 11 import com.google.common.collect.ImmutableMultimap;
4 12 import com.google.common.collect.Multimap;
  13 +import com.google.common.io.ByteStreams;
5 14 import com.google.common.util.concurrent.ListenableFuture;
6 15 import com.google.common.util.concurrent.SettableFuture;
7 16 import com.google.inject.Inject;
@@ -11,14 +20,6 @@
11 20 import com.google.sitebricks.client.Transport;
12 21 import com.google.sitebricks.headless.Request;
13 22 import com.google.sitebricks.http.Parameters;
14   -import org.apache.commons.io.IOUtils;
15   -
16   -import javax.servlet.http.HttpServletRequest;
17   -import java.io.IOException;
18   -import java.io.OutputStream;
19   -import java.lang.annotation.Annotation;
20   -import java.util.Enumeration;
21   -import java.util.Map;
22 23
23 24 /**
24 25 * @author dhanji@gmail.com (Dhanji R. Prasanna)
@@ -68,7 +69,7 @@ public E as(Class<? extends Transport> transport) {
68 69
69 70 @Override
70 71 public void readTo(OutputStream out) throws IOException {
71   - IOUtils.copy(servletRequest.getInputStream(), out);
  72 + ByteStreams.copy(servletRequest.getInputStream(), out);
72 73 }
73 74
74 75 @Override
6 sitebricks/src/main/java/com/google/sitebricks/compiler/TemplateCompileException.java
... ... @@ -1,13 +1,13 @@
1 1 package com.google.sitebricks.compiler;
2 2
3   -import org.apache.commons.io.IOUtils;
4   -
5 3 import java.io.IOException;
6 4 import java.io.StringReader;
7 5 import java.util.Arrays;
8 6 import java.util.List;
9 7 import java.util.concurrent.atomic.AtomicInteger;
10 8
  9 +import com.google.common.io.CharStreams;
  10 +
11 11 /**
12 12 * @author Dhanji R. Prasanna (dhanji@gmail.com)
13 13 */
@@ -25,7 +25,7 @@ public TemplateCompileException(Class<?> page, String template,
25 25 this.warnings = warnings;
26 26 try {
27 27 //noinspection unchecked
28   - this.templateLines = IOUtils.readLines(new StringReader(template));
  28 + this.templateLines = CharStreams.readLines(new StringReader(template));
29 29 } catch (IOException e) {
30 30 throw new IllegalStateException("Fatal error, could not read template after compile", e);
31 31 }
17 sitebricks/src/main/java/com/google/sitebricks/headless/ReplyMaker.java
... ... @@ -1,20 +1,21 @@
1 1 package com.google.sitebricks.headless;
2 2
  3 +import java.io.IOException;
  4 +import java.io.InputStream;
  5 +import java.util.Map;
  6 +
  7 +import javax.servlet.http.HttpServletRequest;
  8 +import javax.servlet.http.HttpServletResponse;
  9 +
3 10 import com.google.common.base.Preconditions;
4 11 import com.google.common.collect.Maps;
  12 +import com.google.common.io.ByteStreams;
5 13 import com.google.inject.Injector;
6 14 import com.google.inject.Key;
7 15 import com.google.sitebricks.client.Transport;
8 16 import com.google.sitebricks.client.transport.Text;
9 17 import com.google.sitebricks.rendering.Strings;
10 18 import com.google.sitebricks.rendering.Templates;
11   -import org.apache.commons.io.IOUtils;
12   -
13   -import javax.servlet.http.HttpServletRequest;
14   -import javax.servlet.http.HttpServletResponse;
15   -import java.io.IOException;
16   -import java.io.InputStream;
17   -import java.util.Map;
18 19
19 20 /**
20 21 * A builder implementation of the Reply interface.
@@ -181,7 +182,7 @@ void populate(Injector injector, HttpServletResponse response) throws IOExceptio
181 182 // Stream the response rather than marshalling it through a transport.
182 183 InputStream inputStream = (InputStream) entity;
183 184 try {
184   - IOUtils.copy(inputStream, response.getOutputStream());
  185 + ByteStreams.copy(inputStream, response.getOutputStream());
185 186 } finally {
186 187 inputStream.close();
187 188 }
20 sitebricks/src/main/java/com/google/sitebricks/rendering/resource/ClasspathResourcesService.java
... ... @@ -1,20 +1,22 @@
1 1 package com.google.sitebricks.rendering.resource;
2 2
3   -import com.google.common.collect.MapMaker;
4   -import com.google.inject.Singleton;
5   -import com.google.sitebricks.Export;
6   -import com.google.sitebricks.Renderable;
7   -import com.google.sitebricks.Respond;
8   -import net.jcip.annotations.ThreadSafe;
9   -import org.apache.commons.io.IOUtils;
10   -
11 3 import java.io.IOException;
12 4 import java.io.InputStream;
  5 +import java.io.InputStreamReader;
13 6 import java.util.List;
14 7 import java.util.Map;
15 8 import java.util.Properties;
16 9 import java.util.concurrent.atomic.AtomicReference;
17 10
  11 +import net.jcip.annotations.ThreadSafe;
  12 +
  13 +import com.google.common.collect.MapMaker;
  14 +import com.google.common.io.CharStreams;
  15 +import com.google.inject.Singleton;
  16 +import com.google.sitebricks.Export;
  17 +import com.google.sitebricks.Renderable;
  18 +import com.google.sitebricks.Respond;
  19 +
18 20 /**
19 21 * @author Dhanji R. Prasanna (dhanji@gmail com)
20 22 */
@@ -118,7 +120,7 @@ public String toString() {
118 120 "Couldn't find static resource (did you spell it right?) specified by: "
119 121 + resource);
120 122
121   - list = IOUtils.readLines(stream);
  123 + list = CharStreams.readLines(new InputStreamReader(stream));
122 124 } catch (IOException e) {
123 125 throw new ResourceLoadingException(
124 126 "Error loading static resource specified by: " + resource, e);
4 stat/pom.xml
@@ -51,10 +51,6 @@
51 51 <artifactId>guice</artifactId>
52 52 </dependency>
53 53 <dependency>
54   - <groupId>commons-io</groupId>
55   - <artifactId>commons-io</artifactId>
56   - </dependency>
57   - <dependency>
58 54 <groupId>javax.servlet</groupId>
59 55 <artifactId>servlet-api</artifactId>
60 56 </dependency>

0 comments on commit 755e046

Please sign in to comment.
Something went wrong with that request. Please try again.