On Tue, 6 Sep 2005, Atsuhiko Yamanaka <[EMAIL PROTECTED]> wrote: > I'll post a fix here.
Something like the patch below? Cheers Stefan Index: src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java =================================================================== --- src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java (revision 279047) +++ src/main/org/apache/tools/ant/taskdefs/optional/ssh/AbstractSshMessage.java (working copy) @@ -157,7 +157,7 @@ */ protected void logStats(long timeStarted, long timeEnded, - int totalLength) { + long totalLength) { double duration = (timeEnded - timeStarted) / 1000.0; NumberFormat format = NumberFormat.getNumberInstance(); format.setMaximumFractionDigits(2); @@ -184,7 +184,7 @@ * @param percentTransmitted the current percent transmitted * @return the percent that the file is of the total */ - protected final int trackProgress(int filesize, int totalLength, + protected final int trackProgress(long filesize, long totalLength, int percentTransmitted) { int percent = (int) Math.round(Math.floor((totalLength Index: src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java =================================================================== --- src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java (revision 279047) +++ src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpToMessage.java (working copy) @@ -197,7 +197,7 @@ InputStream in, OutputStream out) throws IOException { // send "C0644 filesize filename", where filename should not include '/' - int filesize = (int) localFile.length(); + long filesize = localFile.length(); String command = "C0644 " + filesize + " "; command += localFile.getName(); command += "\n"; @@ -211,13 +211,13 @@ FileInputStream fis = new FileInputStream(localFile); byte[] buf = new byte[BUFFER_SIZE]; long startTime = System.currentTimeMillis(); - int totalLength = 0; + long totalLength = 0; // only track progress for files larger than 100kb in verbose mode boolean trackProgress = getVerbose() && filesize > 102400; // since filesize keeps on decreasing we have to store the // initial filesize - int initFilesize = filesize; + long initFilesize = filesize; int percentTransmitted = 0; try { Index: src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java =================================================================== --- src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java (revision 279047) +++ src/main/org/apache/tools/ant/taskdefs/optional/ssh/ScpFromMessage.java (working copy) @@ -163,7 +163,7 @@ int end = serverResponse.indexOf(" ", start + 1); start = end + 1; end = serverResponse.indexOf(" ", start + 1); - int filesize = Integer.parseInt(serverResponse.substring(start, end)); + long filesize = Long.parseLong(serverResponse.substring(start, end)); String filename = serverResponse.substring(end + 1); log("Receiving: " + filename + " : " + filesize); File transferFile = (localFile.isDirectory()) @@ -175,7 +175,7 @@ } private void fetchFile(File localFile, - int filesize, + long filesize, OutputStream out, InputStream in) throws IOException { byte[] buf = new byte[BUFFER_SIZE]; @@ -184,20 +184,21 @@ // read a content of lfile FileOutputStream fos = new FileOutputStream(localFile); int length; - int totalLength = 0; + long totalLength = 0; long startTime = System.currentTimeMillis(); // only track progress for files larger than 100kb in verbose mode boolean trackProgress = getVerbose() && filesize > 102400; // since filesize keeps on decreasing we have to store the // initial filesize - int initFilesize = filesize; + long initFilesize = filesize; int percentTransmitted = 0; try { while (true) { length = in.read(buf, 0, - (buf.length < filesize) ? buf.length : filesize); + (BUFFER_SIZE < filesize) ? BUFFER_SIZE + : (int) filesize); if (length < 0) { throw new EOFException("Unexpected end of stream."); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]