--- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java Mon Mar 23 18:02:19 2015 +++ new/src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java Mon Mar 23 18:02:19 2015 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2015, 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 @@ -152,9 +152,11 @@ public abstract void defaultWriteObjectDelegate(); - public ObjectOutputStream.PutField putFields() + public synchronized ObjectOutputStream.PutField putFields() throws IOException { - putFields = new HookPutFields(); + if (putFields == null) { + putFields = new HookPutFields(); + } return putFields; } @@ -175,8 +177,11 @@ throws IOException { writeObjectState.defaultWriteObject(this); - - putFields.write(this); + synchronized (this) { + if (putFields != null) { + putFields.write(this); + } + } } abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();