Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 327495 - [dstore] CodePageConverter error during source look up
Summary: [dstore] CodePageConverter error during source look up
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-11 21:19 EDT by Samuel Wu CLA
Modified: 2010-10-12 16:05 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Wu CLA 2010-10-11 21:19:07 EDT
Build Identifier: 

When debugging a remote program, the source code is on a host which has a different encoding than the local machine. The exception is thrown trying to do the code page conerting.

Reproducible: Always

Steps to Reproduce:
1. Clear RSE cache
2. Start a debug session 
3. Let the source to be found on a host which has a different encoding( for instance a zOS system)
4. The following exception would be thrown.
java.nio.charset.UnmappableCharacterException: Input length = 1
java.nio.charset.UnmappableCharacterException: Input length = 1
	at java.nio.charset.CoderResult.throwException(CoderResult.java:273)
	at java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:793)
	at org.eclipse.rse.services.files.DefaultFileServiceCodePageConverter.convertFileFromRemoteEncoding(DefaultFileServiceCodePageConverter.java:77)
	at org.eclipse.rse.internal.services.dstore.files.DStoreFileService.download(DStoreFileService.java:847)
	at org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem.download(FileServiceSubSystem.java:807)
	at org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile.doDownload(SystemEditableRemoteFile.java:658)
	at org.eclipse.rse.files.ui.resources.SystemEditableRemoteFile.download(SystemEditableRemoteFile.java:637)
	at com.ibm.etools.systems.launch.sourceLookup.AbstractRemoteSourceContainer$SearchSourceRunnable.run(AbstractRemoteSourceContainer.java:623)
	at com.ibm.etools.systems.launch.sourceLookup.AbstractRemoteSourceContainer$SearchRunnable.run(AbstractRemoteSourceContainer.java:475)
	at com.ibm.etools.systems.launch.sourceLookup.AbstractRemoteSourceContainer.search(AbstractRemoteSourceContainer.java:419)
	at com.ibm.etools.systems.launch.sourceLookup.AbstractRemoteSourceContainer.findSourceElements(AbstractRemoteSourceContainer.java:316)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant.findSourceElements(AbstractSourceLookupParticipant.java:67)
	at com.ibm.debug.pdt.core.sourcelocator.PDTSourceLookupParticipant.findSource(PDTSourceLookupParticipant.java:154)
	at com.ibm.debug.pdt.core.sourcelocator.PDTSourceLookupParticipant.findSourceElements(PDTSourceLookupParticipant.java:122)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$SourceLookupQuery.run(AbstractSourceLookupDirector.java:141)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.doSourceLookup(AbstractSourceLookupDirector.java:490)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement(AbstractSourceLookupDirector.java:758)
	at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.lookup(SourceLookupFacility.java:148)
	at org.eclipse.debug.ui.DebugUITools.lookupSource(DebugUITools.java:777)
	at org.eclipse.debug.internal.ui.elements.adapters.StackFrameSourceDisplayAdapter$SourceLookupJob.run(StackFrameSourceDisplayAdapter.java:109)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 1 Samuel Wu CLA 2010-10-11 21:27:56 EDT
Did a bit of investigation which may help.
Somehow the debugger generated two source lookup request on different thread at the same time as shown in the following stack trace.
Thread [Worker-10] (Suspended (breakpoint at line 51 in DefaultFileServiceCodePageConverter))	
	DefaultFileServiceCodePageConverter.convertFileFromRemoteEncoding(String, File, String, String, IFileService) line: 51	
	DStoreFileService.download(String, String, File, boolean, String, IProgressMonitor) line: 847	
	FileServiceSubSystem.download(IRemoteFile, String, String, IProgressMonitor) line: 807	
	SystemEditableRemoteFile.doDownload(SystemIFileProperties, IProgressMonitor) line: 659	
	SystemEditableRemoteFile.download(IProgressMonitor) line: 638	
	AbstractRemoteSourceContainer$SearchSourceRunnable.run(IProgressMonitor) line: 623	
	AbstractRemoteSourceContainer$SearchRunnable.run() line: 475	
	RemoteFolderSourceContainer(AbstractRemoteSourceContainer).search(Shell, String, Object[]) line: 419	
	RemoteFolderSourceContainer(AbstractRemoteSourceContainer).findSourceElements(String) line: 316	
	PDTSourceLookupParticipant(AbstractSourceLookupParticipant).findSourceElements(Object) line: 67	
	PDTSourceLookupParticipant.findSource(Object) line: 154	
	PDTSourceLookupParticipant.findSourceElements(Object) line: 122	
	AbstractSourceLookupDirector$SourceLookupQuery.run() line: 141	
	SafeRunner.run(ISafeRunnable) line: 42	
	PDTSourceLookupDirector(AbstractSourceLookupDirector).doSourceLookup(Object) line: 490	
	PDTSourceLookupDirector(AbstractSourceLookupDirector).getSourceElement(Object) line: 758	
	SourceLookupFacility.lookup(Object, ISourceLocator) line: 148	
	DebugUITools.lookupSource(Object, ISourceLocator) line: 777	
	StackFrameSourceDisplayAdapter$SourceLookupJob.run(IProgressMonitor) line: 109	
	Worker.run() line: 54	
