8079821: MSOID2.java test is not perfect

Reviewed-by: valeriep
This commit is contained in:
Weijun Wang 2015-06-04 15:29:23 +08:00
parent c3d9e6c08d
commit 625d9cb9b8

View File

@ -68,7 +68,14 @@ public class MSOID2 {
nt[0x1d] = (byte)0x82; // change the 1st to MS OID
// Length bytes to be tweaked
for (int pos: new int[] {3, 0xf, 0x13, 0x15, 0x17}) {
nt[pos] = (byte)(nt[pos] + 11);
int newLen = (nt[pos]&0xff) + 11;
// The length byte at nt[pos] might overflow. It's
// unlikely for nt[pos-1] to overflow, which means the size
// of token is bigger than 65535.
if (newLen >= 256) {
nt[pos-1] = (byte)(nt[pos-1] + 1);
}
nt[pos] = (byte)newLen;
}
t = nt;
new sun.misc.HexDumpEncoder().encodeBuffer(t, System.out);