db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tomohito Nakayama (JIRA)" <derby-...@db.apache.org>
Subject [jira] Created: (DERBY-1396) ReEncodedInputStream may fail to read all of source Reader.
Date Mon, 12 Jun 2006 13:48:29 GMT
 ReEncodedInputStream may fail to read all of source Reader.
------------------------------------------------------------

         Key: DERBY-1396
         URL: http://issues.apache.org/jira/browse/DERBY-1396
     Project: Derby
        Type: Bug

    Reporter: Tomohito Nakayama


The class org.apache.derby.impl.drda.ReEncodedInputStream seems to have a bug...

In this class, there exists next code.

        int count;
	if(( count = reader.read(decodedBuffer_, 0, BUFFERED_CHAR_LEN )) < 1 ){
	    return null;
	}

In this code, the condition of "<1" was intended to judge whether reader was read entirely.
However,spec of java api says that reader returns -1 if the end of the reader has been reached
and not 0.
Then "<1" is not appropriate.

Current code judges 0 as the end of reader.
Then, if 0 was returned in the meaning that "No character was read now but may continue" as
possible in java api, 
this code will not work correctly...

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message