Versions Compared

Key

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

...

Wiki Markup
This noncompliant example is from the {{sun.net.httpserver.ChunkedInputStream}} class. The {{InputStream}} class's {{read()}} method returns a signed byte in the form of a signed integer. In this case, the end of stream is being checked by casting the return value to a {{char}}. This conversion would leave the value of {{c}} as {{0xffff}} ({{Character.MAX_VALUE}}, decimal 65535) instead of -1. The termination test is doomed to fail. \[[Pugh 08|AA. Java References#Pugh 08]\] 

...