Bug #44588 Streaming result set error message never displayed
Submitted: 30 Apr 23:33 Modified: 26 May 12:47
Reporter: Todd Farmer
Status: Closed
Category:Connector/J Severity:S3 (Non-critical)
Version:5.1.7 OS:Any
Assigned to: Todd Farmer Target Version:

[30 Apr 23:33] Todd Farmer
Description:
There is logic to generate a message text specifically for streaming result sets when
there are CommunicationsExceptions, but this is never reached:

In CommunicationsException:

	private boolean streamingResultSetInPlay = false;

	public CommunicationsException(ConnectionImpl conn, long lastPacketSentTimeMs,
			long lastPacketReceivedTimeMs, Exception underlyingException) {

		this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn,
				lastPacketSentTimeMs, lastPacketReceivedTimeMs, underlyingException,
this.streamingResultSetInPlay);

streamingResultSetInPlay is always false, which causes the following to never be executed
in SQLError.createLinkFailureMessageBasedOnHeuristics():

		if (streamingResultSetInPlay) {
			exceptionMessageBuf.append(Messages
					.getString("CommunicationsException.ClientWasStreaming")); //$NON-NLS-1$
		} else {
...

How to repeat:
See code referenced above.

Suggested fix:
Defer message creation until CommunicationsException.getMessage().
[1 May 1:29] Todd Farmer
Patched in r791.
[3 May 1:19] Todd Farmer
Fixed for 5.1.8.
[26 May 12:47] Tony Bedford
An entry was added to the 5.1.8 changelog:

Connector/J contains logic to generate a message text specifically for streaming result
sets when there are CommunicationsException exceptions generated. However, this code was
never reached.

In the CommunicationsException code:

private boolean streamingResultSetInPlay = false;

public CommunicationsException(ConnectionImpl conn, long lastPacketSentTimeMs,
long lastPacketReceivedTimeMs, Exception underlyingException) {

this.exceptionMessage = SQLError.createLinkFailureMessageBasedOnHeuristics(conn,
      lastPacketSentTimeMs, lastPacketReceivedTimeMs, underlyingException,
      this.streamingResultSetInPlay);

streamingResultSetInPlay was always false, which in the following code in
SQLError.createLinkFailureMessageBasedOnHeuristics() never being executed:

if (streamingResultSetInPlay) {
    exceptionMessageBuf.append(
    Messages.getString("CommunicationsException.ClientWasStreaming")); //$NON-NLS-1$
} else {
...