Menu

Apparent bug in UDTInputStream.read()

Anonymous
2011-10-28
2013-05-17
  • Anonymous

    Anonymous - 2011-10-28

    The method should return positive values in the range 0…255 in the case of success and -1 for errors. However, as bytes are always signed in Java, the statement

    return single[0];
    

    (line 85 in UDTInputStream.java) may also return negative values and, in particular, returns -1 when the byte 0xFF is received. As a result, standard Java classes like DataInputStream throw EOFExceptions when used with an UDTInputStream. I could solve this problem by replacing the line with

    return ((int) single[0]) & 0xff;
    
     
  • Bernd Schuller

    Bernd Schuller - 2011-11-17

    thanks, the fix is commited
    Bernd.

     
  • Bernd Schuller

    Bernd Schuller - 2011-11-17

    … and sorry for the horribly late reaction :-(

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.