View | Details | Raw Unified | Return to bug 229610 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java (-3 / +5 lines)
Lines 52-57 Link Here
52
 * David McKnight   (IBM)        - [224377] "open with" menu does not have "other" option
52
 * David McKnight   (IBM)        - [224377] "open with" menu does not have "other" option
53
 * David McKnight (IBM) 		 - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
53
 * David McKnight (IBM) 		 - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
54
 * 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			
54
 * 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			
55
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
55
 *******************************************************************************/
56
 *******************************************************************************/
56
57
57
package org.eclipse.rse.internal.files.ui.view;
58
package org.eclipse.rse.internal.files.ui.view;
Lines 2569-2577 Link Here
2569
						}
2570
						}
2570
						else
2571
						else
2571
						{
2572
						{
2572
2573
							// Not sure how we can get here since if the source and target subsystems are different, then a doDrag() needs to 
2573
							//System.out.println("how do we get here!??");
2574
							// occur, resulting in a local resource (i.e. IFile) rather than a remote resource (i.e. IRemoteFile).
2574
2575
							// TODO investigate to see if we can get rid of this code
2575
							if (srcFileOrFolder.isFile())
2576
							if (srcFileOrFolder.isFile())
2576
							{
2577
							{
2577
								try
2578
								try
Lines 2597-2602 Link Here
2597
									String newPath = newPathBuf.toString();
2598
									String newPath = newPathBuf.toString();
2598
2599
2599
									monitor.subTask(copyMessage.getLevelOneText());
2600
									monitor.subTask(copyMessage.getLevelOneText());
2601
									
2600
									targetFS.upload(srcFileOrFolder.getAbsolutePath(), SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), monitor); //$NON-NLS-1$
2602
									targetFS.upload(srcFileOrFolder.getAbsolutePath(), SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), monitor); //$NON-NLS-1$
2601
2603
2602
									result = targetFS.getRemoteFileObject(targetFolder, name, monitor);
2604
									result = targetFS.getRemoteFileObject(targetFolder, name, monitor);
(-)src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java (-7 / +9 lines)
Lines 45-50 Link Here
45
 * Rupen Mardirossian (IBM)      - [210682] Collisions when doing a copy operation across systems will us the SystemCopyDialog
45
 * Rupen Mardirossian (IBM)      - [210682] Collisions when doing a copy operation across systems will us the SystemCopyDialog
46
 * Xuan Chen        (IBM)        - [229093] set charset of the temp file of the text remote file to its remote encoding
46
 * Xuan Chen        (IBM)        - [229093] set charset of the temp file of the text remote file to its remote encoding
47
 * Rupen Mardirossian (IBM)      - [198728] downloadResourcesToWorkspace now creates empty folders for copying across connections via createEmptyFolders method
47
 * Rupen Mardirossian (IBM)      - [198728] downloadResourcesToWorkspace now creates empty folders for copying across connections via createEmptyFolders method
48
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
48
 ********************************************************************************/
49
 ********************************************************************************/
49
50
50
package org.eclipse.rse.files.ui.resources;
51
package org.eclipse.rse.files.ui.resources;
Lines 280-291 Link Here
280
					else 
281
					else 
281
					{
282
					{
282
						// using text mode so the char set needs to be local
283
						// using text mode so the char set needs to be local
283
						String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
284
						SystemIFileProperties properties = new SystemIFileProperties(tempFile);
284
						SystemIFileProperties properties = new SystemIFileProperties(tempFile);
285
						if (properties.getLocalEncoding() != null){
285
						if (properties.getLocalEncoding() != null){
286
							localEncoding = properties.getLocalEncoding();
286
							String localEncoding = properties.getLocalEncoding();
287
							tempFile.setCharset(localEncoding, null);
287
						}					
288
						}					
288
						tempFile.setCharset(localEncoding, null);
289
						// otherwise, the default charset is inherited so no need to set					
289
					}
290
					}
290
				}
291
				}
291
			}
292
			}
Lines 588-598 Link Here
588
								else 
589
								else 
589
								{
590
								{
590
									// using text mode so the char set needs to be local
591
									// using text mode so the char set needs to be local
591
									String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
592
									if (properties.getLocalEncoding() != null){
592
									if (properties.getLocalEncoding() != null){
593
										localEncoding = properties.getLocalEncoding();
593
										String localEncoding = properties.getLocalEncoding();
594
										tempFile.setCharset(localEncoding, null);
594
									}					
595
									}					
595
									tempFile.setCharset(localEncoding, null);
596
									// otherwise, the default charset is inherited so no need to set					
596
								}
597
								}
597
							}
598
							}
598
						}
599
						}
Lines 970-976 Link Here
970
			// copy remote file to workspace
971
			// copy remote file to workspace
971
			SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
972
			SystemUniversalTempFileListener listener = SystemUniversalTempFileListener.getListener();
972
			listener.addIgnoreFile(tempFile);
973
			listener.addIgnoreFile(tempFile);
973
			String encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
974
			String encoding = tempFile.getParent().getDefaultCharset();
975
974
			download(srcFileOrFolder, tempFile, encoding, monitor);
976
			download(srcFileOrFolder, tempFile, encoding, monitor);
975
			listener.removeIgnoreFile(tempFile);
977
			listener.removeIgnoreFile(tempFile);
976
			if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
978
			if (!tempFile.exists() && !tempFile.isSynchronized(IResource.DEPTH_ZERO))
(-)src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java (-4 / +6 lines)
Lines 31-36 Link Here
31
 * David McKnight   (IBM)        - [224377] "open with" menu does not have "other" option
31
 * David McKnight   (IBM)        - [224377] "open with" menu does not have "other" option
32
 * Kevin Doyle		(IBM)		 - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check
32
 * Kevin Doyle		(IBM)		 - [224162] SystemEditableRemoteFile.saveAs does not work because FileServiceSubSytem.upload does invalid check
33
 * David McKnight (IBM) 		 - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
33
 * David McKnight (IBM) 		 - [225747] [dstore] Trying to connect to an "Offline" system throws an NPE
34
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
34
 *******************************************************************************/
35
 *******************************************************************************/
35
36
36
package org.eclipse.rse.files.ui.resources;
37
package org.eclipse.rse.files.ui.resources;
Lines 1523-1533 Link Here
1523
				}
1524
				}
1524
				else {
1525
				else {
1525
					// using text mode so the char set needs to be local
1526
					// using text mode so the char set needs to be local
1526
					String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
1527
					if (properties.getLocalEncoding() != null){
1527
					if (properties.getLocalEncoding() != null){
1528
						localEncoding = properties.getLocalEncoding();
1528
						String localEncoding = properties.getLocalEncoding();
1529
					}					
1529
						file.setCharset(localEncoding, null);
1530
					file.setCharset(localEncoding, null);
1530
					}			
1531
					
1532
					// otherwise, the default charset is inherited so no need to set					
1531
				}
1533
				}
1532
			}
1534
			}
1533
		}
1535
		}
(-)src/org/eclipse/rse/services/files/AbstractFileService.java (-1 / +2 lines)
Lines 38-43 Link Here
38
import org.eclipse.core.runtime.IProgressMonitor;
38
import org.eclipse.core.runtime.IProgressMonitor;
39
39
40
import org.eclipse.rse.services.AbstractService;
40
import org.eclipse.rse.services.AbstractService;
41
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
41
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
42
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
42
43
43
44
Lines 186-192 Link Here
186
	 * @since 2.0
187
	 * @since 2.0
187
	 */
188
	 */
188
	public String getEncoding(IProgressMonitor monitor) throws SystemMessageException {
189
	public String getEncoding(IProgressMonitor monitor) throws SystemMessageException {
189
		return System.getProperty("file.encoding"); //$NON-NLS-1$
190
		return SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
190
	}
191
	}
191
192
192
	/**
193
	/**
(-)clientserver/org/eclipse/rse/services/clientserver/SystemEncodingUtil.java (-1 / +48 lines)
Lines 13-19 Link Here
13
 * 
13
 * 
14
 * Contributors:
14
 * Contributors:
15
 * David McKnight   (IBM) [215847]SystemEncodingUtil needs to convert to unsigned when checking xml file
15
 * David McKnight   (IBM) [215847]SystemEncodingUtil needs to convert to unsigned when checking xml file
16
 * 
16
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
17
 *******************************************************************************/
17
 *******************************************************************************/
18
18
19
package org.eclipse.rse.services.clientserver;
19
package org.eclipse.rse.services.clientserver;
Lines 31-36 Link Here
31
	
31
	
32
	private static SystemEncodingUtil instance;
32
	private static SystemEncodingUtil instance;
33
	public static String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$
33
	public static String ENCODING_UTF_8 = "UTF-8"; //$NON-NLS-1$
34
	
35
	private DefaultEncodingProvider _defaultEncodingProvider = new DefaultEncodingProvider();
34
36
35
	/**
37
	/**
36
	 * Constructor to create the utility class.
38
	 * Constructor to create the utility class.
Lines 52-57 Link Here
52
		return instance;
54
		return instance;
53
	}
55
	}
54
	
56
	
57
58
59
	   /**
60
	    * Provider for the default encodings that RSE uses.
61
	    * Clients may subclass this class, and override methods.
62
	    * @since org.eclipse.rse.services 3.0
63
	    */
