@@ -44,56 +44,53 @@ public boolean executedAsPlanned() {
4444 public void reset () {
4545 setExecuted (false );
4646 }
47-
48- private void deepCopyRecords (TlsContext src , TlsContext dst )
49- {
47+
48+ private void deepCopyRecords (TlsContext src , TlsContext dst ) {
5049 LinkedList <AbstractRecord > recordBuffer = new LinkedList <>();
5150 ObjectOutputStream outStream ;
5251 ObjectInputStream inStream ;
5352 try {
5453 for (AbstractRecord record : src .getRecordBuffer ()) {
55-
56- ByteArrayOutputStream stream = new ByteArrayOutputStream ();
57- outStream = new ObjectOutputStream (stream );
58- outStream .writeObject (record );
59- outStream .close ();
60- inStream = new ObjectInputStream (new ByteArrayInputStream (stream .toByteArray ()));
61- AbstractRecord recordCopy = (AbstractRecord ) inStream .readObject ();
62-
63- recordBuffer .add (recordCopy );
64- }
54+
55+ ByteArrayOutputStream stream = new ByteArrayOutputStream ();
56+ outStream = new ObjectOutputStream (stream );
57+ outStream .writeObject (record );
58+ outStream .close ();
59+ inStream = new ObjectInputStream (new ByteArrayInputStream (stream .toByteArray ()));
60+ AbstractRecord recordCopy = (AbstractRecord ) inStream .readObject ();
61+
62+ recordBuffer .add (recordCopy );
63+ }
6564 } catch (IOException | ClassNotFoundException ex ) {
66- LOGGER .error ("Error while creating deep copy of recordBuffer" );
67- throw new WorkflowExecutionException (ex .toString ());
65+ LOGGER .error ("Error while creating deep copy of recordBuffer" );
66+ throw new WorkflowExecutionException (ex .toString ());
6867 }
69-
68+
7069 dst .setRecordBuffer (recordBuffer );
7170 }
72-
73- private void deepCopyMessages (TlsContext src , TlsContext dst )
74- {
75- LinkedList <ProtocolMessage > messageBuffer = new LinkedList <>();
71+
72+ private void deepCopyMessages (TlsContext src , TlsContext dst ) {
73+ LinkedList <ProtocolMessage > messageBuffer = new LinkedList <>();
7674 ObjectOutputStream outStream ;
7775 ObjectInputStream inStream ;
7876 try {
7977 for (ProtocolMessage message : src .getMessageBuffer ()) {
80-
81- ByteArrayOutputStream stream = new ByteArrayOutputStream ();
82- outStream = new ObjectOutputStream (stream );
83- outStream .writeObject (message );
84- outStream .close ();
85- inStream = new ObjectInputStream (new ByteArrayInputStream (stream .toByteArray ()));
86- ProtocolMessage messageCopy = (ProtocolMessage ) inStream .readObject ();
87-
88- messageBuffer .add (messageCopy );
89- }
78+
79+ ByteArrayOutputStream stream = new ByteArrayOutputStream ();
80+ outStream = new ObjectOutputStream (stream );
81+ outStream .writeObject (message );
82+ outStream .close ();
83+ inStream = new ObjectInputStream (new ByteArrayInputStream (stream .toByteArray ()));
84+ ProtocolMessage messageCopy = (ProtocolMessage ) inStream .readObject ();
85+
86+ messageBuffer .add (messageCopy );
87+ }
9088 } catch (IOException | ClassNotFoundException ex ) {
91- LOGGER .error ("Error while creating deep copy of messageBuffer" );
92- throw new WorkflowExecutionException (ex .toString ());
89+ LOGGER .error ("Error while creating deep copy of messageBuffer" );
90+ throw new WorkflowExecutionException (ex .toString ());
9391 }
94-
95- dst .setMessageBuffer (messageBuffer );
92+
93+ dst .setMessageBuffer (messageBuffer );
9694 }
97-
9895
9996}
0 commit comments