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. ADP1 stops recieving data

Hi all,

I've got an ADP1 in the UK, and for the past day or so it seems to
stop receiving data after between 5 minutes and 2 hours of being
connected to the network. The browser and all internet apps (twitroid,
google talk, etc.) will all stop working. Flipping it off and on, or
turning airport mode off and on will get it working again for a while.
This may well be a network issue but I want to eliminate any problems
my end before I complain to them, as they're probably just going to
say they don't support the phone and not help. Wifi works properly,
the issue is only with data (3G and edge).

If I adb shell and run ping to a known host, it seems to work, and
pinging different hosts by IP address will get different response
times (160ms - 250ms from servers I know). ping to known host names
will not work and will come up with "unknown host" after about 2
minutes.

The browser displays this message when typing in IP addresses of known
hosts with a HTTP server:
"Data connectivity problem
The server failed to communicate. Try again later."

If I restart the phone or disable/reenable the radio, it all starts
working again but it will fail some time later.

Unfortunately the android seems to lack network tools so I can't
properly figure out what's happening (e.g. dead DNS server, faulty
router, whatever). Is there any way for me to get more of an insight?
dmesg doesn't contain anything I can immediately notice as useful.
Even if this is a network problem, is there anything I can say to them
that might help them find the issue?


Also is there any way to change the locale on the ADP1 to Britain/
UK?  :)

Thanks,
Cameron

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

2. Reporting a Bug

Hi Is this the best place to report a bug? If not please let me know
where. If so the gmail program does not send an email unless the
automatic sync is checked. Pressing the send button should
automatically start a sync just to send the email you aret trying to
send.

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

3. Setting visibility of Preferences in a PreferenceActivity

4. Loading bar / splash screen for webview app

5. android:completionThreshold

6. Theme.Translucent.NoTitleBar -> No config changes...!?

7. Where is GLSurfaceView?