64
	   public static class DefaultEncodingProvider {
65
66
	      /**
67
	       * Return the default encoding for local workspace resources.
68
	       * Clients may override.
69
	       * @return String the local default encoding.
70
	       */
71
	      public String getLocalDefaultEncoding() {
72
	          return System.getProperty("file.encoding"); //$NON-NLS-1$
73
	      }
74
	   }
75
76
   /**
77
    * Change the default encoding provider.
78
    *
79
    * This is a system-wide change, and clients will not be notified
80
    * of changed default encodings due to changing the provider. Therefore,
81
    * changing the provider should be done only once during early system 
82
    * startup.
83
    * 
84
    * @param p the new encoding provider.
85
    */
86
	public void setDefaultEncodingProvider(DefaultEncodingProvider p) {
87
	    _defaultEncodingProvider = p;
88
	}
89
90
	/**
91
	 * Returns the local default encoding as provided by the default encoding 
92
	 * provider.  This method should be called after RSE startup is complete
93
	 * in order to get the proper default workspace encoding.    
94
	 * 
95
	 * @return the local default encoding
96
	 */
97
	public String getLocalDefaultEncoding() {
98
	   return _defaultEncodingProvider.getLocalDefaultEncoding();
99
	}
100
101
	   
55
	/**
102
	/**
56
	 * Gets the encoding of the environment. This is the encoding being used by the JVM,
103
	 * Gets the encoding of the environment. This is the encoding being used by the JVM,
57
	 * which by default is the machine encoding, unless changed explicitly.
104
	 * which by default is the machine encoding, unless changed explicitly.
(-)META-INF/MANIFEST.MF (-1 / +1 lines)
Lines 15-21 Link Here
15
Bundle-ActivationPolicy: lazy
15
Bundle-ActivationPolicy: lazy
16
Eclipse-LazyStart: true
16
Eclipse-LazyStart: true
17
Bundle-Vendor: %providerName
17
Bundle-Vendor: %providerName
18
Bundle-RequiredExecutionEnvironment: J2SE-1.4
18
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
19
Export-Package: org.eclipse.rse.internal.dstore.security;x-internal:=true,
19
Export-Package: org.eclipse.rse.internal.dstore.security;x-internal:=true,
20
 org.eclipse.rse.internal.dstore.security.preference;x-internal:=true,
20
 org.eclipse.rse.internal.dstore.security.preference;x-internal:=true,
21
 org.eclipse.rse.internal.dstore.security.util;x-internal:=true,
21
 org.eclipse.rse.internal.dstore.security.util;x-internal:=true,
(-)src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java (-2 / +4 lines)
Lines 8-13 Link Here
8
 * Contributors:
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
9
 *     IBM Corporation - initial API and implementation
10
 * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
10
 * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
11
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
11
 *******************************************************************************/
12
 *******************************************************************************/
12
package org.eclipse.rse.internal.importexport.files;
13
package org.eclipse.rse.internal.importexport.files;
13
14
Lines 21-27 Link Here
21
import org.eclipse.core.runtime.IPath;
22
import org.eclipse.core.runtime.IPath;
22
import org.eclipse.core.runtime.NullProgressMonitor;
23
import org.eclipse.core.runtime.NullProgressMonitor;
23
import org.eclipse.rse.core.model.IHost;
24
import org.eclipse.rse.core.model.IHost;
24
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
25
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
25
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
26
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
26
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
27
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
27
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
Lines 99-105 Link Here
99
			// for windows
99
			// for windows
100
			dest = dest.replace('/', sep);
100
			dest = dest.replace('/', sep);
101
		}
101
		}
102
		rfss.upload(file.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, dest, System.getProperty("file.encoding"), new NullProgressMonitor()); //$NON-NLS-1$
102
		String localEncoding = file.getCharset();
103
		String hostEncoding = Utilities.getIRemoteFile(_host, dest).getEncoding();
104
		rfss.upload(file.getLocation().makeAbsolute().toOSString(), localEncoding, dest, hostEncoding, new NullProgressMonitor()); //$NON-NLS-1$
103
	}
105
	}
104
106
105
	/**
107
	/**
(-)src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java (-3 / +3 lines)
Lines 10-19 Link Here
10
 * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
10
 * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
11
 * 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
11
 * 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
12
 * David McKnight   (IBM)        - [223204] [cleanup] fix broken nls strings in files.ui and others
12
 * David McKnight   (IBM)        - [223204] [cleanup] fix broken nls strings in files.ui and others
13
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
13
 *******************************************************************************/
14
 *******************************************************************************/
