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

Bug 311802

Summary: UnsupportedOperationException trying to install
Product: [Eclipse Project] Equinox Reporter: Andrew Overholt <overholt>
Component: p2Assignee: Daniel Le Berre <leberre>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: leberre, pascal, susan
Version: unspecifiedFlags: pascal: review+
Target Milestone: 3.6 RC1   
Hardware: PC   
OS: Windows Server 2008   
Whiteboard:
Attachments:
Description Flags
Provides a short answer for all explanations none

Description Andrew Overholt CLA 2010-05-05 17:39:46 EDT
Build ID:  	I20100504-0800 (win32)
OS:  Windows Server 2008
Sun 1.6 JDK for Windows

I tried to install all features in a Linux Tools drop [1] which has os=linux filters in some of the features.  I got an error dialogue with "java.lang.UnsupportedOperationException" and no details when I click "<< Details".  The stack trace is:

!ENTRY org.eclipse.equinox.p2.ui 4 0 2010-05-05 21:33:09.063
!MESSAGE
!STACK 0
java.lang.UnsupportedOperationException
        at org.eclipse.equinox.internal.p2.director.Explanation.shortAnswer(Explanation.java:260)
        at org.eclipse.equinox.internal.provisional.p2.director.RequestStatus.getShortExplanation (RequestStatus.java:81)
        at org.eclipse.equinox.p2.operations.InstallOperation.missingRequirement (InstallOperation.java:174)
        at org.eclipse.equinox.p2.operations.InstallOperation.access$0(InstallOperation.java:169)
        at org.eclipse.equinox.p2.operations.InstallOperation$1.getSecondPassProvisioningContext(InstallOperation.java:161)
        at org.eclipse.equinox.internal.p2.operations.PlannerResolutionJob.runModal(PlannerResolutionJob.java:90)
        at org.eclipse.equinox.p2.operations.ProfileChangeOperation.resolveModal(ProfileChangeOperation.java:115)
        at org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard$1.run(ProvisioningOperationWizard.java:206)
        at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

[1]
https://build.eclipse.org/hudson/job/cbi-linuxtools-Helios/158/artifact/build/I201005041513/linuxtools-Update-I201005041513.zip
Comment 1 Susan McCourt CLA 2010-05-05 18:56:07 EDT
*** Bug 311804 has been marked as a duplicate of this bug. ***
Comment 2 Daniel Le Berre CLA 2010-05-06 02:08:12 EDT
I will check what can be done here.
Comment 3 Daniel Le Berre CLA 2010-05-06 04:11:47 EDT
Created attachment 167272 [details]
Provides a short answer for all explanations

Here is a fix for that bug.

The default behavior of Explanation.shortAnswer() was to throw an UnsupportedOperationException.
because only missing requirements and singleton violations could be the cause of a resolving error.

We added several explanations recently without providing a specific short answer, including the NonInstallableRoot explanation.

I propose to force all explanations to return a specific short answer by making shortAnswer() abstract in Explanation and creating new constants:

	public static final int MISSING_REQUIREMENT = 1; // EXISTING
	public static final int VIOLATED_SINGLETON_CONSTRAINT = 2; // EXISTING
	public static final int IU_INSTALLED = 3;
	public static final int IU_TO_INSTALL = 4;
	public static final int VIOLATED_HARD_REQUIREMENT = 5;
	public static final int VIOLATED_PATCHED_HARD_REQUIREMENT = 6;
	public static final int NON_INSTALLABLE_ROOT = 7;
	public static final int OTHER_REASON = 100;

Those constants are currently in Explanation, but they should likely move as an enum for instance outside that class.
Comment 4 Pascal Rapicault CLA 2010-05-06 14:31:10 EDT
Patch reviewed and released