Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 307033

Summary: IllegalArgumentException when recording using a workspace with different URI schemes.
Product: z_Archived Reporter: Paul Slauenwhite <paulslau>
Component: TPTPAssignee: Paul Slauenwhite <paulslau>
Status: CLOSED FIXED QA Contact: Kathy Chan <kathy>
Severity: critical    
Priority: P1 CC: ewchan, kathy, paulslau
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: adopter
Attachments:
Description Flags
Patch. none

Description Paul Slauenwhite CLA 2010-03-25 06:23:25 EDT
IllegalArgumentException when recording using a workspace with different URI schemes.

When URL recording using a workspace with different URI schemes (for example, a Jazz client that uses sourcecontrol://jazz/default/<plug-in name>/...), the following exception is thrown:

java.lang.IllegalArgumentException: URI scheme is not "file"
	at java.io.File.<init>(File.java:366)
	at org.eclipse.hyades.internal.execution.recorder.utilities.RecorderFileUtil.fileExists(RecorderFileUtil.java:149)
	at org.eclipse.tptp.test.provisional.recorder.ui.wizards.DefaultRecWizardProvider.doFinish(DefaultRecWizardProvider.java:80)
...

The reason is that org.eclipse.hyades.internal.execution.recorder.utilities.RecorderFileUtil.fileExists(IFile) (and org.eclipse.hyades.internal.execution.recorder.utilities.RecorderFileUtil.deleteFiles(IFile, IFile)) use org.eclipse.core.resources.IResource.getRawLocationURI() to create a new java.io.File from the org.eclipse.core.resources.IFile.  

We need to remove all uses of org.eclipse.core.resources.IResource.getRawLocationURI() and org.eclipse.core.resources.IResource.getLocationURI() and use the following code for resolving java.io.Files from org.eclipse.core.resources.IFiles:

IPath iFilePath = iFile.getLocation();

if (iFilePath != null){
   File file = iFilePath.toFile();
}
Comment 1 Paul Slauenwhite CLA 2010-03-25 06:31:22 EDT
Kathy/Eugene: Please review the Platform/Trace project for calls of org.eclipse.core.resources.IResource.getRawLocationURI() and
org.eclipse.core.resources.IResource.getLocationURI() that expect the file URI scheme.
Comment 2 Paul Slauenwhite CLA 2010-03-25 12:05:23 EDT
Created attachment 163008 [details]
Patch.
Comment 3 Paul Slauenwhite CLA 2010-03-25 13:11:55 EDT
Added two new test cases to /org.eclipse.hyades.test.URLTest.tests/manual/basic_tests/Test.Agents.Recorder.testsuite.  

The attached patch checked in to CVS (HEAD).
Comment 4 Eugene Chan CLA 2010-03-25 13:57:58 EDT
(In reply to comment #1)
> Kathy/Eugene: Please review the Platform/Trace project for calls of
> org.eclipse.core.resources.IResource.getRawLocationURI() and
> org.eclipse.core.resources.IResource.getLocationURI() that expect the file URI
> scheme.


I scanned the Platform/Trace project code and there is no call on the api.
Thanks Paul for pointing this out.
Comment 5 Paul Slauenwhite CLA 2010-08-09 08:02:07 EDT
Verified in consuming product.

Closing.