You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Mark Nuttall (JIRA)" <ji...@apache.org> on 2010/04/28 14:13:31 UTC
[jira] Created: (FELIX-2306) ClassCastException in Wrapper.unwrap()
when calling Resolver.add(x implements Resource)
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
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.
[jira] Commented: (FELIX-2306) ClassCastException in
Wrapper.unwrap() when calling Resolver.add(x implements Resource)
Posted by "Mark Nuttall (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/FELIX-2306?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12878927#action_12878927 ]
Mark Nuttall commented on FELIX-2306:
-------------------------------------
Thank you for this. I've only a minor comment - 'int j = 0;' inside ConvertedResource() seems to be spurious.
> 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.
[jira] Resolved: (FELIX-2306) ClassCastException in
Wrapper.unwrap() when calling Resolver.add(x implements Resource)
Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (FELIX-2306) ClassCastException in Wrapper.unwrap()
when calling Resolver.add(x implements Resource)
Posted by "Jarek Gawor (JIRA)" <ji...@apache.org>.
[ 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.