14
package org.eclipse.rse.internal.importexport.files;
15
package org.eclipse.rse.internal.importexport.files;
15
16
16
import java.io.ByteArrayInputStream;
17
imimport java.io.ByteArrayInputStream;
17
import java.io.ByteArrayOutputStream;
18
import java.io.ByteArrayOutputStream;
18
import java.io.File;
19
import java.io.File;
19
import java.io.IOException;
20
import java.io.IOException;
Lines 49-55 Link Here
49
import org.eclipse.ui.actions.WorkspaceModifyOperation;
50
import org.eclipse.ui.actions.WorkspaceModifyOperation;
50
import org.eclipse.ui.dialogs.ContainerGenerator;
51
import org.eclipse.ui.dialogs.ContainerGenerator;
51
import org.eclipse.ui.dialogs.IOverwriteQuery;
52
import org.eclipse.ui.dialogs.IOverwriteQuery;
52
53
// Similar to org.eclipse.ui.wizards.datatransfer.ImportOperation
53
// Similar to org.eclipse.ui.wizards.datatransfer.ImportOperation
54
/**
54
/**
55
 * An operation which does the actual work of copying objects from the local
55
 * An operation which does the actual work of copying objects from the local
Lines 463-469 Link Here
463
			// 030820: added the following kludge to circumvent problem in
463
			// 030820: added the following kludge to circumvent problem in
464
			// artemis.  (artemis 3 will fix this)
464
			// artemis.  (artemis 3 will fix this)
465
			// TODO remove for 6.0
465
			// TODO remove for 6.0
466
			String encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
466
			String encoding = ((UniFilePlus) fileObject).remoteFile.getEncoding();
467
			if (encoding.startsWith("CP")) //$NON-NLS-1$
467
			if (encoding.startsWith("CP")) //$NON-NLS-1$
468
			{
468
			{
469
				encoding = "Cp" + encoding.substring(2); //$NON-NLS-1$
469
				encoding = "Cp" + encoding.substring(2); //$NON-NLS-1$
(-)src/org/eclipse/rse/internal/core/RSEInitJob.java (+13 lines)
Lines 7-12 Link Here
7
 * Contributors:
7
 * Contributors:
8
 * David Dykstal (IBM) - [197167] adding notification and waiting for RSE model
8
 * David Dykstal (IBM) - [197167] adding notification and waiting for RSE model
9
 * David Dykstal (IBM) - [226728] NPE during init with clean workspace
9
 * David Dykstal (IBM) - [226728] NPE during init with clean workspace
10
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
10
 ********************************************************************************/
11
 ********************************************************************************/
11
package org.eclipse.rse.internal.core;
12
package org.eclipse.rse.internal.core;
12
13
Lines 15-20 Link Here
15
import java.util.ArrayList;
16
import java.util.ArrayList;
16
import java.util.List;
17
import java.util.List;
17
18
19
import org.eclipse.core.resources.ResourcesPlugin;
18
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.CoreException;
19
import org.eclipse.core.runtime.IConfigurationElement;
21
import org.eclipse.core.runtime.IConfigurationElement;
20
import org.eclipse.core.runtime.IPath;
22
import org.eclipse.core.runtime.IPath;
Lines 36-41 Link Here
36
import org.eclipse.rse.internal.core.model.SystemModelChangeEvent;
38
import org.eclipse.rse.internal.core.model.SystemModelChangeEvent;
37
import org.eclipse.rse.internal.core.model.SystemProfileManager;
39
import org.eclipse.rse.internal.core.model.SystemProfileManager;
38
import org.eclipse.rse.logging.Logger;
40
import org.eclipse.rse.logging.Logger;
41
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
39
42
40
/**
43
/**
41
 * This is a job named "Initialize RSE". It is instantiated and run during
44
 * This is a job named "Initialize RSE". It is instantiated and run during
Lines 203-208 Link Here
203
			}
206
			}
204
			submonitor.done();
207
			submonitor.done();
205
		}
208
		}
209
		
210
		// set the default encoding provider
211
		SystemEncodingUtil encodingUtil = SystemEncodingUtil.getInstance();
212
		encodingUtil.setDefaultEncodingProvider(
213
				new SystemEncodingUtil.DefaultEncodingProvider(){
214
					   public String getLocalDefaultEncoding() {
215
						   return ResourcesPlugin.getEncoding();						  
216
					   }
217
				});
218
		
206
		initializerPhase.done();
219
		initializerPhase.done();
207
		// finish up - propogate cancel if necessary
220
		// finish up - propogate cancel if necessary
208
		if (monitor.isCanceled()) {
221
		if (monitor.isCanceled()) {
(-)src/org/eclipse/rse/internal/services/dstore/files/DStoreFileService.java (-48 / +63 lines)
Lines 41-47 Link Here
41
 * David McKnight    (IBM)       - [220379] [api] Provide a means for contributing custom BIDI encodings
41
 * David McKnight    (IBM)       - [220379] [api] Provide a means for contributing custom BIDI encodings
42
 * David McKnight    (IBM)       - [225573] [dstore] client not falling back to single operation when missing batch descriptors (due to old server)
42
 * David McKnight    (IBM)       - [225573] [dstore] client not falling back to single operation when missing batch descriptors (due to old server)
43
 * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
43
 * Martin Oberhuber (Wind River) - [226262] Make IService IAdaptable
44
 * David McKnight     (IBM)    - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider
44
 * David McKnight     (IBM)      - [227406][api][dstore] need apis for getting buffer size in IDataStoreProvider
45
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
46
 * David McKnight     (IBM)      - [221211] [api][breaking][files] need batch operations to indicate which operations were successful
45
 *******************************************************************************/
