Skip to content

Conversation

@srowen
Copy link
Member

@srowen srowen commented Apr 28, 2017

What changes were proposed in this pull request?

Avoid failing to initCause on JDBC exception with cause initialized to null

How was this patch tested?

Existing tests

@SparkQA
Copy link

SparkQA commented Apr 28, 2017

Test build #76265 has finished for PR 17800 at commit ad38533.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

try {
e.initCause(cause)
} catch {
// cause may have been explicitly initialized to null, in which case this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on my understanding, IllegalStateException is not caused by the value of cause.

@throws IllegalStateException if this throwable was
        created with {@link #Throwable(Throwable)} or
        {@link #Throwable(String,Throwable)}, or this method has already
        been called on this throwable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the issue is simply whether the cause has been initialized at all. If it has been initialized to null, then e.getCause returns null, but the current code takes that to mean the cause is uninitialized (because it would return null) in that case. If it were initialized to an actual exception it already would call addSuppressed instead.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gatorsmile oh are you suggesting the comment is a bit misleading? yeah I can fix that to be clearer about the scenario

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah. Please update the comment. Thanks!

@gatorsmile
Copy link
Member

LGTM

@SparkQA
Copy link

SparkQA commented May 1, 2017

Test build #76354 has finished for PR 17800 at commit f6f2b7a.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@gatorsmile
Copy link
Member

Thanks! Merging to master/2.2

@asfgit asfgit closed this in af726cd May 2, 2017
asfgit pushed a commit that referenced this pull request May 2, 2017
…ady initialized after getting SQLException

## What changes were proposed in this pull request?

Avoid failing to initCause on JDBC exception with cause initialized to null

## How was this patch tested?

Existing tests

Author: Sean Owen <[email protected]>

Closes #17800 from srowen/SPARK-20459.

(cherry picked from commit af726cd)
Signed-off-by: Xiao Li <[email protected]>
@srowen
Copy link
Member Author

srowen commented May 2, 2017

@gatorsmile do you think this should go back into 2.1? seems like a clean fix to a non-trivial problem. I don't particularly care either way; you may have more context about the problem.

@srowen srowen deleted the SPARK-20459 branch May 3, 2017 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants