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-1401) TestDataReader class in jdbcapi/Stream.java creates test data of which length is not equals to value passed as length of test data.
Date Tue, 13 Jun 2006 16:26:29 GMT
TestDataReader class in jdbcapi/Stream.java creates test data of which length is not equals
to value passed as length of test data.
-----------------------------------------------------------------------------------------------------------------------------------

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

    Reporter: Tomohito Nakayama


In the work of DERBY-1301, I found this issue.

Seeing the code, next part in org.apache.derbyTesting.functionTests.tests.jdbcapi.Stream.TestDataReader
had problem.

	public int read( char[] cbuf,
			 int off,
			 int len ){
	    
	    if(wroteLength >= total)
		return -1;
	    
	    int i;
	    for(i = off ;
		i < off + len &&
		    wroteLength <= total ;
		i++, wroteLength ++){
		
		cbuf[i] = (char) (wroteLength % 0x10000L);
		
	    }

	    return i - off;
	}

Problem exists in next part...
		    wroteLength <= total 
Because an evaluation of this expression is true when wroteLength equals total,
test data is created beyond max length passed in total.


-- 
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