Bug 28070 - Exception instatiating LogManager
Summary: Exception instatiating LogManager
Status: UNCONFIRMED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: unspecified
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-17 07:00 UTC by Anthony Green
Modified: 2006-10-06 14:49 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Test case (411 bytes, text/plain)
2006-06-17 07:02 UTC, Anthony Green
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony Green 2006-06-17 07:00:35 UTC
LogManager static initialization throws an exception if you have a security manager installed.  I'll attach a test case to this issue.

When I run it with gij I get:

java.lang.ExceptionInInitializerError
   at java.lang.Class.initializeClass(libgcj.so.7)
   at java.util.logging.LogManager.<init>(libgcj.so.7)
   at java.util.logging.LogManager.makeLogManager(libgcj.so.7)
   at java.util.logging.LogManager.<clinit>(libgcj.so.7)
   at java.lang.Class.initializeClass(libgcj.so.7)
   at LogManagerSecurityDeath.main(LogManagerSecurityDeath.java:24)
Caused by: java.lang.NullPointerException
   at LogManagerSecurityDeath$1.checkPermission(LogManagerSecurityDeath.java:20)
   at java.util.logging.LogManager.checkAccess(libgcj.so.7)
   at java.util.logging.LogManager.addLogger(libgcj.so.7)
   at java.util.logging.Logger.getLogger(libgcj.so.7)
   at java.util.logging.Logger.getLogger(libgcj.so.7)
   at java.util.logging.Logger.<clinit>(libgcj.so.7)
   at java.lang.Class.initializeClass(libgcj.so.7)
   ...5 more

I believe this is a Classpath bug, and not a gcj/libgcj error.
LogManager.controlPermission needs to be initialized before it is used.
Comment 1 Anthony Green 2006-06-17 07:02:04 UTC
Created attachment 11686 [details]
Test case
Comment 2 Casey Marshall 2006-06-17 08:29:33 UTC
Subject: Re:   New: Exception instatiating LogManager

On Jun 17, 2006, at 12:00 AM, green at redhat dot com wrote:

> LogManager static initialization throws an exception if you have a  
> security
> manager installed.  I'll attach a test case to this issue.
>
> When I run it with gij I get:
>
> java.lang.ExceptionInInitializerError
>    at java.lang.Class.initializeClass(libgcj.so.7)
>    at java.util.logging.LogManager.<init>(libgcj.so.7)
>    at java.util.logging.LogManager.makeLogManager(libgcj.so.7)
>    at java.util.logging.LogManager.<clinit>(libgcj.so.7)
>    at java.lang.Class.initializeClass(libgcj.so.7)
>    at LogManagerSecurityDeath.main(LogManagerSecurityDeath.java:24)
> Caused by: java.lang.NullPointerException
>    at
> LogManagerSecurityDeath$1.checkPermission 
> (LogManagerSecurityDeath.java:20)
>    at java.util.logging.LogManager.checkAccess(libgcj.so.7)
>    at java.util.logging.LogManager.addLogger(libgcj.so.7)
>    at java.util.logging.Logger.getLogger(libgcj.so.7)
>    at java.util.logging.Logger.getLogger(libgcj.so.7)
>    at java.util.logging.Logger.<clinit>(libgcj.so.7)
>    at java.lang.Class.initializeClass(libgcj.so.7)
>    ...5 more
>
> I believe this is a Classpath bug, and not a gcj/libgcj error.
> LogManager.controlPermission needs to be initialized before it is  
> used.
>

I think you're right, and I seem to recall this being discussed before.

I don't see the point of that permission object being a class  
constant; does creating a new LoggingPermission on each call really  
create such a memory burden? It still looks to me like a really  
premature micro-optimization, and it has bad consequences.

Otherwise, using package-private methods that circumvent permission  
checks should be used internally, I think.
Comment 3 Anthony Green 2006-06-17 16:07:17 UTC
Just FYI, I found this while building the latest upstream jogl release from source.  It looks like Ant installs it's own security manager, which is causing problems during the jogl build process.  
Comment 4 Anthony Green 2006-08-09 18:01:10 UTC
For what it's worth, I can't reproduce this anymore, although the ChangeLogs don't seem to indicate that anything has changed.  This needs more investigation.
Comment 5 Anthony Green 2006-10-06 14:49:31 UTC
I've hit this bug again building ws-jaxme in FC5.  Again it's the ant security manager that's SEGVing.