--- old/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java Wed Jun 25 18:41:09 2014 +++ new/corba/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java Wed Jun 25 18:41:09 2014 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,7 +35,8 @@ import java.io.OutputStream; import java.io.ObjectOutputStream; import java.io.ObjectOutput; -import java.util.Hashtable; +import java.util.Map; +import java.util.HashMap; import org.omg.CORBA.INTERNAL; @@ -49,7 +50,7 @@ */ private class HookPutFields extends ObjectOutputStream.PutField { - private Hashtable fields = new Hashtable(); + private Map fields = new HashMap<>(); /** * Put the value of the named boolean field into the persistent field. @@ -140,7 +141,6 @@ public OutputStreamHook() throws java.io.IOException { super(); - } public void defaultWriteObject() throws IOException { --- /dev/null Wed Jun 25 18:41:10 2014 +++ new/jdk/test/com/sun/corba/se/impl/io/CustomOutputStream.java Wed Jun 25 18:41:10 2014 @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.Serializable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.Principal; +import org.omg.CORBA_2_3.portable.OutputStream; +import org.omg.CORBA_2_3.portable.InputStream; + +public class CustomOutputStream extends OutputStream { + + @Override + public void write_value(Serializable value, Class clz) { + } + + @Override + public InputStream create_input_stream() { + return null; + } + + @Override + public void write_boolean(boolean value) { + } + + @Override + public void write_char(char value) { + } + + @Override + public void write_wchar(char value) { + } + + @Override + public void write_octet(byte value) { + } + + @Override + public void write_short(short value) { + } + + @Override + public void write_ushort(short value) { + } + + @Override + public void write_long(int value) { + } + + @Override + public void write_ulong(int value) { + } + + @Override + public void write_longlong(long value) { + } + + @Override + public void write_ulonglong(long value) { + } + + @Override + public void write_float(float value) { + } + + @Override + public void write_double(double value) { + } + + @Override + public void write_string(String value) { + } + + @Override + public void write_wstring(String value) { + } + + @Override + public void write_boolean_array(boolean[] value, int offset, + int length) { + } + + @Override + public void write_char_array(char[] value, int offset, + int length) { + } + + @Override + public void write_wchar_array(char[] value, int offset, + int length) { + } + + @Override + public void write_octet_array(byte[] value, int offset, + int length) { + } + + @Override + public void write_short_array(short[] value, int offset, + int length) { + } + + @Override + public void write_ushort_array(short[] value, int offset, + int length) { + } + + @Override + public void write_long_array(int[] value, int offset, + int length) { + } + + @Override + public void write_ulong_array(int[] value, int offset, + int length) { + } + + @Override + public void write_longlong_array(long[] value, int offset, + int length) { + } + + @Override + public void write_ulonglong_array(long[] value, int offset, + int length) { + } + + @Override + public void write_float_array(float[] value, int offset, + int length) { + } + + @Override + public void write_double_array(double[] value, int offset, + int length) { + } + + @Override + public void write_Object(org.omg.CORBA.Object value) { + } + + @Override + public void write_TypeCode(TypeCode value) { + } + + @Override + public void write_any(Any value) { + } + + @Override + public void write_Principal(Principal value) { + } + + @Override + public void write(int b) throws java.io.IOException { + } + + @Override + public void write_fixed(java.math.BigDecimal value) { + } + + @Override + public void write_Context(org.omg.CORBA.Context ctx, + org.omg.CORBA.ContextList contexts) { + } + + @Override + public org.omg.CORBA.ORB orb() { + return null; + } +} --- /dev/null Wed Jun 25 18:41:11 2014 +++ new/jdk/test/com/sun/corba/se/impl/io/HookPutFieldsTest.java Wed Jun 25 18:41:11 2014 @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 7095856 + * @summary OutputStreamHook doesn't handle null values + */ + +import java.net.InetAddress; + +import com.sun.corba.se.impl.io.ValueHandlerImpl; +import sun.corba.SharedSecrets; + +public class HookPutFieldsTest { + + public static void main(String[] args ) throws Exception { + CustomOutputStream os = new CustomOutputStream(); + InetAddress a = InetAddress.getByAddress(null, new byte[] {1,2,3,4}); + ValueHandlerImpl vhi = SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl(); + vhi.writeValue(os, a); + } + +}