Protocol Mixup in JInterface from R7B-0
Shawn Pearce
spearce@REDACTED
Wed Feb 28 22:30:07 CET 2001
Ok, I realize that between release of the OTP distribution that there
may be some issues with protocol changes that may make them not able
to communicate with each other, but one would think that R7B-0's
JInterface could speak to R7B-0's ERTS. But....
In OtpOutputStream.java at line 421 and 424 the method write_long
uses writeBE to send the long value. (As a smallBig on the wire,
whatever that is.) This causes the following behavior to show up.
I'm sending the value 0x08000000. (Bit 27 is the only bit set.)
Erlang to Java ->
Erlang: 134217728
Java: 134217728
Java to Erlang ->
Java: 134217728
Erlang: 8
Clearly this is wrong.
I ran a whole set of test cases with various values in the upper 5
bits of the Java field and every time what I saw in Erlang was the
value bit shifted right 24 bits.
I changed the calls at lines 421 and 424 to writeLE and rebuilt my
entire erlang installation.
Now I see the proper behavior:
Java to Erlang ->
Java: 134217728
Erlang: 134217728
Better:
Java: 983394991
Erlang: 983394991
Has this error been fixed in subsequent releases?? This is our 3rd
patch to JInterface (the others are the famous acceptor null pointer
fix and the patches I posted earlier with the hash functions implemented
for the OtpErlang objects which were missing them).
Patch file is attached for those interested.
--
Shawn.
``If this had been a real
life, you would have
received instructions
on where to go and what
to do.''
-------------- next part --------------
*** otp_src_R7B-0.orig/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java Tue Aug 22 08:02:25 2000
--- otp_src_R7B-0/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpOutputStream.java Wed Feb 28 16:06:58 2001
***************
*** 415,429 ****
this.write1(OtpExternal.smallBigTag);
this.write1(4); // length
if (l < 0) {
this.write1(1); // sign
! this.write4BE(-l); // value
}
else {
this.write1(0); // sign
! this.write4BE(l); //value
}
}
}
/**
--- 415,429 ----
this.write1(OtpExternal.smallBigTag);
this.write1(4); // length
if (l < 0) {
this.write1(1); // sign
! this.write4LE(-l); // value
}
else {
this.write1(0); // sign
! this.write4LE(l); //value
}
}
}
/**
More information about the erlang-questions
mailing list