ClassLoader.isAncestorOf(ClassLoader) Bug

by Daniel Janev » Tue, 24 Mar 2009 21:52:24 GMT


Sponsored Links
 Hello All,

Please someone from Google to comment this issue!

My colleagues has found a bug in the java.lang.ClassLoader
implementation of the cupcake tag of the Android platform. Here is a
short descriptions:

We try to invoke ClassLoader.getSystemClassLoader() in one of our OSGi
implementation classes and afterwards we have endless loop. Here are the
bodies of the methods:

public static ClassLoader getSystemClassLoader() {
  SecurityManager smgr = System.getSecurityManager();

  if (smgr != null) {
    ClassLoader caller = VMStack.getCallingClassLoader();
    if (caller != null && !caller.isAncestorOf(SystemClassLoader.loader)) {
      smgr.checkPermission(new RuntimePermission("getClassLoader"));
    }
  }
  return SystemClassLoader.loader;
}
...
and in isAncestorOf method we have:

final boolean isAncestorOf(ClassLoader child) {
  for (ClassLoader current = child; current != null; current =
child.parent) {
    if (current == this) {
      return true;
    }
  }
  return false;
}

In a dynamic environment like an OSGi implementation with set security
manager the isAncestorOf(...) follows to an endless loop. As you can see
- if the child is a custom class loader, which has another class loader
as a parent. The problem is that current is always is set to
child.parent but the child is never changed. The following code fixes
the problem:

final boolean isAncestorOf(ClassLoader child) {
  for (ClassLoader current = child; current != null; current =
current.parent) {
    if (current == this) {
      return true;
    }
  }
  return false;
}

I hope that you will be able to fix this as soon as possible and to
update the cupcake branch too. Please notify me when this is ready.

Thanks in advance!!

-- 

Best Regards,
    Daniel
---------------------------------------------------------------
Daniel Janev  Department Manager/Core Platform and Smart Home
ProSyst Software GmbH
1606 Sofia, Bulgaria  Vladajska Str. 48
Tel. +359 (0)2 952 35 81/109  Fax +359 (0)2 953 26 17
Mobile Phone +359 (0)888 678 670
 http://www.prosyst.com   d.ja...@prosyst.com
---------------------------------------------------------------
stay in touch with your product.
---------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~



ClassLoader.isAncestorOf(ClassLoader) Bug

by Mark Murphy » Tue, 24 Mar 2009 22:00:35 GMT


 


Did you file this on  http://b.android.com ? That is the issue tracker for
Android. I do not see your issue out there, so I strongly encourage you
to file it there.


If you would take the time to file this on  http://b.android.com , you
will automatically be notified of progress on the issue.

-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com 
Warescription: Three Android Books, Plus Updates, $35/Year

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


ClassLoader.isAncestorOf(ClassLoader) Bug

by Daniel Janev » Tue, 24 Mar 2009 22:14:12 GMT


 Thanks Mark,

I've posted the bug there.







-- 

Best Regards,
    Daniel
---------------------------------------------------------------
Daniel Janev  Department Manager/Core Platform and Smart Home
ProSyst Software GmbH
1606 Sofia, Bulgaria  Vladajska Str. 48
Tel. +359 (0)2 952 35 81/109  Fax +359 (0)2 953 26 17
Mobile Phone +359 (0)888 678 670
 http://www.prosyst.com   d.ja...@prosyst.com
---------------------------------------------------------------
stay in touch with your product.
---------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Will German developers be able to offer priced applications in Q1, 2009?

Will German developers be able to offer priced applications in Q1,
2009?
At least the Google blog from Feb 13, 2009 promised so:

"We will also enable developers in Germany, Austria, Netherlands,
France, and Spain to offer priced applications later this quarter. By
the end of Q1 2009, we will announce support for developers in
additional countries. "
http://android-developers.blogspot.com/2009/02/android-market-update-support-for.html

Q1, 2009, ends in 3 days, so there is not much time left :-) Will
Google make this deadline? Any bets?

Peli
www.openintents.org


--~--~---------~--~----~------------~-------~--~----~

2. Setting an Android Icon in Menu XML

How do you specify an Android icon in xml?  I'm trying to make a menu
with an "Add" button using the stock Android Add icon, like so:

    <item android:id="@+id/menu_add"
        android:title="Add"
        android:icon="@drawable/ic_menu_add" /
        android:icon="@drawable/android.R.drawable.ic_menu_add" /> //
Also doesn't work.
        android:icon="@android.R.drawable/ic_menu_add" /

As you can see, I'm not sure how to re-use the android "Add" icon in
my xml (without copying it & pasting it in my app, or setting it
programatically I suppose)

I know the icon exists, as I can do  this on a dialog:
 .setIcon(android.R.drawable.ic_menu_add)

Thanks.

--~--~---------~--~----~------------~-------~--~----~

3. How to make translucent control just like 'zoom' in Pictures

4. How can i use vold(New volume manager daemon) to automatically mount sdcard when device startup?

5. Spying camera application

6. OutofMemory exception when dealing with large Bitmaps

7. Buffering Background Image - Graphics Advice Sought