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

Collapse All | Expand All

(-)clientserver/org/eclipse/rse/services/clientserver/archiveutils/ArchiveHandlerManager.java (-2 / +18 lines)
Lines 13-18 Link Here
13
 * 
13
 * 
14
 * Contributors:
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
15
 * {Name} (company) - description of contribution.
16
 * Xuan Chen        (IBM)        - [194293] [Local][Archives] Saving file second time in an Archive Errors
16
 *******************************************************************************/
17
 *******************************************************************************/
17
18
18
package org.eclipse.rse.services.clientserver.archiveutils;
19
package org.eclipse.rse.services.clientserver.archiveutils;
Lines 367-374 Link Here
367
		String newPath = fullVirtualName;
368
		String newPath = fullVirtualName;
368
		if (j != -1)
369
		if (j != -1)
369
		{
370
		{
370
			realPart = fullVirtualName.substring(0, j) + VIRTUAL_SEPARATOR;
371
			try
371
			newPath = fullVirtualName.substring(j + VIRTUAL_SEPARATOR.length());
372
			{
373
				realPart = fullVirtualName.substring(0, j) + VIRTUAL_SEPARATOR;
374
				if (j + VIRTUAL_SEPARATOR.length() < fullVirtualName.length())
375
				{
376
					newPath = fullVirtualName.substring(j + VIRTUAL_SEPARATOR.length());
377
				}
378
				else
379
				{
380
					//This is the special case where fullVirtualName ends with VIRTUAL_SEPARATOR
381
					newPath = "";   //$NON-NLS-1$
382
				}
383
			}
384
			catch (Exception e)
385
			{
386
				e.printStackTrace();
387
			}
372
		}
388
		}
373
		// use only forward slash separator
389
		// use only forward slash separator
374
		newPath = newPath.replace('\\', '/');
390
		newPath = newPath.replace('\\', '/');
(-)clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java (-5 / +24 lines)
Lines 14-19 Link Here
14
 * Contributors:
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
15
 * {Name} (company) - description of contribution.
16
 * Xuan Chen        (IBM)        - [192741] [Archives] Move a folder from within an Archive doesn't work if > 1 level deep
16
 * Xuan Chen        (IBM)        - [192741] [Archives] Move a folder from within an Archive doesn't work if > 1 level deep
17
 * Xuan Chen        (IBM)        - [194293] [Local][Archives] Saving file second time in an Archive Errors
17
 *******************************************************************************/
18
 *******************************************************************************/
18
19
19
package org.eclipse.rse.services.clientserver.archiveutils;
20
package org.eclipse.rse.services.clientserver.archiveutils;
Lines 907-916 Link Here
907
			for (int i = 0; i < numFiles; i++)
908
			for (int i = 0; i < numFiles; i++)
908
			{		
909
			{		
909
				if (!files[i].exists() || !files[i].canRead()) return false;
910
				if (!files[i].exists() || !files[i].canRead()) return false;
910
				if (exists(virtualPath + "/" + names[i])) //$NON-NLS-1$
911
				String fullVirtualName = null;
912
				if (virtualPath == null || virtualPath.length() == 0)
913
				{
914
					fullVirtualName = names[i];
915
				}
916
				else
917
				{
918
					fullVirtualName = virtualPath + "/" + names[i];  //$NON-NLS-1$
919
				}
920
				if (exists(fullVirtualName)) 
911
				{
921
				{
912
					// sorry, wrong method buddy
922
					// sorry, wrong method buddy
913
					return replace(virtualPath + "/" + names[i], files[i], names[i]); //$NON-NLS-1$
923
					return replace(fullVirtualName, files[i], names[i]); 
914
				}
924
				}
915
			}
925
			}
916
			File outputTempFile;
926
			File outputTempFile;
Lines 2182-2193 Link Here
2182
	{
2192
	{
2183
		if (!_exists) return false;
2193
		if (!_exists) return false;
2184
		virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
2194
		virtualPath = ArchiveHandlerManager.cleanUpVirtualPath(virtualPath);
2195
		
2185
		if (!file.isDirectory())
2196
		if (!file.isDirectory())
2186
		{
2197
		{
2187
			if (exists(virtualPath + "/" + name)) //$NON-NLS-1$
2198
			String fullVirtualName = null;
2199
			if (virtualPath == null || virtualPath.length() == 0)
2188
			{
2200
			{
2189
				// wrong method
2201
				fullVirtualName = name;
2190
				return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$
2202
			}
2203
			else
2204
			{
2205
				fullVirtualName = virtualPath + "/" + name;  //$NON-NLS-1$
2206
			}
2207
			if (exists(fullVirtualName)) 
2208
			{
2209
				return replace(fullVirtualName, file, name);
2191
			}
2210
			}
2192
			else
2211
			else
2193
			{
2212
			{
(-)clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemTarHandler.java (-4 / +23 lines)
Lines 13-18 Link Here
13
 * 
13
 * 
14
 * Contributors:
14
 * Contributors:
15
 * {Name} (company) - description of contribution.
15
 * {Name} (company) - description of contribution.
16
 * Xuan Chen        (IBM)        - [194293] [Local][Archives] Saving file second time in an Archive Errors
16
 *******************************************************************************/
17
 *******************************************************************************/
17
18
18
package org.eclipse.rse.services.clientserver.archiveutils;
19
package org.eclipse.rse.services.clientserver.archiveutils;
Lines 1013-1020 Link Here
1013
		if (!file.isDirectory()) {
1014
		if (!file.isDirectory()) {
1014
			
1015
			
1015
			// if it exists, call replace
1016
			// if it exists, call replace
1016
			if (exists(virtualPath + "/" + name)) { //$NON-NLS-1$
1017
			String fullVirtualName = null;
1017
				return replace(virtualPath + "/" + name, file, name); //$NON-NLS-1$
1018
			if (virtualPath == null || virtualPath.length() == 0)
1019
			{
1020
				fullVirtualName = name;
1021
			}
1022
			else
1023
			{
1024
				fullVirtualName = virtualPath + "/" + name;  //$NON-NLS-1$
1025
			}
1026
			if (exists(fullVirtualName)) { 
1027
				return replace(fullVirtualName, file, name); 
1018
			}
1028
			}
1019
			else {
1029
			else {
1020
				File[] files = new File[1];
1030
				File[] files = new File[1];
Lines 1099-1106 Link Here
1099
			// if the entry already exists, then we should do a replace
1109
			// if the entry already exists, then we should do a replace
1100
			// TODO (KM): should we simply replace and return?
1110
			// TODO (KM): should we simply replace and return?
1101
			// I think we should check each entry and replace or create for each one
1111
			// I think we should check each entry and replace or create for each one
1102
			if (exists(virtualPath + "/" + names[i])) { //$NON-NLS-1$
1112
			String fullVirtualName = null;
1103
				return replace(virtualPath + "/" + names[i], files[i], names[i]); //$NON-NLS-1$
1113
			if (virtualPath == null || virtualPath.length() == 0)
1114
			{
1115
				fullVirtualName = names[i];
1116
			}
1117
			else
1118
			{
1119
				fullVirtualName = virtualPath + "/" + names[i];  //$NON-NLS-1$
1120
			}
1121
			if (exists(fullVirtualName)) { 
1122
				return replace(fullVirtualName, files[i], names[i]); 
1104
			}
1123
			}
1105
		}
1124
		}
1106
		
1125
		

Return to bug 194293