Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACCUMULO-4546 Create default log message for IllegalTableTransitionException #327

Merged
merged 8 commits into from Nov 30, 2017
Merged

ACCUMULO-4546 Create default log message for IllegalTableTransitionException #327

merged 8 commits into from Nov 30, 2017

Conversation

jmark99
Copy link
Contributor

@jmark99 jmark99 commented Nov 28, 2017

ACCUMULO-4546 Create default log message for IllegalTableTransitionException

Updated the IllegalTableTransitionException class within TableManager.java to print
a default log message when exception is thrown. User also has option of supplying a
custom message. Created unit test.

Moved import in AccumuloTest.java to make mvn happy.

Updated the IllegalTableTransitionException class within TableManager.java to print
a default log message when exception is thrown. User also has option of supplying a
custom message as well.

Created a unit test as well.
…ception

Updated the IllegalTableTransitionException class within TableManager.java to have
a default log message when exception is thrown. User also has option of supplying a
custom message. Created unit test.

Moved location of an import in AccumuloTest.java to make mvn happy.
…xception

    Updated the IllegalTableTransitionException class within TableManager.java to have
    a default log message when exception is thrown. User also has option of supplying a
    custom message. Created unit test.

    Moved location of an import in AccumuloTest.java to make mvn happy.
…ception

ACCUMULO-4546 Updated the IllegalTableTransitionException class within TableManager.java to print
a default log message when exception is thrown. User also has option of supplying a
custom message. Created unit test.

Moved import in AccumuloTest.java to make mvn happy.
…ception

ACCUMULO-4546 Updated the IllegalTableTransitionException class within TableManager.java to print
a default log message when exception is thrown. User also has option of supplying a
custom message. Created unit test.

Moved import in AccumuloTest.java to make mvn happy.
…xception

    Updated the IllegalTableTransitionException class within TableManager.java to have
    a default log message when exception is thrown. User also has option of supplying a
    custom message. Created unit test.

    Moved location of an import in AccumuloTest.java to make mvn happy.
@asfgit
Copy link

asfgit commented Nov 28, 2017

Can one of the admins verify this patch?

@Test
public void testIllegalTableTransitionExceptionEmptyMessage() {
try {
throw new TableManager.IllegalTableTransitionException(oldState, newState, "");
Copy link
Contributor

Choose a reason for hiding this comment

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

In addition to "", could also try null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went back and forth between null and the empty string. Both will work. I can go with either if you have a preference.

Copy link
Contributor

Choose a reason for hiding this comment

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

I saw both were supported in the code. I was thinking could have test for both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added additional unit test.

this.oldState = oldState;
this.newState = newState;

String defaultMessage = "Error transitioning from " + oldState + " state to " + newState + " state";
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be moved inside the else block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes...done.

…ception

Moved the defaultMessage declaration inside the if/else block.
this.oldState = oldState;
this.newState = newState;

if (message != null && !message.isEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

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

Could use StringUtils.isNotEmpty() from apache commons. Or even static import it so it just reads if(isNotEmpty(message))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, @milleruntime . I like that better.

…ception

Added unit test for null message. Also, updated message check to use StringUtils.isNotEmpty()
@milleruntime milleruntime merged commit e738351 into apache:1.7 Nov 30, 2017
@jmark99 jmark99 deleted the ACCUMULO-4546-1 branch February 8, 2018 13:28
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.

None yet

5 participants