47
 *******************************************************************************/
46
48
47
package org.eclipse.rse.internal.services.dstore.files;
49
package org.eclipse.rse.internal.services.dstore.files;
Lines 80-85 Link Here
80
import org.eclipse.rse.services.clientserver.ISystemFileTypes;
82
import org.eclipse.rse.services.clientserver.ISystemFileTypes;
81
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
83
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
82
import org.eclipse.rse.services.clientserver.PathUtility;
84
import org.eclipse.rse.services.clientserver.PathUtility;
85
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
83
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
86
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
84
import org.eclipse.rse.services.clientserver.messages.CommonMessages;
87
import org.eclipse.rse.services.clientserver.messages.CommonMessages;
85
import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
88
import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
Lines 98-103 Link Here
98
import org.eclipse.rse.services.files.IHostFilePermissions;
101
import org.eclipse.rse.services.files.IHostFilePermissions;
99
import org.eclipse.rse.services.files.IHostFilePermissionsContainer;
102
import org.eclipse.rse.services.files.IHostFilePermissionsContainer;
100
import org.eclipse.rse.services.files.PendingHostFilePermissions;
103
import org.eclipse.rse.services.files.PendingHostFilePermissions;
104
import org.eclipse.rse.services.files.RemoteFileCancelledException;
105
import org.eclipse.rse.services.files.RemoteFileIOException;
101
import org.eclipse.rse.services.files.RemoteFileSecurityException;
106
import org.eclipse.rse.services.files.RemoteFileSecurityException;
102
107
103
public class DStoreFileService extends AbstractDStoreService implements IFileService, IFilePermissionsService
108
public class DStoreFileService extends AbstractDStoreService implements IFileService, IFilePermissionsService
Lines 268-274 Link Here
268
273
269
274
270
	public boolean upload(InputStream inputStream, String remoteParent, String remoteFile, boolean isBinary,
275
	public boolean upload(InputStream inputStream, String remoteParent, String remoteFile, boolean isBinary,
271
			String hostEncoding, IProgressMonitor monitor)
276
			String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
272
	{
277
	{
273
		BufferedInputStream bufInputStream = null;
278
		BufferedInputStream bufInputStream = null;
274
279
Lines 396-421 Link Here
396
		catch (FileNotFoundException e)
401
		catch (FileNotFoundException e)
397
		{
402
		{
398
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
403
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
399
//			throw new RemoteFileIOException(e);
404
			throw new RemoteFileIOException(e);
400
			return false;
401
		}
405
		}
402
		catch (UnsupportedEncodingException e)
406
		catch (UnsupportedEncodingException e)
403
		{
407
		{
404
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
408
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
405
//			throw new RemoteFileIOException(e);
409
			throw new RemoteFileIOException(e);
406
			return false;
407
		}
410
		}
408
		catch (IOException e)
411
		catch (IOException e)
409
		{
412
		{
410
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
413
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
411
//			throw new RemoteFileIOException(e);
414
			throw new RemoteFileIOException(e);			
412
			return false;
413
		}
415
		}
414
		catch (Exception e)
416
		catch (Exception e)
415
		{
417
		{
416
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
418
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
417
//			throw new RemoteFileIOException(e);
419
			throw new RemoteFileIOException(e);
418
			return false;
419
		}
420
		}
420
		finally
421
		finally
421
		{
422
		{
Lines 428-442 Link Here
428
429
429
				if (isCancelled)
430
				if (isCancelled)
430
				{
431
				{
431
					return false;
432
					throw new RemoteFileCancelledException();
432
					//throw new RemoteFileCancelledException();
433
				}
433
				}
434
			}
434
			}
435
			catch (IOException e)
435
			catch (IOException e)
436
			{
436
			{
437
//				UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
437
//				UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
438
//				throw new RemoteFileIOException(e);
438
				throw new RemoteFileIOException(e);
439
				return false;
440
			}
439
			}
441
440
442
		}
441
		}
Lines 446-452 Link Here
446
445
447
446
448
	public boolean upload(File file, String remoteParent, String remoteFile, boolean isBinary,
447
	public boolean upload(File file, String remoteParent, String remoteFile, boolean isBinary,
449
			String srcEncoding, String hostEncoding, IProgressMonitor monitor)
448
			String srcEncoding, String hostEncoding, IProgressMonitor monitor) throws SystemMessageException
450
	{
449
	{
451
		FileInputStream inputStream = null;
450
		FileInputStream inputStream = null;
452
		BufferedInputStream bufInputStream = null;
451
		BufferedInputStream bufInputStream = null;
Lines 595-620 Link Here
595
		catch (FileNotFoundException e)
594
		catch (FileNotFoundException e)
596
		{
595
		{
597
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
596
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
598
//			throw new RemoteFileIOException(e);
597
			throw new RemoteFileIOException(e);
599
			return false;
600
		}
598
		}
601
		catch (UnsupportedEncodingException e)
599
		catch (UnsupportedEncodingException e)
602
		{
600
		{
603
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
601
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
604
//			throw new RemoteFileIOException(e);
602
			throw new RemoteFileIOException(e);
605
			return false;
606
		}
603
		}
607
		catch (IOException e)
604
		catch (IOException e)
608
		{
605
		{
609
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
606
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
610
//			throw new RemoteFileIOException(e);
607
			throw new RemoteFileIOException(e);
611
			return false;
612
		}
608
		}
613
		catch (Exception e)
609
		catch (Exception e)
614
		{
610
		{
615
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
611
//			UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
616
//			throw new RemoteFileIOException(e);
612
			throw new RemoteFileIOException(e);
617
			return false;
618
		}
613
		}
619
		finally
614
		finally
620
		{
615
		{
Lines 627-641 Link Here
627
622
628
				if (isCancelled)
623
				if (isCancelled)
629
				{
624
				{
630
					return false;
625
					throw new RemoteFileCancelledException();
631
					//throw new RemoteFileCancelledException();
632
				}
626
				}
633
			}
627
			}
634
			catch (IOException e)
628
			catch (IOException e)
635
			{
629
			{
636
//				UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
630
//				UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error writing file " + remotePath, e);
637
//				throw new RemoteFileIOException(e);
631
				throw new RemoteFileIOException(e);
638
				return false;
639
			}
632
			}
640
633
641
			if (totalBytes > 0)
634
			if (totalBytes > 0)
Lines 680-686 Link Here
680
673
681
		if (!makeSureLocalExists(localFile))
674
		if (!makeSureLocalExists(localFile))
682
		{
675
		{
683
			return false;
676
			FileNotFoundException e = new FileNotFoundException();
677
			throw new RemoteFileIOException(e);
684
		}
678
		}
685
679
686
680
Lines 742-748 Link Here
742
		}
736
		}
743
		catch (Exception e)
737
		catch (Exception e)
744
		{
738
		{
745
			return false;
739
			throw new RemoteFileIOException(e);
746
		}
740
		}
747
741
748
	//long t2 = System.currentTimeMillis();
742
	//long t2 = System.currentTimeMillis();
Lines 761-766 Link Here
761
			}
