[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

HashMap serialization does not work

>Submitter-Id:	net
>Originator:	Stepan Koltsov
>Confidential:	no
>Synopsis: HashMap serialization does not work
>Severity: serious
>Priority:	medium
>Category:	libgcj
>Class:		sw-bug
>Release:	3.3.1 20030722 (Debian prerelease) (Debian testing/unstable)
System: Linux banana.mx1.ru 2.4.18 #3 Thu Jun 27 17:31:10 UTC 2002 i686 GNU/Linux
Architecture: i686

host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i386-linux

Library serialize class HashMap incorrectly -- it reads empty map from stream.


Source code:

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception {
		ObjectOutputStream oo =
				new ObjectOutputStream(new FileOutputStream("1"));
		Map m = new HashMap();
		m.put("12", "13");
		m.put("45", "67");
		ObjectInputStream ii =
				new ObjectInputStream(new FileInputStream("1"));
		Object n = ii.readObject();


{12=13, 45=67}

when invoking class with gij or after compiling with gcj, on Linux and FreeBSD.
It should print

{12=13, 45=67}
{12=13, 45=67}

this is output of Sun's Java.


I don't know.

Reply to: