Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,12 @@ public String toString() {
if (message == null) {
message = super.toString();
}
return Integer.toString(status) + ": " + message;
String finalString = status + ": " + message;
Throwable cause = getCause();
if (cause != null) {
finalString = finalString + " : \n" + "cause: " + cause.getMessage();
}
return finalString;
Copy link
Member

Choose a reason for hiding this comment

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

Are we changing the response string, I am not sure about the compatibility here.
The above javadoc says

String value does not include exception type, just exit code and message.

We shouldn't make prod level API changes for MiniDFSCluster

Copy link
Contributor Author

@virajjasani virajjasani Aug 2, 2022

Choose a reason for hiding this comment

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

just exit code and message

In a way, we are just improving the message by also including cause message if any cause is associated. I just thought it would be good improvement. We are still not including exception type even with this patch as the Javadoc claims. Only if we print the cause itself, then we would have included exception type. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But if you still think we should not include cause.getMessage() in addition to this.getMessage(), I can remove it. It's just that we would be able to include one more layer of message to the existing message if we can include cause.getMessage() as well, just a minor improvement.

}
}

Expand Down Expand Up @@ -139,7 +144,12 @@ public String toString() {
if (message == null) {
message = super.toString();
}
return Integer.toString(status) + ": " + message;
String finalString = status + ": " + message;
Throwable cause = getCause();
if (cause != null) {
finalString = finalString + " : \n" + "cause: " + cause.getMessage();
}
return finalString;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2159,10 +2159,10 @@ public void shutdown(boolean deleteDfsDir, boolean closeFileSystem) {
LOG.info("Shutting down the Mini HDFS Cluster");
if (checkExitOnShutdown) {
if (ExitUtil.terminateCalled()) {
LOG.error("Test resulted in an unexpected exit",
ExitUtil.getFirstExitException());
ExitUtil.ExitException exitException = ExitUtil.getFirstExitException();
LOG.error("Test resulted in an unexpected exit", exitException);
ExitUtil.resetFirstExitException();
throw new AssertionError("Test resulted in an unexpected exit");
throw new AssertionError("Test resulted in an unexpected exit", exitException);
}
}
if (closeFileSystem) {
Expand Down