Announcement

Collapse
No announcement yet.

Strange Java problem under Gutsy (7.10)

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Strange Java problem under Gutsy (7.10)

    I'm experiencing a very strange side-effect that I hope someone here has encountered and knows of a fix for. It's definitely specific to some code that I work with, but the behavior changed when I converted from Fedora to Kubuntu.

    Using Sun JDK 1.4.2_13, we have some code that takes a Date object and marshalls it as a string, then unmarshalls it back into a Date object again. (This would normally be for transmission over the wire, but for test purposes no transmission takes place.) When this happens, the resulting Date object is exactly 1 hour prior to the original Date object.

    I checked all the places I could think of to make sure that I'm using the right timezone. It appears to be set properly. /etc/timezone is set to America/New York as I expect. /etc/localtime shows EST5EDT as I would expect it to.

    I also removed all of the gij and gcj packages from the OS when I installed because they conflict with the JVM that I really wish to be using.

    This behavior began when I converted to Kubuntu, so I suspect there is something in the system that is somehow affecting Java adversely to cause this.

    Any ideas?
    Thanks in advance,
    Dave

    #2
    Re: Strange Java problem under Gutsy (7.10)

    Java dates are a pain in the backside.

    Does the value of your Date object.getTimeInMillis() change between the serializing/unserializing?

    Comment


      #3
      Re: Strange Java problem under Gutsy (7.10)

      Don't know anything about Java, but would it be possible to check to see if the system is known to do this and just add an hour to compensate?
      Of course, you'd only need to do that if it needed to be portable... But writing everything to be portable is a good habit, yeah?
      For external use only.

      Comment


        #4
        Re: Strange Java problem under Gutsy (7.10)

        Thanks for the replies, fellas.

        JamesM - I honestly don't know. I'm trying get to the place where it occurs, but this stuff is wrapped up in about 20 layers of frameworks. (Some of the guys at my workplace have this strange obsession with complicating otherwise very simple tasks.) That's exactly the thought that I had, however.

        SheeEttin - My initial reaction is that some piece of software (a library probably) is doing some kind of transformation on Date objects based on timezone or something. I had a similar problem with Fedora, but it seems like as soon as I removed the Gnu Java stuff it went away. In this case, I've already removed all that stuff.

        So, basically, I'm down to tracing this thing in a debugger and trying to see what's happening to that data. Easier said than done, but that's life. I did write a quick test program in which I did a simple marshalling/unmarshalling through a Piped stream and it worked like a charm. That points me to the framework being the problem, but it works for everyone else here. Strange.

        Comment

        Working...
        X