755
			}
762
			catch (Exception e)
756
			catch (Exception e)
763
			{
757
			{
758
				throw new RemoteFileIOException(e);
764
			}
759
			}
765
		}
760
		}
766
761
Lines 775-781 Link Here
775
			if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_SUCCESS_TYPE))
770
			if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_SUCCESS_TYPE))
776
			{
771
			{
777
				if (!isBinary){ // do standard conversion if this is text!
772
				if (!isBinary){ // do standard conversion if this is text!
778
					String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
773
					String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
779
774
780
					IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(encoding, this);
775
					IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(encoding, this);
781
776
Lines 801-809 Link Here
801
			{
796
			{
802
				//SystemMessage msg = getMessage();
797
				//SystemMessage msg = getMessage();
803
				//throw new SystemMessageException(msg);
798
				//throw new SystemMessageException(msg);
804
				//UnsupportedEncodingException e = new UnsupportedEncodingException(resultChild.getName());
799
				UnsupportedEncodingException e = new UnsupportedEncodingException(resultChild.getName());
805
				//UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error reading file " + remotePath, e);
800
				//UniversalSystemPlugin.logError(CLASSNAME + "." + "copy: " + "error reading file " + remotePath, e);
806
				//throw new RemoteFileIOException(e);
801
				throw new RemoteFileIOException(e);
807
			}
802
			}
808
803
809
			else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION))
804
			else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_IO_EXCEPTION))
Lines 846-852 Link Here
846
		}
841
		}
847
		catch (IOException e)
842
		catch (IOException e)
848
		{
843
		{
849
			return false;
844
			throw new RemoteFileIOException(e);
850
		}
845
		}
851
		return true;
846
		return true;
852
	}
847
	}
Lines 913-919 Link Here
913
908
914
			if (!makeSureLocalExists(localFile))
909
			if (!makeSureLocalExists(localFile))
915
			{
910
			{
916
				return false;
911
				FileNotFoundException e = new FileNotFoundException();
912
				throw new RemoteFileIOException(e);
917
			}
913
			}
918
914
919
			long fileLength = DStoreHostFile.getFileLength(de.getSource());
915
			long fileLength = DStoreHostFile.getFileLength(de.getSource());
Lines 942-952 Link Here
942
			DataElement subject = ds.createObject(universaltemp, de.getType(), remotePath, String.valueOf(mode));
938
			DataElement subject = ds.createObject(universaltemp, de.getType(), remotePath, String.valueOf(mode));
943
939
944
			DataElement status = ds.command(queryCmd, argList, subject);
940
			DataElement status = ds.command(queryCmd, argList, subject);
945
			if (status == null)
946
			{
947
				System.out.println("no download descriptor for "+remoteElement); //$NON-NLS-1$
948
				return false;
949
			}
950
941
951
			DownloadListener dlistener = new DownloadListener(status, localFile, remotePath, fileLength, monitor);
942
			DownloadListener dlistener = new DownloadListener(status, localFile, remotePath, fileLength, monitor);
952
			downloadListeners.add(dlistener);
943
			downloadListeners.add(dlistener);
Lines 981-987 Link Here
981
			}
972
			}
982
			catch (Exception e)
973
			catch (Exception e)
983
			{
974
			{
984
				return false;
975
				throw new RemoteFileIOException(e);
985
			}
976
			}
986
977
987
			// now wait till we have all the bytes local
978
			// now wait till we have all the bytes local
Lines 1000-1005 Link Here
1000
				}
991
				}
1001
				catch (Exception e)
992
				catch (Exception e)
1002
				{
993
				{
994
					throw new RemoteFileIOException(e);
1003
				}
995
				}
1004
			}
996
			}
1005
997
Lines 1018-1024 Link Here
1018
					{
1010
					{
1019
						// do standard conversion if this is text!
1011
						// do standard conversion if this is text!
1020
						if (!isBinaries[i]){ // do standard conversion if this is text!
1012
						if (!isBinaries[i]){ // do standard conversion if this is text!
1021
							String localEncoding = System.getProperty("file.encoding"); //$NON-NLS-1$
1013
							String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
1022
							IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncodings[i], this);
1014
							IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncodings[i], this);
1023
1015
1024
							codePageConverter.convertFileFromRemoteEncoding(remoteElement.getName(), localFile, hostEncodings[i], localEncoding, this);
1016
							codePageConverter.convertFileFromRemoteEncoding(remoteElement.getName(), localFile, hostEncodings[i], localEncoding, this);
Lines 1369-1375 Link Here
1369
		String remotePath = remoteParent + getSeparator(remoteParent) + fileName;
1361
		String remotePath = remoteParent + getSeparator(remoteParent) + fileName;
1370
		DataElement de = getElementFor(remotePath);
1362
		DataElement de = getElementFor(remotePath);
1371
		DataElement status = dsStatusCommand(de, IUniversalDataStoreConstants.C_DELETE, monitor);
1363
		DataElement status = dsStatusCommand(de, IUniversalDataStoreConstants.C_DELETE, monitor);
1372
		if (status == null) return false;
1364
		if (status == null) 
1365
			throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
1366
					ICommonMessageIds.MSG_ERROR_UNEXPECTED,
1367
					IStatus.ERROR,
1368
					CommonMessages.MSG_ERROR_UNEXPECTED));
1369
1373
		if (null != monitor && monitor.isCanceled())
1370
		if (null != monitor && monitor.isCanceled())
1374
		{
1371
		{
1375
			//This operation has been cancelled by the user.
1372
			//This operation has been cancelled by the user.
Lines 1484-1491 Link Here
1484
		}
1481
		}
1485
1482
1486
1483
1487
1484
		if (status == null)
1488
		if (status == null) return false;
1485
			throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
1486
					ICommonMessageIds.MSG_ERROR_UNEXPECTED,
1487
					IStatus.ERROR,
1488
					CommonMessages.MSG_ERROR_UNEXPECTED));
1489
		
1489
		if (null != monitor && monitor.isCanceled())
