Skip to content

Commit

Permalink
open-dis#68: Trying to fix ExperimentalPdu
Browse files Browse the repository at this point in the history
  • Loading branch information
abutler committed Mar 12, 2020
1 parent 1ae3b3a commit 80cf439
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/edu/nps/moves/disutil/ExperimentalPdu.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public void setBody(byte[] body) {
}

@Override
public void setPduLength(int pPduLength) {
super.setPduLength(pPduLength);
body = new byte[pPduLength = super.getMarshalledSize()];
}

@Override
public int getMarshalledSize() {
return super.getMarshalledSize() + body.length;
}
Expand All @@ -62,7 +68,8 @@ public void marshal(java.nio.ByteBuffer buff) {
public void unmarshal(java.nio.ByteBuffer buff) {
super.unmarshal(buff);

body = new byte[this.getPduLength() - 12]; // 12 is size of the pdu header.
// abutler - The body is now initialized in the setPduLength() call
// body = new byte[this.getPduLength() - 12]; // 12 is size of the pdu header.
buff.get(body);
}
}

0 comments on commit 80cf439

Please sign in to comment.