Package: jamvm
Version: 1.5.3-2
Severity: normal
When running a main class loaded from a Jar file and hen configuring
java.util.Logging to
log to a FileHandle, if the logging formatter includes a SimpleDateFormat
object the
formatter fails to initialize with a java.lang.NullPointerException.
If the main class is un-jarred and then run again, loading from the file system
this time,
the logging formatter does initialize correctly. Here is an example test case,
where
I first run a simple main class via the file system and it does not throw an
error. The
second time I run from a Jar archive, and configure the logging properties from
an
absolute file path, and it still completes successfully. The third time I run
from a
Jar archive again, but this time include the file system in the classpath and
configure
the logging properties as a relative path -- and the exception is thrown in
this case.
so...@ts7260:~/bug$ cat LoggingVerify.java
import java.util.logging.Logger;
public class LoggingVerify {
private static final Logger LOG =
Logger.getLogger(LoggingVerify.class.getName());
public static void main(String[] args) {
LOG.info("Hello, log.");
System.out.println("Hello, world.");
}
}
so...@ts7260:~/bug$ cat logging.properties
handlers = java.util.logging.FileHandler
..level= ALL
java.util.logging.FileHandler.pattern = %t/bug.log
so...@ts7260:~/bug$ java -cp .
-Djava.util.logging.config.file=logging.properties LoggingVerify
Hello, world.
so...@ts7260:~/bug$ fastjar -cf bug.jar LoggingVerify.class
so...@ts7260:~/bug$ java -cp bug.jar
-Djava.util.logging.config.file=~/bug/logging.properties LoggingVerify
Hello, world.
so...@ts7260:~/bug$ java -cp bug.jar:.
-Djava.util.logging.config.file=logging.properties LoggingVerify
WARNING: error instantiating 'java.util.logging.FileHandler' referenced by
handlers, linkage error
java.lang.ExceptionInInitializerError
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:455)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:440)
at java.util.logging.XMLFormatter.<init>(XMLFormatter.java:85)
at java.lang.reflect.VMConstructor.construct(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:319)
at java.lang.Class.newInstance(Class.java:1154)
at java.util.logging.LogManager.getInstanceProperty(LogManager.java:769)
at java.util.logging.StreamHandler.<init>(StreamHandler.java:138)
at java.util.logging.FileHandler.<init>(FileHandler.java:380)
at java.util.logging.FileHandler.<init>(FileHandler.java:296)
at java.lang.reflect.VMConstructor.construct(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:319)
at java.lang.Class.newInstance(Class.java:1154)
at java.util.logging.LogManager.createInstance(LogManager.java:854)
at java.util.logging.LogManager.readConfiguration(LogManager.java:572)
at java.util.logging.LogManager.readConfiguration(LogManager.java:527)
at java.util.logging.LogManager.initLogManager(LogManager.java:203)
at java.util.logging.LogManager.getLogManager(LogManager.java:168)
at java.util.logging.Logger.getLogger(Logger.java:254)
at java.util.logging.Logger.getLogger(Logger.java:213)
at java.util.logging.Logger$1.run(Logger.java:96)
at java.security.AccessController.doPrivileged(AccessController.java:96)
at java.util.logging.Logger.<clinit>(Logger.java:92)
at gnu.java.util.jar.JarUtils.<clinit>(JarUtils.java:65)
at java.util.jar.Manifest.read(Manifest.java:162)
at java.util.jar.Manifest.<init>(Manifest.java:89)
at java.util.jar.JarFile.readManifest(JarFile.java:303)
at java.util.jar.JarFile.<init>(JarFile.java:268)
at gnu.java.net.protocol.jar.Connection$JarFileCache.get(Connection.java:99)
at gnu.java.net.protocol.jar.Connection.connect(Connection.java:141)
at gnu.java.net.protocol.jar.Connection.getJarFile(Connection.java:170)
at gnu.java.net.loader.JarURLLoader.initialize(JarURLLoader.java:85)
at gnu.java.net.loader.JarURLLoader.<init>(JarURLLoader.java:76)
at java.net.URLClassLoader.addURLImpl(URLClassLoader.java:387)
at java.net.URLClassLoader.addURLs(URLClassLoader.java:418)
at java.net.URLClassLoader.<init>(URLClassLoader.java:217)
at java.lang.ClassLoader$1.<init>(ClassLoader.java:1099)
at java.lang.ClassLoader.createSystemClassLoader(ClassLoader.java:1099)
at java.lang.ClassLoader.defaultGetSystemClassLoader(ClassLoader.java:1084)
at java.lang.VMClassLoader.getSystemClassLoader(VMClassLoader.java:301)
at java.lang.ClassLoader$StaticData.<clinit>(ClassLoader.java:154)
at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:799)
Caused by: java.lang.NullPointerException
at java.lang.ClassLoader.getSystemResource(ClassLoader.java:693)
at java.lang.ClassLoader.getSystemResourceAsStream(ClassLoader.java:752)
at java.lang.Class.getResourceAsStream(Class.java:954)
at java.util.Calendar.<clinit>(Calendar.java:503)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:455)
...41 more
Hello, world.
-- System Information:
Debian Release: 5.0
APT prefers testing
APT policy: (500, 'testing'), (500, 'stable')
Architecture: armel (armv4tl)
Kernel: Linux 2.6.29-ts (PREEMPT)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash
Versions of packages jamvm depends on:
ii classpath 2:0.98-4 clean room standard Java libraries
ii classpath-common 2:0.98-4 clean room standard Java libraries
ii java-common 0.33 Base of all Java packages
ii libc6 2.9-25 GNU C Library: Shared libraries
ii libgcc1 1:4.4.1-4 GCC support library
ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime
jamvm recommends no packages.
jamvm suggests no packages.
-- no debconf information
_______________________________________________
pkg-java-maintainers mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-java-maintainers