### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.files.ui Index: src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java,v retrieving revision 1.78 diff -u -r1.78 SystemViewRemoteFileAdapter.java --- src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 29 Apr 2008 20:25:43 -0000 1.78 +++ src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 5 May 2008 17:29:26 -0000 @@ -52,6 +52,7 @@ * David McKnight (IBM) - [224377] "open with" menu does not have "other" option * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE * Rupen Mardirossian (IBM) - [198728] Folder being copied across systems is added to original set of files in order to extract empty (sub)folders in doDrop method + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding *******************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -2569,9 +2570,9 @@ } else { - - //System.out.println("how do we get here!??"); - + // Not sure how we can get here since if the source and target subsystems are different, then a doDrag() needs to + // occur, resulting in a local resource (i.e. IFile) rather than a remote resource (i.e. IRemoteFile). + // TODO investigate to see if we can get rid of this code if (srcFileOrFolder.isFile()) { try @@ -2597,6 +2598,7 @@ String newPath = newPathBuf.toString(); monitor.subTask(copyMessage.getLevelOneText()); + targetFS.upload(srcFileOrFolder.getAbsolutePath(), SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), monitor); //$NON-NLS-1$ result = targetFS.getRemoteFileObject(targetFolder, name, monitor); Index: src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java,v retrieving revision 1.88 diff -u -r1.88 UniversalFileTransferUtility.java --- src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java 29 Apr 2008 20:25:43 -0000 1.88 +++ src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java 5 May 2008 17:29:24 -0000 @@ -45,6 +45,7 @@ * Rupen Mardirossian (IBM) - [210682] Collisions when doing a copy operation across systems will us the SystemCopyDialog * Xuan Chen (IBM) - [229093] set charset of the temp file of the text remote file to its remote encoding * Rupen Mardirossian (IBM) - [198728] downloadResourcesToWorkspace now creates empty folders for copying across connections via createEmptyFolders method + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -280,12 +281,12 @@ else { // using text mode so the char set needs to be local - String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ SystemIFileProperties properties = new SystemIFileProperties(tempFile); if (properties.getLocalEncoding() != null){ - localEncoding = properties.getLocalEncoding(); + String localEncoding = properties.getLocalEncoding(); + tempFile.setCharset(localEncoding, null); } - tempFile.setCharset(localEncoding, null); + // otherwise, the default charset is inherited so no need to set } } } @@ -588,11 +589,11 @@ else { // using text mode so the char set needs to be local - String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ if (properties.getLocalEncoding() != null){ - localEncoding = properties.getLocalEncoding(); + String localEncoding = properties.getLocalEncoding(); + tempFile.setCharset(localEncoding, null); } - tempFile.setCharset(localEncoding, null); + // otherwise, the default charset is inherited so no need to set } } } @@ -970,7 +971,8 @@ // copy remote file to workspace SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener(); listener.addIgnoreFile(tempFile); - String encoding = System.getProperty("file.encoding"); //$NON-NLS-1$ + String encoding = tempFile.getParent().getDefaultCharset(); + download(srcFileOrFolder, tempFile, encoding, monitor); listener.removeIgnoreFile(tempFile); if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO)) Index: src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java,v retrieving revision 1.59 diff -u -r1.59 SystemEditableRemoteFile.java --- src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java 25 Apr 2008 21:07:03 -0000 1.59 +++ src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java 5 May 2008 17:29:22 -0000 @@ -31,6 +31,7 @@ * David McKnight (IBM) - [224377] "open with" menu does not have "other" option * Kevin Doyle (IBM) - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check * David McKnight (IBM) - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding *******************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -1523,11 +1524,12 @@ } else { // using text mode so the char set needs to be local - String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ if (properties.getLocalEncoding() != null){ - localEncoding = properties.getLocalEncoding(); - } - file.setCharset(localEncoding, null); + String localEncoding = properties.getLocalEncoding(); + file.setCharset(localEncoding, null); + } + + // otherwise, the default charset is inherited so no need to set } } } #P org.eclipse.rse.services Index: src/org/eclipse/rse/services/files/AbstractFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/src/org/eclipse/rse/services/files/AbstractFileService.java,v retrieving revision 1.28 diff -u -r1.28 AbstractFileService.java --- src/org/eclipse/rse/services/files/AbstractFileService.java 9 Apr 2008 19:27:41 -0000 1.28 +++ src/org/eclipse/rse/services/files/AbstractFileService.java 5 May 2008 17:29:27 -0000 @@ -38,6 +38,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.rse.services.AbstractService; +import org.eclipse.rse.services.clientserver.SystemEncodingUtil; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; @@ -186,7 +187,7 @@ * @since 2.0 */ public String getEncoding(IProgressMonitor monitor) throws SystemMessageException { - return System.getProperty("file.encoding"); //$NON-NLS-1$ + return SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); } /** Index: clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java,v retrieving revision 1.7 diff -u -r1.7 SystemEncodingUtil.java --- clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java 12 Feb 2008 23:42:35 -0000 1.7 +++ clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java 5 May 2008 17:29:27 -0000 @@ -13,7 +13,7 @@ * * Contributors: * David McKnight (IBM) [215847]SystemEncodingUtil needs to convert to unsigned when checking xml file - * + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding *******************************************************************************/ package org.eclipse.rse.services.clientserver; @@ -31,6 +31,8 @@ private static SystemEncodingUtil instance; public static String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$ + + private DefaultEncodingProvider _defaultEncodingProvider = new DefaultEncodingProvider(); /** * Constructor to create the utility class. @@ -52,6 +54,51 @@ return instance; } + + + /** + * Provider for the default encodings that RSE uses. + * Clients may subclass this class, and override methods. + * @since org.eclipse.rse.services 3.0 + */ + public static class DefaultEncodingProvider { + + /** + * Return the default encoding for local workspace resources. + * Clients may override. + * @return String the local default encoding. + */ + public String getLocalDefaultEncoding() { + return System.getProperty("file.encoding"); //$NON-NLS-1$ + } + } + + /** + * Change the default encoding provider. + * + * This is a system-wide change, and clients will not be notified + * of changed default encodings due to changing the provider. Therefore, + * changing the provider should be done only once during early system + * startup. + * + * @param p the new encoding provider. + */ + public void setDefaultEncodingProvider(DefaultEncodingProvider p) { + _defaultEncodingProvider = p; + } + + /** + * Returns the local default encoding as provided by the default encoding + * provider. This method should be called after RSE startup is complete + * in order to get the proper default workspace encoding. + * + * @return the local default encoding + */ + public String getLocalDefaultEncoding() { + return _defaultEncodingProvider.getLocalDefaultEncoding(); + } + + /** * Gets the encoding of the environment. This is the encoding being used by the JVM, * which by default is the machine encoding, unless changed explicitly. #P org.eclipse.rse.dstore.security Index: META-INF/MANIFEST.MF =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.dstore.security/META-INF/MANIFEST.MF,v retrieving revision 1.18 diff -u -r1.18 MANIFEST.MF --- META-INF/MANIFEST.MF 5 May 2008 14:00:46 -0000 1.18 +++ META-INF/MANIFEST.MF 5 May 2008 17:29:28 -0000 @@ -15,7 +15,7 @@ Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Bundle-Vendor: %providerName -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.eclipse.rse.internal.dstore.security;x-internal:=true, org.eclipse.rse.internal.dstore.security.preference;x-internal:=true, org.eclipse.rse.internal.dstore.security.util;x-internal:=true, #P org.eclipse.rse.importexport Index: src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java,v retrieving revision 1.6 diff -u -r1.6 RemoteExporter.java --- src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java 12 Feb 2008 23:42:46 -0000 1.6 +++ src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java 5 May 2008 17:29:29 -0000 @@ -8,6 +8,7 @@ * Contributors: * IBM Corporation - initial API and implementation * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding *******************************************************************************/ package org.eclipse.rse.internal.importexport.files; @@ -21,7 +22,6 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.rse.core.model.IHost; -import org.eclipse.rse.services.clientserver.SystemEncodingUtil; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; @@ -99,7 +99,9 @@ // for windows dest = dest.replace('/', sep); } - rfss.upload(file.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, dest, System.getProperty("file.encoding"), new NullProgressMonitor()); //$NON-NLS-1$ + String localEncoding = file.getCharset(); + String hostEncoding = Utilities.getIRemoteFile(_host, dest).getEncoding(); + rfss.upload(file.getLocation().makeAbsolute().toOSString(), localEncoding, dest, hostEncoding, new NullProgressMonitor()); //$NON-NLS-1$ } /** Index: src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java,v retrieving revision 1.9 diff -u -r1.9 RemoteFileImportOperation.java --- src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java 12 Apr 2008 00:18:55 -0000 1.9 +++ src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java 5 May 2008 17:29:29 -0000 @@ -10,10 +10,11 @@ * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding *******************************************************************************/ package org.eclipse.rse.internal.importexport.files; -import java.io.ByteArrayInputStream; +imimport java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; @@ -49,7 +50,6 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation; import org.eclipse.ui.dialogs.ContainerGenerator; import org.eclipse.ui.dialogs.IOverwriteQuery; - // Similar to org.eclipse.ui.wizards.datatransfer.ImportOperation /** * An operation which does the actual work of copying objects from the local @@ -463,7 +463,7 @@ // 030820: added the following kludge to circumvent problem in // artemis. (artemis 3 will fix this) // TODO remove for 6.0 - String encoding = System.getProperty("file.encoding"); //$NON-NLS-1$ + String encoding = ((UniFilePlus) fileObject).remoteFile.getEncoding(); if (encoding.startsWith("CP")) //$NON-NLS-1$ { encoding = "Cp" + encoding.substring(2); //$NON-NLS-1$ #P org.eclipse.rse.core Index: src/org/eclipse/rse/internal/core/RSEInitJob.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEInitJob.java,v retrieving revision 1.4 diff -u -r1.4 RSEInitJob.java --- src/org/eclipse/rse/internal/core/RSEInitJob.java 17 Apr 2008 13:50:20 -0000 1.4 +++ src/org/eclipse/rse/internal/core/RSEInitJob.java 5 May 2008 17:29:29 -0000 @@ -7,6 +7,7 @@ * Contributors: * David Dykstal (IBM) - [197167] adding notification and waiting for RSE model * David Dykstal (IBM) - [226728] NPE during init with clean workspace + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding ********************************************************************************/ package org.eclipse.rse.internal.core; @@ -15,6 +16,7 @@ import java.util.ArrayList; import java.util.List; +import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IPath; @@ -36,6 +38,7 @@ import org.eclipse.rse.internal.core.model.SystemModelChangeEvent; import org.eclipse.rse.internal.core.model.SystemProfileManager; import org.eclipse.rse.logging.Logger; +import org.eclipse.rse.services.clientserver.SystemEncodingUtil; /** * This is a job named "Initialize RSE". It is instantiated and run during @@ -203,6 +206,16 @@ } submonitor.done(); } + + // set the default encoding provider + SystemEncodingUtil encodingUtil = SystemEncodingUtil.getInstance(); + encodingUtil.setDefaultEncodingProvider( + new SystemEncodingUtil.DefaultEncodingProvider(){ + public String getLocalDefaultEncoding() { + return ResourcesPlugin.getEncoding(); + } + }); + initializerPhase.done(); // finish up - propogate cancel if necessary if (monitor.isCanceled()) { #P org.eclipse.rse.services.dstore Index: src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.dstore/src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java,v retrieving revision 1.62 diff -u -r1.62 DStoreFileService.java --- src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 23 Apr 2008 19:35:46 -0000 1.62 +++ src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java 5 May 2008 17:29:31 -0000 @@ -41,7 +41,9 @@ * David McKnight (IBM) - [220379] [api] Provide a means for contributing custom BIDI encodings * David McKnight (IBM) - [225573] [dstore] client not falling back to single operation when missing batch descriptors (due to old server) * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable - * David McKnight (IBM) - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider + * David McKnight (IBM) - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding + * David McKnight (IBM) - [221211] [api][breaking][files] need batch operations to indicate which operations were successful *******************************************************************************/ package org.eclipse.rse.internal.services.dstore.files; @@ -80,6 +82,7 @@ import org.eclipse.rse.services.clientserver.ISystemFileTypes; import org.eclipse.rse.services.clientserver.NamePatternMatcher; import org.eclipse.rse.services.clientserver.PathUtility; +import org.eclipse.rse.services.clientserver.SystemEncodingUtil; import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; import org.eclipse.rse.services.clientserver.messages.CommonMessages; import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds; @@ -98,6 +101,8 @@ import org.eclipse.rse.services.files.IHostFilePermissions; import org.eclipse.rse.services.files.IHostFilePermissionsContainer; import org.eclipse.rse.services.files.PendingHostFilePermissions; +import org.eclipse.rse.services.files.RemoteFileCancelledException; +import org.eclipse.rse.services.files.RemoteFileIOException; import org.eclipse.rse.services.files.RemoteFileSecurityException; public class DStoreFileService extends AbstractDStoreService implements IFileService, IFilePermissionsService @@ -268,7 +273,7 @@ public boolean upload(InputStream inputStream, String remoteParent, String remoteFile, boolean isBinary, - String hostEncoding, IProgressMonitor monitor) + String hostEncoding, IProgressMonitor monitor) throws SystemMessageException { BufferedInputStream bufInputStream = null; @@ -396,26 +401,22 @@ catch (FileNotFoundException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } catch (UnsupportedEncodingException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } catch (IOException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } catch (Exception e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } finally { @@ -428,15 +429,13 @@ if (isCancelled) { - return false; - //throw new RemoteFileCancelledException(); + throw new RemoteFileCancelledException(); } } catch (IOException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } } @@ -446,7 +445,7 @@ public boolean upload(File file, String remoteParent, String remoteFile, boolean isBinary, - String srcEncoding, String hostEncoding, IProgressMonitor monitor) + String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException { FileInputStream inputStream = null; BufferedInputStream bufInputStream = null; @@ -595,26 +594,22 @@ catch (FileNotFoundException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } catch (UnsupportedEncodingException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } catch (IOException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } catch (Exception e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } finally { @@ -627,15 +622,13 @@ if (isCancelled) { - return false; - //throw new RemoteFileCancelledException(); + throw new RemoteFileCancelledException(); } } catch (IOException e) { // UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e); -// throw new RemoteFileIOException(e); - return false; + throw new RemoteFileIOException(e); } if (totalBytes > 0) @@ -680,7 +673,8 @@ if (!makeSureLocalExists(localFile)) { - return false; + FileNotFoundException e = new FileNotFoundException(); + throw new RemoteFileIOException(e); } @@ -742,7 +736,7 @@ } catch (Exception e) { - return false; + throw new RemoteFileIOException(e); } //long t2 = System.currentTimeMillis(); @@ -761,6 +755,7 @@ } catch (Exception e) { + throw new RemoteFileIOException(e); } } @@ -775,7 +770,7 @@ if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_SUCCESS_TYPE)) { if (!isBinary){ // do standard conversion if this is text! - String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ + String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(encoding, this); @@ -801,9 +796,9 @@ { //SystemMessage msg = getMessage(); //throw new SystemMessageException(msg); - //UnsupportedEncodingException e = new UnsupportedEncodingException(resultChild.getName()); + UnsupportedEncodingException e = new UnsupportedEncodingException(resultChild.getName()); //UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error reading file " + remotePath, e); - //throw new RemoteFileIOException(e); + throw new RemoteFileIOException(e); } else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION)) @@ -846,7 +841,7 @@ } catch (IOException e) { - return false; + throw new RemoteFileIOException(e); } return true; } @@ -913,7 +908,8 @@ if (!makeSureLocalExists(localFile)) { - return false; + FileNotFoundException e = new FileNotFoundException(); + throw new RemoteFileIOException(e); } long fileLength = DStoreHostFile.getFileLength(de.getSource()); @@ -942,11 +938,6 @@ DataElement subject = ds.createObject(universaltemp, de.getType(), remotePath, String.valueOf(mode)); DataElement status = ds.command(queryCmd, argList, subject); - if (status == null) - { - System.out.println("no download descriptor for "+remoteElement); //$NON-NLS-1$ - return false; - } DownloadListener dlistener = new DownloadListener(status, localFile, remotePath, fileLength, monitor); downloadListeners.add(dlistener); @@ -981,7 +972,7 @@ } catch (Exception e) { - return false; + throw new RemoteFileIOException(e); } // now wait till we have all the bytes local @@ -1000,6 +991,7 @@ } catch (Exception e) { + throw new RemoteFileIOException(e); } } @@ -1018,7 +1010,7 @@ { // do standard conversion if this is text! if (!isBinaries[i]){ // do standard conversion if this is text! - String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$ + String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncodings[i], this); codePageConverter.convertFileFromRemoteEncoding(remoteElement.getName(), localFile, hostEncodings[i], localEncoding, this); @@ -1369,7 +1361,12 @@ String remotePath = remoteParent + getSeparator(remoteParent) + fileName; DataElement de = getElementFor(remotePath); DataElement status = dsStatusCommand(de, IUniversalDataStoreConstants.C_DELETE, monitor); - if (status == null) return false; + if (status == null) + throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID, + ICommonMessageIds.MSG_ERROR_UNEXPECTED, + IStatus.ERROR, + CommonMessages.MSG_ERROR_UNEXPECTED)); + if (null != monitor && monitor.isCanceled()) { //This operation has been cancelled by the user. @@ -1484,8 +1481,12 @@ } - - if (status == null) return false; + if (status == null) + throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID, + ICommonMessageIds.MSG_ERROR_UNEXPECTED, + IStatus.ERROR, + CommonMessages.MSG_ERROR_UNEXPECTED)); + if (null != monitor && monitor.isCanceled()) { SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, @@ -1720,7 +1721,12 @@ } return true; } - return false; + else { + throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID, + ICommonMessageIds.MSG_ERROR_UNEXPECTED, + IStatus.ERROR, + CommonMessages.MSG_ERROR_UNEXPECTED)); + } } public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException @@ -2059,8 +2065,12 @@ return true; } } - - return false; + else { + throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID, + ICommonMessageIds.MSG_ERROR_UNEXPECTED, + IStatus.ERROR, + CommonMessages.MSG_ERROR_UNEXPECTED)); + } } public boolean setReadOnly(String parent, String name, @@ -2088,7 +2098,12 @@ return true; } } - return false; + else { + throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID, + ICommonMessageIds.MSG_ERROR_UNEXPECTED, + IStatus.ERROR, + CommonMessages.MSG_ERROR_UNEXPECTED)); + } } /** #P org.eclipse.rse.subsystems.files.core Index: src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java,v retrieving revision 1.56 diff -u -r1.56 RemoteFileSubSystem.java --- src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java 25 Apr 2008 21:07:59 -0000 1.56 +++ src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java 5 May 2008 17:29:32 -0000 @@ -75,6 +75,7 @@ import org.eclipse.rse.services.clientserver.IClientServerConstants; import org.eclipse.rse.services.clientserver.IMatcher; import org.eclipse.rse.services.clientserver.NamePatternMatcher; +import org.eclipse.rse.services.clientserver.SystemEncodingUtil; import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.services.clientserver.messages.SystemMessageException; @@ -1466,7 +1467,7 @@ return encoding; } else { - return System.getProperty("file.encoding"); //$NON-NLS-1$ + return SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); } } } #P org.eclipse.rse.ui Index: UI/org/eclipse/rse/ui/SystemConnectionForm.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java,v retrieving revision 1.34 diff -u -r1.34 SystemConnectionForm.java --- UI/org/eclipse/rse/ui/SystemConnectionForm.java 12 Apr 2008 00:20:57 -0000 1.34 +++ UI/org/eclipse/rse/ui/SystemConnectionForm.java 5 May 2008 17:29:34 -0000 @@ -21,6 +21,7 @@ * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter() * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods + * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding ********************************************************************************/ package org.eclipse.rse.ui; @@ -49,6 +50,7 @@ import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.internal.ui.SystemResources; +import org.eclipse.rse.services.clientserver.SystemEncodingUtil; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.ui.dialogs.ISystemPromptDialog; import org.eclipse.rse.ui.dialogs.SystemPromptDialog; @@ -959,7 +961,8 @@ otherEncodingCombo.setText(defaultEncoding); } else { - otherEncodingCombo.setText(System.getProperty("file.encoding")); //$NON-NLS-1$ + String workspaceDefault = SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); + otherEncodingCombo.setText(workspaceDefault); //$NON-NLS-1$ } }