1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-18 22:45:23 +02:00

[365780] [dstore] codepage conversion should only occur for different encodings

This commit is contained in:
David McKnight 2011-12-06 18:03:40 +00:00
parent a0429d8147
commit 2f4cea89e5

View file

@ -64,6 +64,7 @@
* David McKnight (IBM) - [298440] jar files in a directory can't be pasted to another system properly * David McKnight (IBM) - [298440] jar files in a directory can't be pasted to another system properly
* David McKnight (IBM) - [308770] [dstore] Remote Search using old server fails with NPE * David McKnight (IBM) - [308770] [dstore] Remote Search using old server fails with NPE
* David McKnight (IBM) - [339548] [dstore] shouldn't attempt file conversion on empty files * David McKnight (IBM) - [339548] [dstore] shouldn't attempt file conversion on empty files
* David McKnight (IBM) - [365780] [dstore] codepage conversion should only occur for different encodings
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.services.dstore.files; package org.eclipse.rse.internal.services.dstore.files;
@ -842,6 +843,8 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
if (!isBinary && fileLength > 0){ // do standard conversion if this is text! if (!isBinary && fileLength > 0){ // do standard conversion if this is text!
String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
if (!localEncoding.equals(encoding)) {// only do conversion if the encodings are different and the length is non-zero
IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(encoding, this); IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(encoding, this);
try { try {
@ -865,6 +868,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
} }
} }
} }
}
else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION)) else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION))
{ {
localFile.delete(); localFile.delete();
@ -1092,6 +1096,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
// do standard conversion if this is text! // do standard conversion if this is text!
if (!isBinaries[j] && fileLength > 0){ // do standard conversion if this is text! or if the file is empty if (!isBinaries[j] && fileLength > 0){ // do standard conversion if this is text! or if the file is empty
String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding(); String localEncoding = SystemEncodingUtil.getInstance().getLocalDefaultEncoding();
if (!localEncoding.equals(hostEncodings[j])){
IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncodings[j], this); IFileServiceCodePageConverter codePageConverter = CodePageConverterManager.getCodePageConverter(hostEncodings[j], this);
try { try {
@ -1115,6 +1120,7 @@ public class DStoreFileService extends AbstractDStoreService implements IFileSer
} }
} }
} }
}
else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION)) else if (resultChild.getType().equals(IUniversalDataStoreConstants.DOWNLOAD_RESULT_FILE_NOT_FOUND_EXCEPTION))
{ {
localFile.delete(); localFile.delete();