[ 
https://issues.apache.org/jira/browse/FELIX-2306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jarek Gawor updated FELIX-2306:
-------------------------------

    Attachment: FELIX-2306.patch

Proposed patch for this issue. The patch code will attempt to covert osgi 
Resource to felix Resource by copying the data. This might not work in all 
cases but should in most.


> 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
>         Attachments: FELIX-2306.patch
>
>
> 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
> org.apache.felix.bundlerepository.impl.wrapper.ResourceWrapper
>        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) {
>        resolver.add(Wrapper.unwrap(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.

Reply via email to