Thread [Thread-25] (Running)	
Thread [TPFTool Command-line Interface Server] (Running)	
Thread [TPF Job Status Server] (Running)	
Daemon Thread [Java indexing] (Running)	
Daemon Thread [SSH] (Running)	
Thread [Thread-45] (Running)	
Thread [DStore UpdateHandlerThread-46] (Running)	
Thread [DStore CommandHandlerThread-47] (Running)	
Thread [DStore ReceiverThread-48] (Running)	
Thread [Worker-11] (Running)	
Thread [Worker-14] (Suspended (breakpoint at line 51 in DefaultFileServiceCodePageConverter))	
	DefaultFileServiceCodePageConverter.convertFileFromRemoteEncoding(String, File, String, String, IFileService) line: 51	
	DStoreFileService.download(String, String, File, boolean, String, IProgressMonitor) line: 847	
	FileServiceSubSystem.download(IRemoteFile, String, String, IProgressMonitor) line: 807	
	SystemEditableRemoteFile.doDownload(SystemIFileProperties, IProgressMonitor) line: 659	
	SystemEditableRemoteFile.download(IProgressMonitor) line: 638	
	AbstractRemoteSourceContainer$SearchSourceRunnable.run(IProgressMonitor) line: 623	
	AbstractRemoteSourceContainer$SearchRunnable.run() line: 475	
	RemoteFolderSourceContainer(AbstractRemoteSourceContainer).search(Shell, String, Object[]) line: 419	
	RemoteFolderSourceContainer(AbstractRemoteSourceContainer).findSourceElements(String) line: 316	
	PDTSourceLookupParticipant(AbstractSourceLookupParticipant).findSourceElements(Object) line: 67	
	PDTSourceLookupParticipant.findSource(Object) line: 154	
	PDTSourceLookupParticipant.findSourceElements(Object) line: 122	
	AbstractSourceLookupDirector$SourceLookupQuery.run() line: 141	
	SafeRunner.run(ISafeRunnable) line: 42	
	PDTSourceLookupDirector(AbstractSourceLookupDirector).doSourceLookup(Object) line: 490	
	PDTSourceLookupDirector(AbstractSourceLookupDirector).getSourceElement(Object) line: 758	
	SourceLookupFacility.lookup(Object, ISourceLocator) line: 148	
	DebugUITools.lookupSource(Object, ISourceLocator) line: 777	
	StackFrameSourceDisplayAdapter$SourceLookupJob.run(IProgressMonitor) line: 109	
	Worker.run() line: 54	

The file was only download from the host once. When the first call to the method DefaultFileServiceCodePageConverter.convertFileFromRemoteEncoding() was made, the file in the RSE cache was of the host encoding (IBM-1047 if the source was on zOS) and the file was converted to the cp1252 successfully. When the second call was made to the method DefaultFileServiceCodePageConverter.convertFileFromRemoteEncoding(), the file was already in the cp1252 encoding because of the first call. So it failed with exception. 
RSE needs to be able to avoid this kind of situation.

Forgot to mention that this is a problem found in RSE 3.2.1.
Comment 2 David McKnight CLA 2010-10-12 09:39:19 EDT
By any chance does the fix for bug 324669 help with this one?
Comment 3 Samuel Wu CLA 2010-10-12 11:59:26 EDT
We are actually on RSE-runtime-M20101006-1301.zip which contains the fix for bug 324669 but the problem still exists. 
I checked my runtime and it contains the fix. The problem is not fixed.
Comment 4 Samuel Wu CLA 2010-10-12 16:05:29 EDT
RemoteFolderSourceContainer is going to be updated to avoid the second file download. The original issue is addressed outside Eclipse. I'm closing the bug.