first try at dealing with change to DST in March 2007
first try at dealing with change to DST in March 2007
- Subject: first try at dealing with change to DST in March 2007
- From: Ray Kiddy <email@hidden>
- Date: Sun, 14 Jan 2007 19:25:03 -0800
So, we all know there is a problem in WebObjects with the DST change
that has occurred for 2007. I wish I could describe everything about
how to deal with this problem, but it is amazingly easy to get this
stuff wrong. I have been poking around the NSTime stuff for a long
time. I wish it got easier to be clear about it.
I think the most workable approach is to try to make sure I have a
sensible way of describing the problem and then I will try to use
jUnit code to describe the behavior and the fixes I can see.
I have posted to my blog the first piece of what I am going to try to
say about this. If this first piece does not reach your problem, I
hope it helps in some way. If anyone wants to send me (perhaps just
email@hidden and not the list) more information about the
configuration of their machines (the OS version, the JVM versions,
versions of other software that affects this) and the symptoms of the
problems that are occurring, I would welcome the info. If you have
already sent info to the list, I have seen that.
http://worldofwebobjects.blogspot.com/2007/01/not-exactly-masters-of-
time-and-space.html
So, to peel back just the very first layer of the onion....
I did discover something about the DST problem that is coming upon us
in March of this year. I am using Mac OS X 10.4.8 with the latest
versions of the Java VMs. The time zone data is correct for java
applications as a whole on this platform, but not for WebObjects.
But, if you are running Mac OS X, and have the latest updates of
Apple's JVM, there is a simple solution.
The info in the /usr/share/zoneinfo directory is correct. One just
has to get that into into the JavaFoundation frameworks.
I have two jUnit test methods that I used to verify the problem will
occur, and an ant target which fixes a framework. Copies of just
those files are below. Then entire project is pointed to from my blog
entry.
I am trying to use ant targets for some of these things to get around
the cross-platform issues. If the "move" task, for example, works on
Windows, then I do not have to try to write a script that uses the
correct command.
My first version of the ant build file is below. Before I invole the
"fixFoundation" target, the second jUnit method fails. After I
invoked the "fixFoundation" target, both tests passed.
But even as I write this, I know I will have to extend or correct
this. There are several copies of the zoneinfo.zip file that need to
be corrected. Only one is in the location my build.xml fixes. Sigh....
FYI, here is where I have found the zoneinfo.zip files that
WebObjects installs:
/System/Library/Frameworks/JavaFoundation.framework/Resources/Java/
javafoundation.jar
/Library/WebObjects/lib/JavaFoundation.jar (2 copies, one for
WebServerResources and one for Resources)
/Library/WebServer/Documents/WebObjects/Java/com/webobjects/
foundation/TimeZoneInfo/zoneinfo.zip (not in a jar file, actually)
/Library/WebServer/Documents/WebObjects/Java/wojavaclient.jar
If I have missed any, please let me know. I will have to update my
blog posting....
thanx - ray
Attachment:
DaylightSavingsTimeTest.java
Description: Binary data
<project name="OWO" default="jar">
<!-- Copyright 2007 by Ray Kiddy, Sunnyvale, CA.
All rights reserved. Want something? Just ask. -->
<target name="setup">
<mkdir dir="lib" />
<mkdir dir="dist" />
</target>
<property name="SLF" value="/System/Library/Frameworks" />
<property name="fRJ" value="framework/Resources/Java" />
<path id="default.classpath">
<pathelement path="bin/junit.jar" />
<pathelement path="${SLF}/JavaFoundation.${fRJ}/javafoundation.jar" />
</path>
<path id="exec.classpath">
<pathelement path="dist/owoTests.jar" />
<pathelement path="bin/junit.jar" />
<path refid="default.classpath" />
</path>
<property name="exec.classpath" refid="exec.classpath" />
<target name="compile" depends="setup">
<javac srcdir="src" destdir="lib" includes="org/**/*.java" classpathref="default.classpath" />
<javac srcdir="src" destdir="lib" includes="com/webobjects/foundation/**/*.java" classpathref="default.classpath" />
</target>
<target name="jar" depends="compile">
<jar destfile="dist/owoTests.jar" basedir="lib" />
</target>
<target name="exec" depends="jar">
<exec failonerror="true" executable="/usr/bin/java"><arg line="-classpath ${exec.classpath} org.owo.Harness" /></exec>
</target>
<target name="clean">
<delete quiet="true" dir="lib" />
<delete quiet="true" dir="dist" />
</target>
<property name="zoneInfoDir" value="/usr/share/zoneinfo" />
<property name="jarfile" value="${SLF}/JavaFoundation.${fRJ}/javafoundation.jar" />
<target name="fixFoundation">
<tempfile property="temp" />
<mkdir dir="${temp}" />
<unjar src="${jarfile}" dest="${temp}" />
<delete quiet="true" file="${temp}/com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip" />
<zip destfile="${temp}/com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip" basedir="${zoneInfoDir}" />
<move file="${jarfile}" tofile="${jarfile}_bak" />
<jar basedir="${temp}" destfile="${jarfile}" />
<delete quiet="true" dir="${temp}" />
</target>
</project>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden