Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In Java, byte arrays are often used to transmit raw binary data and character encoded data. An attempt to read raw binary data as if it were character encoded data fails because some of the bytes may not represent valid characters in the default or specified encoding scheme. For instance, a cryptographic key containing non-representable bytes may be required to be converted to character encoded data for its suitable transmission. However, this may produce errorneous results.

Also , see guidelines FIO02-J. Keep track of bytes read and account for character encoding while reading data and FIO03-J. Specify the character encoding while performing file or network IO.

...

Attempting to read a byte array containing raw character data as if it were character data may produce erroneous results.

Rule Guideline

Severity

Likelihood

Remediation Cost

Priority

Level

FIO11-J

Low

Unlikely

Medium

P???

L???

...