ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Hashtable/ReadObject.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Hashtable/ReadObject.java (file contents):
Revision 1.1 by jsr166, Tue Sep 1 01:25:04 2009 UTC vs.
Revision 1.7 by jsr166, Mon Jan 8 03:56:32 2018 UTC

# Line 1 | Line 1
1   /*
2 < * Copyright 2003 Sun Microsystems, Inc.  All Rights Reserved.
2 > * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
3   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4   *
5   * This code is free software; you can redistribute it and/or modify it
# Line 16 | Line 16
16   * 2 along with this work; if not, write to the Free Software Foundation,
17   * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18   *
19 < * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 < * CA 95054 USA or visit www.sun.com if you need additional information or
21 < * have any questions.
19 > * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 > * or visit www.oracle.com if you need additional information or have any
21 > * questions.
22   */
23  
24 < /**
24 > /*
25   * @test
26   * @bug 4652911
27   * @summary test Hashtable readObject for invocation of overridable put method
28   */
29 import java.util.Hashtable;
29  
31 import java.io.ByteArrayOutputStream;
32 import java.io.ObjectOutputStream;
30   import java.io.ByteArrayInputStream;
31 + import java.io.ByteArrayOutputStream;
32   import java.io.ObjectInputStream;
33 + import java.io.ObjectOutputStream;
34   import java.io.Serializable;
35 + import java.util.Hashtable;
36  
37   /**
38   * Class that extends Hashtable to demonstrate bug when
# Line 52 | Line 52 | public class ReadObject extends Hashtabl
52          Object getValue() {
53              return mValue;
54          }
55 <    };
55 >    }
56  
57      public Object get(Object key) {
58          ValueWrapper valueWrapper = (ValueWrapper)super.get(key);
59          Object value = valueWrapper.getValue();
60 <        if(value instanceof ValueWrapper)
60 >        if (value instanceof ValueWrapper)
61              throw new RuntimeException("Hashtable.get bug");
62          return value;
63      }
64  
65      public Object put(Object key, Object value) {
66 <        if(value instanceof ValueWrapper)
66 >        if (value instanceof ValueWrapper)
67              throw new RuntimeException(
68                  "Hashtable.put bug: value is already wrapped");
69          ValueWrapper valueWrapper = new ValueWrapper(value);
# Line 98 | Line 98 | public class ReadObject extends Hashtabl
98          ReadObject myHashtableCopy = (ReadObject)copyObject(myHashtable);
99          String value = (String)myHashtableCopy.get("key");
100      }
101 < };
101 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines