Permalink
Browse files

fix bug in last read

  • Loading branch information...
1 parent d50f090 commit a8fa1f7a2beb35aa81fc82167eb061901506d6ac @akkumar akkumar committed Dec 31, 2011
Showing with 3 additions and 7 deletions.
  1. +1 −1 .classpath
  2. +2 −6 src/java/voldemort/utils/VoldemortIOUtils.java
View
@@ -52,7 +52,7 @@
<classpathentry kind="lib" path="lib/snappy-0.2.jar"/>
<classpathentry kind="lib" path="lib/libthrift-0.8.0.jar"/>
<classpathentry kind="lib" path="lib/httpclient-4.1.2.jar" sourcepath="/httpclient"/>
- <classpathentry kind="lib" path="lib/httpcore-4.1.2.jar"/>
+ <classpathentry kind="lib" path="lib/httpcore-4.1.2.jar" sourcepath="/httpcore"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="classes"/>
</classpath>
@@ -94,12 +94,8 @@ public static long copyLarge(Reader input, Writer output, long limit) throws IOE
int n = 0;
long remaining = limit;
while(remaining > 0) {
- if(remaining > DEFAULT_BUFFER_SIZE) {
- n = input.read(buffer);
- } else {
- char[] remainingbuffer = new char[(int) remaining];
- n = input.read(remainingbuffer);
- }
+ n = (remaining > DEFAULT_BUFFER_SIZE) ? input.read(buffer)
+ : input.read(buffer, 0, (int) remaining);
if(n == -1) {
break;
}

0 comments on commit a8fa1f7

Please sign in to comment.