R
Rolfje
Hello,
I have a strange problem when transporting a String and it's byteArray
between 2 JVM's on the same machine. The JVMs are seperately started
instances of IBM's 1.3.1 JVM which also comes with Websphere 4.5.
On JVM1, I have something along the lines of:
String jvm1String = "Some nice String";
byte[] jvm1bytes = jvm1String.getBytes("ISO-8859-1");
Now, I transport the string and the array through RMI toto JVM2. In
JVM2 I do the following:
jvm2bytes = jvm1String.getBytes("ISO-8859-1");
for (int i = 0; i < jvm2bytes.length; i++) {
if (jvm2bytes != jvm1bytes) return false;
}
This allways returns false. Manually checking the arrays shows that the
two byte arrays only differ somewhere in the middle, and only for about
2 bytes, regardless the content of the String. I have no idea what
would cause java to behave differently between the two jvm's.
My question is: Is this likely to be a bug in:
a) the transportation of Strings over RMI
b) the transportation of byte arrays over RMI
c) the way String.getBytes("ISO-8859-1") is implemented
d) the way I am using rmi or the getBytes() method
Due to requirements, I can not change the JVM, so I need to find a way
around this. I am using the bytearrays to verify data integrity.
Thanks in advance,
Rolf
I have a strange problem when transporting a String and it's byteArray
between 2 JVM's on the same machine. The JVMs are seperately started
instances of IBM's 1.3.1 JVM which also comes with Websphere 4.5.
On JVM1, I have something along the lines of:
String jvm1String = "Some nice String";
byte[] jvm1bytes = jvm1String.getBytes("ISO-8859-1");
Now, I transport the string and the array through RMI toto JVM2. In
JVM2 I do the following:
jvm2bytes = jvm1String.getBytes("ISO-8859-1");
for (int i = 0; i < jvm2bytes.length; i++) {
if (jvm2bytes != jvm1bytes) return false;
}
This allways returns false. Manually checking the arrays shows that the
two byte arrays only differ somewhere in the middle, and only for about
2 bytes, regardless the content of the String. I have no idea what
would cause java to behave differently between the two jvm's.
My question is: Is this likely to be a bug in:
a) the transportation of Strings over RMI
b) the transportation of byte arrays over RMI
c) the way String.getBytes("ISO-8859-1") is implemented
d) the way I am using rmi or the getBytes() method
Due to requirements, I can not change the JVM, so I need to find a way
around this. I am using the bytearrays to verify data integrity.
Thanks in advance,
Rolf