NumberFormatException fix
authorKrzysztof Majewski <krzysztof.majewski.km1@contractors.roche.com>
Tue, 22 Oct 2019 09:06:39 +0000 (11:06 +0200)
committerKrzysztof Majewski <krzysztof.majewski.km1@contractors.roche.com>
Tue, 22 Oct 2019 09:06:39 +0000 (11:06 +0200)
sdk/java-v2/src/main/java/org/arvados/client/logic/collection/FileToken.java
sdk/java-v2/src/main/java/org/arvados/client/logic/keep/FileDownloader.java
sdk/java-v2/src/test/java/org/arvados/client/logic/collection/FileTokenTest.java

index b41ccd3cddcca658489ed4cf0a8319b99a4619f8..2f50502824c735cd4f3a354e78ebd4afbbef0644 100644 (file)
@@ -13,7 +13,7 @@ import org.arvados.client.common.Characters;
 public class FileToken {
 
     private int filePosition;
-    private int fileSize;
+    private long fileSize;
     private String fileName;
     private String path;
 
@@ -46,7 +46,7 @@ public class FileToken {
         return this.filePosition;
     }
 
-    public int getFileSize() {
+    public long getFileSize() {
         return this.fileSize;
     }
 
index 1f694f25c2dc2bc7297f570dbfcde7653a9e7353..c1e8849e39f625128133bea1d8376e01e005ca54 100644 (file)
@@ -187,7 +187,7 @@ public class FileDownloader {
         // values for tracking file output streams and matching data chunks with initial files
         int currentDataChunkNumber;
         int bytesDownloadedFromChunk;
-        int bytesToDownload;
+        long bytesToDownload;
         byte[] currentDataChunk;
         boolean remainingDataInChunk;
         final List<KeepLocator> keepLocators;
@@ -199,11 +199,11 @@ public class FileDownloader {
             this.keepLocators = keepLocators;
         }
 
-        private int getBytesToDownload() {
+        private long getBytesToDownload() {
             return bytesToDownload;
         }
 
-        private void setBytesToDownload(int bytesToDownload) {
+        private void setBytesToDownload(long bytesToDownload) {
             this.bytesToDownload = bytesToDownload;
         }
 
@@ -244,7 +244,7 @@ public class FileDownloader {
 
         private void writeDownDataChunkPartially(FileOutputStream fos) throws IOException {
             //write all remaining bytes for this file from current chunk
-            fos.write(currentDataChunk, bytesDownloadedFromChunk, bytesToDownload);
+            fos.write(currentDataChunk, bytesDownloadedFromChunk, (int) bytesToDownload);
             // update number of bytes downloaded from this chunk
             bytesDownloadedFromChunk += bytesToDownload;
             // set remaining data in chunk to true
index 13939852cbde5fa3313bf50053204d566d2201e8..a95ea754e4b89dd30d98e535843e5afdd5e5049e 100644 (file)
@@ -15,7 +15,7 @@ public class FileTokenTest {
 
     public static final String FILE_TOKEN_INFO = "0:1024:test-file1";
     public static final int FILE_POSITION = 0;
-    public static final int FILE_LENGTH = 1024;
+    public static final long FILE_LENGTH = 1024L;
     public static final String FILE_NAME = "test-file1";
     public static final String FILE_PATH = "c" + Characters.SLASH;