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

Bug 366652

Summary: Update Dependencies Dialog throws IllegalArgumentException if maven project is stored within Jazz source control
Product: z_Archived Reporter: matt_ponsford
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: antoine.de.troostembergh, igor, matt_ponsford, Michael.Valenta, remy.suen, salonzo
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
.log file from eclipse workspace showing the IllegalArgumentException
none
Patch that fixes this issue on the m2e-1.0.x stream.
none
Patch that fixes this issue on the m2e-1.0.x stream without RTC specific coding. igor: iplog+

Description matt_ponsford CLA 2011-12-13 19:44:31 EST
Created attachment 208362 [details]
.log file from eclipse workspace showing the IllegalArgumentException

We use m2eclipse to manage our maven projects, which are stored in Rational Team Concert (RTC) source control (a Jazz-based source control system). An exception is thrown when selecting 'Update Dependencies' on these projects.

Preconditions:
 - You have RTC source control set up, containing maven projects.
 - m2eclipse plugin installed
 - RTC eclipse client installed (http://publib.boulder.ibm.com/infocenter/rtc/v2r0m0/index.jsp?topic=/com.ibm.team.platform.doc/topics/c_rtc_client_eclipse_ide.html)

Reproduction steps:
 1. Load maven projects from RTC workspace into Eclipse
 2. Configure maven nature for the project.
 3. Select Update Dependencies on a maven project

Expected:
 Selecting 'Update Dependencies...' should open a dialog
Actual:
 No dialog opens, IllegalArgumentException appears in the Eclipse .log file.

Log is attached.

The relevant stacktrace is:
java.lang.IllegalArgumentException: URI scheme is not "file"
	at java.io.File.<init>(File.java:377)
	at org.eclipse.m2e.core.ui.internal.dialogs.UpdateDepenciesDialog.getMavenCodebases(UpdateDepenciesDialog.java:311)
	at org.eclipse.m2e.core.ui.internal.dialogs.UpdateDepenciesDialog.createDialogArea(UpdateDepenciesDialog.java:192)
	at org.eclipse.jface.dialogs.TitleAreaDialog.createContents(TitleAreaDialog.java:155)
	at org.eclipse.jface.window.Window.create(Window.java:431)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1089)
	at org.eclipse.jface.window.Window.open(Window.java:790)
	at org.eclipse.m2e.core.ui.internal.actions.UpdateDependenciesAction.run(UpdateDependenciesAction.java:32)


Looks like UpdateDependenciesDialog is making the assumption that a call to getLocationURI() of the IProject will return a URI with the 'file' scheme. But with Jazz source control, the URI uses the 'sourcecontrol' scheme.

Perhaps a more generic mechanism of generating the URI is required.

There have been similar issues in other Eclipse plugins:
 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=307033
 - https://bugs.eclipse.org/bugs/show_bug.cgi?id=354360
Comment 1 matt_ponsford CLA 2011-12-13 19:49:51 EST
Selecting 'Update Project Configuration' also throws the same exception.
Comment 2 Igor Fedorenko CLA 2011-12-13 20:32:38 EST
I am marking this as WONTFIX because m2e development team does not have resources to investigate RTC integration problems. We will gladly accept a quality patch (with corresponding automated regression tests) that addresses the issue, so please feel free to reopen this bugzilla if you indent to work on a fix.
Comment 3 Antoine de Troostembergh CLA 2012-01-13 04:35:09 EST
Created attachment 209437 [details]
Patch that fixes this issue on the m2e-1.0.x stream.
Comment 4 Antoine de Troostembergh CLA 2012-01-13 04:38:09 EST
I've uploaded a compiled version of the jar on Jazz.net
https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=190623

It will only work for the specified version of the plugin of course.
Feel free to create a testcase if you have the time, right now I don't.
Comment 5 Igor Fedorenko CLA 2012-01-13 05:41:00 EST
We do not accept patches specific to thirdparty commercial products in m2e core. Please refactor the patch to either remove any jazz-specific logic. I am not familiar with jazz, but this may require new m2e extensions API. Also, the patch has to have associated test(s) if you want us to consider it.
Comment 6 Antoine de Troostembergh CLA 2012-01-19 11:27:41 EST
Created attachment 209754 [details]
Patch that fixes this issue on the m2e-1.0.x stream without RTC specific coding.

Hello,

You could change the code to use the Eclipse API to retrieve the projects location instead of relying on the getLocationURI on the project. This way whatever the format of the URI, you will always retrieve the correct location. The EFS class allows you to achieve this.

Is this acceptable for you? Personally I don't care, I have a working version now. It is just to help whoever might encounter the same problem.
Comment 7 Sébastien Alonzo CLA 2012-04-04 11:13:02 EDT
I have the same problem (using RTC 3.0 with Eclipse Helios and m2e 1.0)

According to the Jazz team (see https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=190623) the solution lies with a slight modification of m2e-core code.

The patch provided seems totally acceptable since it only uses Eclipse API. Is there any chance to have it applied in m2e 1.1.x ?
Comment 8 Igor Fedorenko CLA 2012-04-04 12:10:42 EDT
reopened for consideration.
Comment 9 Igor Fedorenko CLA 2012-05-05 07:27:21 EDT
Comment on attachment 209754 [details]
Patch that fixes this issue on the m2e-1.0.x stream without RTC specific coding.

Applied the patch. Thank you. http://git.eclipse.org/c/m2e/m2e-core.git/commit/?id=38fae6d9c40314f410f338c8f759aa627927c916
Comment 10 Igor Fedorenko CLA 2012-05-05 09:06:48 EDT
applied
Comment 11 Denis Roy CLA 2021-04-19 13:25:01 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/