1.1 --- a/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java Thu May 14 20:12:26 2015 -0700 1.2 +++ b/src/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java Tue May 19 21:51:03 2015 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -32,6 +32,7 @@ 1.11 package com.sun.corba.se.impl.io; 1.12 1.13 import java.io.IOException; 1.14 +import java.io.NotActiveException; 1.15 import java.io.OutputStream; 1.16 import java.io.ObjectOutputStream; 1.17 import java.io.ObjectOutput; 1.18 @@ -154,7 +155,9 @@ 1.19 1.20 public ObjectOutputStream.PutField putFields() 1.21 throws IOException { 1.22 - putFields = new HookPutFields(); 1.23 + if (putFields == null) { 1.24 + putFields = new HookPutFields(); 1.25 + } 1.26 return putFields; 1.27 } 1.28 1.29 @@ -175,8 +178,11 @@ 1.30 throws IOException { 1.31 1.32 writeObjectState.defaultWriteObject(this); 1.33 - 1.34 - putFields.write(this); 1.35 + if (putFields != null) { 1.36 + putFields.write(this); 1.37 + } else { 1.38 + throw new NotActiveException("no current PutField object"); 1.39 + } 1.40 } 1.41 1.42 abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();