1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-01 21:35:40 +02:00

[232084] [local] local file service should not throw operation cancelled exception due to file sizes

This commit is contained in:
David McKnight 2011-03-09 20:01:33 +00:00
parent d8a415b28e
commit d5083b23c1
3 changed files with 13 additions and 9 deletions

View file

@ -54,6 +54,9 @@ public class LocalServiceResources extends NLS
public static String FILEMSG_DELETING; public static String FILEMSG_DELETING;
public static String FILEMSG_COPYING; public static String FILEMSG_COPYING;
public static String FILEMSG_ERROR_DOWNLOAD_SIZE;
public static String FILEMSG_ERROR_UPLOAD_SIZE;
static { static {
// load message values from bundle file // load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, LocalServiceResources.class); NLS.initializeMessages(BUNDLE_NAME, LocalServiceResources.class);

View file

@ -50,4 +50,7 @@ FILEMSG_COPY_FILE_FAILED_DETAILS=The file system reported the copy operation fai
FILEMSG_DELETING =Deleting {0}... FILEMSG_DELETING =Deleting {0}...
FILEMSG_COPYING =Copying {0}... FILEMSG_COPYING =Copying {0}...
FILEMSG_ERROR_DOWNLOAD_SIZE=Local download: file size mismatch for {0}
FILEMSG_ERROR_UPLOAD_SIZE=Local upload: file size mismatch for {0}

View file

@ -50,6 +50,7 @@
* David McKnight (IBM) - [331247] Local file paste failed on Vista and Windows 7 * David McKnight (IBM) - [331247] Local file paste failed on Vista and Windows 7
* Xuan Chen (IBM) - [222544] [testing] FileServiceArchiveTest leaves temporary files and folders behind in TEMP dir * Xuan Chen (IBM) - [222544] [testing] FileServiceArchiveTest leaves temporary files and folders behind in TEMP dir
* David McKnight (IBM) - [337612] Failed to copy the content of a tar file * David McKnight (IBM) - [337612] Failed to copy the content of a tar file
* David McKnight (IBM) - [232084] [local] local file service should not throw operation cancelled exception due to file sizes
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.local.files; package org.eclipse.rse.internal.services.local.files;
@ -512,9 +513,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
boolean sizeCheck = !isBinary && systemEncoding.equals(hostEncoding); boolean sizeCheck = !isBinary && systemEncoding.equals(hostEncoding);
if (sizeCheck && (destinationFile.length() != file.length())) { if (sizeCheck && (destinationFile.length() != file.length())) {
throw new SystemOperationCancelledException(); throw new RemoteFileIOException(new IOException(NLS.bind(LocalServiceResources.FILEMSG_ERROR_DOWNLOAD_SIZE,remoteFile)));
// System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$
// return false;
} }
} }
} }
@ -689,7 +688,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
if (isCancelled) if (isCancelled)
{ {
throw new SystemOperationCancelledException(); throw new SystemOperationCancelledException();
// return false;
} else if (destinationFile!=null) { } else if (destinationFile!=null) {
// commented out as per the following bug: // commented out as per the following bug:
// [279829] [local] Save conflict dialog keeps popping up on mounted drive // [279829] [local] Save conflict dialog keeps popping up on mounted drive
@ -698,11 +696,11 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
//if(!localFile.canWrite()) destinationFile.setReadOnly(); //if(!localFile.canWrite()) destinationFile.setReadOnly();
// File lengths can be different if the encodings are different // File lengths can be different if the encodings are different
/* if (destinationFile.length() != localFile.length()) { String systemEncoding = SystemEncodingUtil.getInstance().getEnvironmentEncoding();
// throw new SystemOperationCancelledException(); boolean sizeCheck = !isBinary && systemEncoding.equals(hostEncoding);
System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$ if (sizeCheck && destinationFile.length() != localFile.length()) {
return false; throw new RemoteFileIOException(new IOException(NLS.bind(LocalServiceResources.FILEMSG_ERROR_UPLOAD_SIZE,remoteFile)));
}*/ }
} }
} }
catch (IOException e) catch (IOException e)