harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vladimir Molotkov (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-3158) [classlib][luni]ObjectOutputStream.replaceObject fails when serializable object is Class or interface
Date Mon, 26 Feb 2007 04:24:05 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-3158?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12475817
] 

Vladimir Molotkov commented on HARMONY-3158:
--------------------------------------------

Also faced the problem trying to run SPECjAppServer2004 benchmark on JBoss. The bug causes
assertion failure in debug DRLVM on all platforms. It is real showstopper for the benchmark
and must be fixed ASAP.

> [classlib][luni]ObjectOutputStream.replaceObject fails when serializable object is Class
or interface
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3158
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3158
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Igor V. Stolyarov
>         Attachments: H-3158.patch
>
>
> ObjectOutputStream.replaceObject fails when serializable object is Class or interface
> Test:
> import java.net.*;
> import java.io.*;
> import java.util.*;
> public class Test{
>         
>     private static class ObjectOutputStreamWithReplace extends
>             ObjectOutputStream {
>         public ObjectOutputStreamWithReplace(OutputStream out)
>                 throws IOException {
>             super(out);
>             enableReplaceObject(true);
>         }
>         protected Object replaceObject(Object obj) throws IOException {
>             if(obj instanceof Integer) obj = new Long(10);
>             return obj;
>         }
>     }
>     public static void main(String argv[]){
>         try {
>             HashMap hm = new HashMap();
>             hm.put("Long", new Integer(10));
>             hm.put("Integer class", Integer.class);
>             ByteArrayOutputStream baos = new ByteArrayOutputStream();
>             ObjectOutputStream oos = new ObjectOutputStream(baos);
>             oos.writeObject(hm);
>             oos.flush();
>             ObjectInputStream ois = new ObjectInputStream(
>                    new ByteArrayInputStream(baos.toByteArray()));
>             
>             HashMap hm1 = (HashMap)ois.readObject();
>             oos.close();
>             ois.close();
>             
>             Object obj = hm1.get("Long");
>             if(obj instanceof Integer) System.out.println("Test part 1 - passed");
>             else System.out.println("Test part 1 - failed"); 
>             obj = hm1.get("Integer class");
>             if(obj == Integer.class) System.out.println("Test part 2 - passed");
>             else System.out.println("Test part 2 - failed");
>             baos = new ByteArrayOutputStream();
>             ObjectOutputStreamWithReplace ooswr = new ObjectOutputStreamWithReplace(
>                                 baos);
>             ooswr.writeObject(hm);
>             ooswr.flush();
>             ois = new ObjectInputStream(
>                    new ByteArrayInputStream(baos.toByteArray()));
>             
>             hm1 = (HashMap)ois.readObject();
>             ooswr.close();
>             ois.close();
>             
>             obj = hm1.get("Long");
>             if(obj instanceof Long) System.out.println("Test part 3 - passed");
>             else System.out.println("Test part 3 - failed"); 
>             obj = hm1.get("Integer class");
>             if(obj == Integer.class) System.out.println("Test part 4 - passed");
>             else System.out.println("Test part 4 - failed");
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
>     }
> }
> ------------------------------------------------
> Output:
> JRockit jdk:
> java version "1.5.0"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
> BEA WebLogic JRockit(R) (build dra-38972-20041208-2001-win-ia32, R25.0.0-75, GC:
>  System optimized over throughput (initial strategy singleparpar))
> Test part 1 - passed
> Test part 2 - passed
> Test part 3 - passed
> Test part 4 - passed
> -------------------------------------------------------------
> Harmony:
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundatio
> n or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r504458, (Feb  7 2007), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test part 1 - passed
> Test part 2 - passed
> Test part 3 - passed
> Test part 4 - failed

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message