totalBytesRead += bytesRead;
} catch (java.io.IOException e) {
padScalarStreamForError(leftToRead, bytesToRead);
// set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
netAgent_.accumulateReadException(new SqlException(netAgent_.logWriter_,
new ClientMessageId(SQLState.NET_IOEXCEPTION_ON_READ),
new Integer(parameterIndex), e.getMessage(), e));
return;
}
if (bytesRead == -1) {
//padScalarStreamForError(leftToRead, bytesToRead);
// set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
/*throw new SqlException(netAgent_.logWriter_,
"End of Stream prematurely reached while reading InputStream, parameter #" +
parameterIndex +
". Remaining data has been padded with 0x0.");*/
//is it OK to do a chain break Exception here. It's not good to
//pad it with 0 and encrypt and send it to the server because it takes too much time
//can't just throw a SQLException either because some of the data PRPSQLSTT etc have already
//been sent to the server, and server is waiting for EXTDTA, server hangs for this.
netAgent_.accumulateChainBreakingReadExceptionAndThrow(
new DisconnectException(netAgent_,
new ClientMessageId(SQLState.NET_PREMATURE_EOS_DISCONNECT),
new Integer(parameterIndex)));
return;
/*netAgent_.accumulateReadException(
new SqlException(netAgent_.logWriter_,
"End of Stream prematurely reached while reading InputStream, parameter #" +
parameterIndex +
". Remaining data has been padded with 0x0."));
return;*/
} else {
pos += bytesRead;
//offset_ += bytesRead; //comment this out for data stream encryption.
leftToRead -= bytesRead;
}
} while (leftToRead > 0);
// check to make sure that the specified length wasn't too small
try {
if (in.read() != -1) {
// set with SQLSTATE 01004: The value of a string was truncated when assigned to a host variable.
netAgent_.accumulateReadException(new SqlException(
netAgent_.logWriter_,
new ClientMessageId(SQLState.NET_INPUTSTREAM_LENGTH_TOO_SMALL),
new Integer(parameterIndex)));
}
} catch (java.io.IOException e) {
netAgent_.accumulateReadException(new SqlException(
netAgent_.logWriter_,
new ClientMessageId(
SQLState.NET_IOEXCEPTION_ON_STREAMLEN_VERIFICATION),
new Integer(parameterIndex),
e.getMessage(),
e));
}