Skip to content

Commit

Permalink
Transplant fix from SE
Browse files Browse the repository at this point in the history
a8e9ef12aee12dd87b60fd66168e21fcb4d64516
  • Loading branch information
pzygielo committed Nov 24, 2022
1 parent 59c8600 commit 92306f9
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.sun.corba.ee.impl.io;

import java.io.IOException;
import java.io.NotActiveException;
import java.io.ObjectOutputStream;
import java.io.ObjectOutput;
import java.util.Map;
Expand All @@ -32,7 +33,7 @@
@StreamFormatVersion
public abstract class OutputStreamHook extends ObjectOutputStream
{
private HookPutFields putFields = new HookPutFields();
private HookPutFields putFields = null;

/**
* Since ObjectOutputStream.PutField methods specify no exceptions,
Expand Down Expand Up @@ -146,6 +147,9 @@ public void defaultWriteObject() throws IOException {
@Override
public ObjectOutputStream.PutField putFields()
throws IOException {
if (putFields == null) {
putFields = new HookPutFields();
}
return putFields;
}

Expand All @@ -169,7 +173,11 @@ public void writeFields()

writeObjectState.defaultWriteObject(this);

putFields.write(this);
if (putFields != null) {
putFields.write(this);
} else {
throw new NotActiveException("no current PutField object");
}
}

abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
Expand Down

0 comments on commit 92306f9

Please sign in to comment.