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

Bug 312040

Summary: [tools] p2.composite.repository task fails with ClassCastException
Product: [Eclipse Project] Equinox Reporter: Oliver Schäfer <oliver.oo.schaefer>
Component: p2Assignee: P2 Inbox <equinox.p2-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, pascal, stephan.herrmann, zimmermann.k
Version: unspecifiedKeywords: usability
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard: stalebug

Description Oliver Schäfer CLA 2010-05-07 07:17:30 EDT
Build Identifier: I20100429-1549

Executing this:

<p2.composite.repository>
            <repository location="${p2.metadata.repo}" />
            <add>
                <repository location="file://myadditionalrepo" />
            </add>
        </p2.composite.repository>

i get this:

java.lang.ClassCastException: org.eclipse.equinox.internal.p2.metadata.repository.LocalMetadataRepository cannot be cast to org.eclipse.equinox.p2.repository.ICompositeRepository
	at org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:508)
	at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:418)
	at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:662)
	at org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunner.java:534)

Reproducible: Always
Comment 1 Andrew Niefer CLA 2010-05-07 09:56:13 EDT
It sounds like there already exists a repository at ${p2.metadata.repo}, and it isn't a composite repository.

At the least we should protect against the problem and return an error message.

Another possibility would be to create a composite repository beside the existing one and add both the existing ${p2.metadata.repo} and the new "file://myadditionalrepo" to the composite
Comment 2 Oliver Schäfer CLA 2010-05-07 10:23:25 EDT
An error message would be fine, thanks.
Comment 3 Stephan Herrmann CLA 2012-10-18 14:16:40 EDT
(In reply to comment #1)
> At the least we should protect against the problem and return an error
> message.

Yes, please. :)
Comment 4 Eclipse Genie CLA 2019-11-05 12:02:47 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.