javaarrayseclipsedebuggingrxtx

Eclipse displays red values for a Java byte array when debugging


I am currently working on a software that makes a serial communication with a hand-made simulator using the RXTX library. To test the limits of my software, I set distinct COM parameters between my 2 programs ; the main software send messages with a baud rate of 9600 and the simulator receives with a baud rate of 19200.

When I try to send the following array: "GET IN_NUM_TRAIN".getBytes() (16 bytes), my simulator receives a byte array containing 27 elements and throws:

INFOS: Traitement du message : ~�``�8���f���f�

java.lang.StringIndexOutOfBoundsException: String index out of range: 26

When I try debugging my code, the received byte array looks like this:

Byte array displayed by Eclipse

I don't understand why the 8 first values are displayed in red.


Solution

  • The first 8 values are displayed in red to indicate that they have changed.

    See Eclipse Help - Java development user guide > Reference > Preferences > Debug Preferences:

    Changed value color

    This option allows you to change the color of a changed value in the variables view, expressions view, memory view, anywhere running program variables are rendered

    Default: Red