Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Jan 2001 10:49:16 -0500
From:      "Rossen Raykov" <rraykov@sageian.com>
To:        <glewis@trc.adelaide.edu.au>, <veldy@veldy.net>
Cc:        <freebsd-java@FreeBSD.ORG>
Subject:   Re: Serialization problem.
Message-ID:  <007f01c08166$36d0e140$4c00000a@sage>
References:  <B7EEDC7A0B0AD311871F0004AC4CC04627573F@SERVER> <3A63A6BD.787B4FB5@partitur.se> <023101c07ff8$b2647980$4c00000a@sage> <01a201c07ff9$5be39680$3028680a@tgt.com> <20010118221737.A8960@ares.trc.adelaide.edu.au>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Attached is simple class that reproduce the error on my systems.
The test results:

<output>
sun$ uname -a
SunOS nis 5.7 Generic_106541-11 sun4u sparc SUNW,Ultra-5_10
sun$ java -version
java version "1.2.2"
Solaris VM (build Solaris_JDK_1.2.2_06, native threads, sunwjit)
sun$ java DateTest w test
Saved: Wed May 08 00:00:00 EDT 3901

bsd$ uname -a
FreeBSD host 4.1.1-RELEASE FreeBSD 4.1.1-RELEASE #0: Thu Oct 26 10:27:09 EDT
2000     user@host:/usr/src/sys/compile/KERNEL i386
bsd$ java -version
java version "1.2.2"
Classic VM (build jdk1.2.2-FreeBSD:root:2000/10/25-20:23, green threads,
nojit)
bsd$ java DateTest r test
Restored: Tue May 07 23:00:00 EST 3901
</output>

Let me know if you need more information.

Rossen

> Can one of you two come up with a simple example of this?  I tried, but
> everything seemed to work for me:
>
> eclipse> uname -a
> SunOS eclipse 5.8 Generic
> eclipse> java -version
> java version "1.2.2"
> Solaris VM (build Solaris_JDK_1.2.2_06, native threads, sunwjit)
> eclipse> java WriteDate
> Thu Mar 29 00:00:00 CST 2001
> Mon Apr 02 00:00:00 CST 2001
>
> misty> uname -a
> FreeBSD misty.eyesbeyond.com 4.1-RELEASE
> misty> java -version
> java version "1.2.2"
> Classic VM (build jdk1.2.2-FreeBSD:glewis:2000/10/05-07:13, green threads,
> nojit)
> misty> java ReadDate
> Thu Mar 29 00:00:00 GMT+09:30 2001
> Mon Apr 02 00:00:00 GMT+09:30 2001
>
> where WriteDate is a simple class that serializes a couple of dates either
> side of 1 April 2001 and ReadDate...well, you can guess that one :).
>
> I suspect something weird might be happening with locales, but its hard
> to track down without something reproducible.  Am happy to send you the
> code for the test classes I wrote, but I'm sure you can duplicate it in
> about 2 minutes flat :).
>
> - Greg
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-java" in the body of the message
>

[-- Attachment #2 --]
/*
 * DateTest.java
 *
 * Created on January 18, 2001, 9:54 AM
 */
import java.util.Date;
import java.io.*;


/**
 *
 * @author  rraykov
 * @version 
 */
public class DateTest {

    /** Creates new DateTest */
    public DateTest() {
    }

    static void usage() {
        System.err.println("Use: TestDate {r[ead]|w[rite]} file");
        System.exit(-1);
    }

    static Date date;
    
    /**
    * @param args the command line arguments
    */
    public static void main (String args[]) {
      if (args.length != 2) {
        usage();
      }
      try {
        if ((args[0].charAt(0) == 'r') || (args[0].charAt(0) == 'R')) {
          ObjectInputStream in = new ObjectInputStream((InputStream) new FileInputStream(args[1]));
          date = (Date) in.readObject();
          in.close();
          System.out.println("Restored: " + date.toString());
        } else {
          if ((args[0].charAt(0) == 'w') || (args[0].charAt(0) == 'W')) {
            date = new Date(2001, 4, 8);
            ObjectOutputStream out = new ObjectOutputStream((OutputStream) new FileOutputStream(args[1]));
            out.writeObject(date);
            out.flush();
            out.close();
            System.out.println("Saved: " + date.toString());
          } else {
            usage();
          }
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
}
[-- Attachment #3 --]
Êþº¾-xDateTestjava/lang/ObjectdateLjava/util/Date;<init>()VCode

LineNumberTableLocalVariableTablethis
LDateTest;usagejava/lang/SystemerrLjava/io/PrintStream;	#Use: TestDate {r[ead]|w[rite]} filejava/io/PrintStreamprintln(Ljava/lang/String;)V
exit(I)V 
!main([Ljava/lang/String;)V
%java/lang/String'charAt(I)C)*
(+java/io/ObjectInputStream-java/io/FileInputStream/
01(Ljava/io/InputStream;)V3
.4
readObject()Ljava/lang/Object;67
.8java/util/Date:	<close>
.?outA	Bjava/lang/StringBufferD
Restored: F
E1toString()Ljava/lang/String;IJ
;Kappend,(Ljava/lang/String;)Ljava/lang/StringBuffer;MN
EO
EK(III)VR
;Sjava/io/ObjectOutputStreamUjava/io/FileOutputStreamW
X1(Ljava/io/OutputStream;)VZ
V[writeObject(Ljava/lang/Object;)V]^
V_flusha
Vb
V?Saved: ejava/lang/ThrowablegprintStackTracei
hjjava/lang/Exceptionlargs[Ljava/lang/String;inLjava/io/ObjectInputStream;Ljava/io/ObjectOutputStream;eLjava/lang/Exception;
SourceFile
DateTest.javaFastJavac3.0!	0*·±
	.²¶¸"±	
	#$	cÓ*¾Ÿ¸&*2¶,rŸ*2¶,R A».Y»0Y*2·2·5M,¶9À;³=,¶@²C»EYG·H²=¶L¶P¶Q¶§m*2¶,wŸ*2¶,W R»;YÑ·T³=»VY»XY*2·Y·\M,²=¶`,¶c,¶d²C»EYf·H²=¶L¶P¶Q¶§¸&§M,¶k±
ÊÍmF !
$"%4&>'B(`*x+ˆ,š-¡.¥/©0Ç2Í6Ò
*Óno4)pqš*ArÎstuvw
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?007f01c08166$36d0e140$4c00000a>