From eedd2efc7acf8a78158b0b84e725f54eb79ce790 Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 27 Sep 2007 12:55:18 +0000 Subject: [PATCH] Added test to ensure all bytes are transferred during backupSessionFile git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@476 be28352e-c001-0410-b1a7-c7978e42abec --- .../ac/vamsas/client/simpleclient/SessionFile.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/uk/ac/vamsas/client/simpleclient/SessionFile.java b/src/uk/ac/vamsas/client/simpleclient/SessionFile.java index e2d1db7..aa5e779 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SessionFile.java +++ b/src/uk/ac/vamsas/client/simpleclient/SessionFile.java @@ -118,11 +118,23 @@ public class SessionFile { if (lockFile(extantLock)) { try { tempfile = File.createTempFile(backupPrefix, backupSuffix, backupDir); - if (fileLock.length()>0) { + long sourceln = fileLock.length(); + if (sourceln>0) { FileOutputStream tos = new FileOutputStream(tempfile); ReadableByteChannel channel; - tos.getChannel().transferFrom(channel=fileLock.getRaChannel(), 0, - fileLock.length()); + channel = fileLock.getRaChannel().position(0); + long ntrans = 0; + while (ntrans