1490
		if (null != monitor && monitor.isCanceled())
1490
		{
1491
		{
1491
			SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
1492
			SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
Lines 1720-1726 Link Here
1720
			}
1721
			}
1721
			return true;
1722
			return true;
1722
		}
1723
		}
1723
		return false;
1724
		else {
1725
			throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
1726
					ICommonMessageIds.MSG_ERROR_UNEXPECTED,
1727
					IStatus.ERROR,
1728
					CommonMessages.MSG_ERROR_UNEXPECTED));
1729
		}
1724
	}
1730
	}
1725
1731
1726
	public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
1732
	public boolean copyBatch(String[] srcParents, String[] srcNames, String tgtParent, IProgressMonitor monitor) throws SystemMessageException
Lines 2059-2066 Link Here
2059
				return true;
2065
				return true;
2060
			}
2066
			}
2061
		}
2067
		}
2062
2068
		else {
2063
		return false;
2069
			throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
2070
					ICommonMessageIds.MSG_ERROR_UNEXPECTED,
2071
					IStatus.ERROR,
2072
					CommonMessages.MSG_ERROR_UNEXPECTED));
2073
		}
2064
	}
2074
	}
2065
2075
2066
	public boolean setReadOnly(String parent, String name,
2076
	public boolean setReadOnly(String parent, String name,
Lines 2088-2094 Link Here
2088
				return true;
2098
				return true;
2089
			}
2099
			}
2090
		}
2100
		}
2091
		return false;
2101
		else {
2102
			throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
2103
					ICommonMessageIds.MSG_ERROR_UNEXPECTED,
2104
					IStatus.ERROR,
2105
					CommonMessages.MSG_ERROR_UNEXPECTED));
2106
		}
2092
	}
2107
	}
2093
2108
2094
	/**
2109
	/**
(-)src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java (-1 / +2 lines)
Lines 75-80 Link Here
75
import org.eclipse.rse.services.clientserver.IClientServerConstants;
75
import org.eclipse.rse.services.clientserver.IClientServerConstants;
76
import org.eclipse.rse.services.clientserver.IMatcher;
76
import org.eclipse.rse.services.clientserver.IMatcher;
77
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
77
import org.eclipse.rse.services.clientserver.NamePatternMatcher;
78
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
78
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
79
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
79
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
80
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
80
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
81
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
Lines 1466-1472 Link Here
1466
			return encoding;
1467
			return encoding;
1467
		}
1468
		}
1468
		else {
1469
		else {
1469
			return System.getProperty("file.encoding"); //$NON-NLS-1$
1470
			return SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
1470
		}
1471
		}
1471
	}
1472
	}
1472
}
1473
}
(-)UI/org/eclipse/rse/ui/SystemConnectionForm.java (-1 / +4 lines)
Lines 21-26 Link Here
21
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
21
 * Martin Oberhuber (Wind River) - [186773] split ISystemRegistryUI from ISystemRegistry
22
 * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
22
 * Martin Oberhuber (Wind River) - [186779] Fix IRSESystemType.getAdapter()
23
 * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
23
 * Martin Oberhuber (Wind River) - [175680] Deprecate obsolete ISystemRegistry methods
24
 * David McKnight     (IBM)      - [229610] [api] File transfers should use workspace text file encoding
24
 ********************************************************************************/
25
 ********************************************************************************/
25
26
26
package org.eclipse.rse.ui;
27
package org.eclipse.rse.ui;
Lines 49-54 Link Here
49
import org.eclipse.rse.core.model.ISystemProfile;
50
import org.eclipse.rse.core.model.ISystemProfile;
50
import org.eclipse.rse.core.model.ISystemRegistry;
51
import org.eclipse.rse.core.model.ISystemRegistry;
51
import org.eclipse.rse.internal.ui.SystemResources;
52
import org.eclipse.rse.internal.ui.SystemResources;
53
import org.eclipse.rse.services.clientserver.SystemEncodingUtil;
52
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
54
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
53
import org.eclipse.rse.ui.dialogs.ISystemPromptDialog;
55
import org.eclipse.rse.ui.dialogs.ISystemPromptDialog;
54
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
56
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
Lines 959-965 Link Here
959
				otherEncodingCombo.setText(defaultEncoding);
961
				otherEncodingCombo.setText(defaultEncoding);
960
			}
962
			}
961
			else {
963
			else {
962
				otherEncodingCombo.setText(System.getProperty("file.encoding")); //$NON-NLS-1$
964
				String workspaceDefault = SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
965
				otherEncodingCombo.setText(workspaceDefault); //$NON-NLS-1$
963
			}
966
			}
964
		}
967
		}
965
		
968
		

Return to bug 229610