You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2010/06/15 10:41:23 UTC
[jira] Resolved: (FELIX-2306) ClassCastException in
Wrapper.unwrap() when calling Resolver.add(x implements Resource)
[ https://issues.apache.org/jira/browse/FELIX-2306?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Guillaume Nodet resolved FELIX-2306.
------------------------------------
Assignee: Guillaume Nodet
Fix Version/s: bundlerepository-1.6.4
Resolution: Fixed
Adding bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/ConvertedResource.java
Sending bundlerepository/src/main/java/org/apache/felix/bundlerepository/impl/wrapper/Wrapper.java
Transmitting file data ..
Committed revision 954751.
> 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
> Assignee: Guillaume Nodet
> Fix For: bundlerepository-1.6.4
>
> 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.