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.
---------------------------------------------------------------

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to