You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Alexey Petrenko <al...@gmail.com> on 2007/12/19 16:53:27 UTC

Strange behavior of private static variable on Linux.

I'm trying to run JSPWiki [1] (it's Apache incubator project now) on
Harmony + Tomcat. It works ok on Windows but can not start on Linux.
I've described the issue in HARMONY-5327 [2]

Investigation shown that NPE happens because StringBuffer.getChars
method receives null as destination parameter from
org.apache.log4j.helpers.ISO8601DateFormat.format. This behavior is
described in spec and RI behaves in the same way.

ISO8601DateFormat.format [3] passes private static variable
lastTimeString which is initialized to new char array. And
initialization really happens. No other assignments to this variable
in the class.
But it is null right before exception...

How can this happen? Any ideas?

Removing static keyword - helps.
Adding final keyword - helps.
Works ok on Windows.

Looks like this is DRLVM Linux specific issue.

Thanks in advance for any ideas.

SY, Alexey

1. http://jspwiki.org/
2. https://issues.apache.org/jira/browse/HARMONY-5327
3. https://svn.apache.org/repos/asf/logging/log4j/trunk/src/main/java/org/apache/log4j/helpers/ISO8601DateFormat.java