Skip to content

Plexus.lookup(...)s ComponentLookupException wraps unexpected NoSuchElementException #184

@kwin

Description

@kwin

When trying to load a component via Plexus.lookup(...) whose class cannot be found for some reason one gets the following exception

org.codehaus.plexus.component.repository.exception.ComponentLookupException: java.util.NoSuchElementException
      role: org.eclipse.sisu.plexus.test.invalid.InvalidClass
  roleHint: 
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:271)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:247)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:241)
	at ....
Caused by: java.util.NoSuchElementException
	at java.util.Collections$EmptyIterator.next(Collections.java:4191)
	at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:267)
	... 22 more

The wrapped exception should contain some more concrete information why the lookup failed (i.e. the exception exposed from the class loader)

OTOH Plexus.lookupList() and Plexus.lookupMap() do not throw an exception at all, but just return empty wrappers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions