felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Nuttall (JIRA)" <j...@apache.org>
Subject [jira] Created: (FELIX-2306) ClassCastException in Wrapper.unwrap() when calling Resolver.add(x implements Resource)
Date Wed, 28 Apr 2010 12:13:31 GMT
ClassCastException in Wrapper.unwrap() when calling Resolver.add(x implements Resource)

                 Key: FELIX-2306
                 URL: https://issues.apache.org/jira/browse/FELIX-2306
             Project: Felix
          Issue Type: Bug
          Components: Bundle Repository (OBR)
    Affects Versions: bundlerepository-1.6.0
         Environment: Windows 7, Java 6
            Reporter: Mark Nuttall

This looks like a regression from OBR 1.4.1 to 1.6.  I have a resource class that implements
org.osgi.service.obr.Resource. When I call Resolver.add(myResource) I
get a ClassCastException:

Caused by: java.lang.ClassCastException:my.resources.MyResource
incompatible with
       at org.apache.felix.bundlerepository.impl.wrapper.Wrapper.unwrap(Wrapper.java:59)
       at org.apache.felix.bundlerepository.impl.wrapper.ResolverWrapper.add(ResolverWrapper.java:40)
       at my.provisioning.impl.OBRProvisioner.resolve(OBRProvisioner.java:496)

Looking at Wrapper.java:

   public static Resource unwrap(org.osgi.service.obr.Resource resource) {
       return ((ResourceWrapper) resource).resource;

I've passed in a class that implemented obr.Resource which this code is attempting to cast
to ResourceWrapper: this fails. We got there via,

  // ResolverWrapper.java
  public void add(org.osgi.service.obr.Resource resource) {

At no time was my Resource wrapped before it was unwrapped. 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message