You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/01/10 18:16:44 UTC
git commit: CB-5631 Removed SimpleTrackingInputStream.read(byte[]
buffer)
Updated Branches:
refs/heads/dev 3c1ff1606 -> 8374b3dd6
CB-5631 Removed SimpleTrackingInputStream.read(byte[] buffer)
InputStream.read(byte[] buffer) calls InputStream.read(byte[] bytes, int
offset, int count). As SimpleTrackingInputStream overrides both these
methods a call to SimpleTrackingInputStream.read(byte[] buffer) results
in a call to SimpleTrackingInputStream.read(byte[] bytes, int offset,
int count) - and two calls to SimpleTrackingInputStream.updateBytesRead,
so the counter bytesRead gets incremented twice for each read.
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/commit/8374b3dd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/tree/8374b3dd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/diff/8374b3dd
Branch: refs/heads/dev
Commit: 8374b3dd67ecdb62423ff55ccb9d0a4454cfe4a4
Parents: 3c1ff16
Author: Colin Mahoney <cd...@gmail.com>
Authored: Thu Jan 9 17:20:43 2014 +0100
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jan 10 12:16:26 2014 -0500
----------------------------------------------------------------------
src/android/FileTransfer.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer/blob/8374b3dd/src/android/FileTransfer.java
----------------------------------------------------------------------
diff --git a/src/android/FileTransfer.java b/src/android/FileTransfer.java
index 5d7cbc0..079cd91 100644
--- a/src/android/FileTransfer.java
+++ b/src/android/FileTransfer.java
@@ -158,11 +158,8 @@ public class FileTransfer extends CordovaPlugin {
return updateBytesRead(super.read());
}
- @Override
- public int read(byte[] buffer) throws IOException {
- return updateBytesRead(super.read(buffer));
- }
-
+ // Note: FilterInputStream delegates read(byte[] bytes) to the below method,
+ // so we don't override it or else double count (CB-5631).
@Override
public int read(byte[] bytes, int offset, int count) throws IOException {
return updateBytesRead(super.read(bytes, offset, count));