Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

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 @@ -189,12 +189,25 @@ int printExceptionAndFreeV(JNIEnv *env, jthrowable exc, int noPrintFlags,
if (!rootCause) {
fprintf(stderr, "(unable to get root cause for %s)\n", className);
} else {
fprintf(stderr, "%s", rootCause);
// Trim overly long rootCause message after new-line.
const char *newlnIndex = strchr(rootCause, '\n');
int displayLen = 80;
if (newlnIndex != NULL) {
int newLen = (int) (newlnIndex - rootCause);
if (newLen > 10 && newLen < 200) {
// Keep message a reasonable length.
displayLen = newLen;
}
}
fprintf(stderr, "%.*s\n", displayLen, rootCause);
}
if (!stackTrace) {
fprintf(stderr, "(unable to get stack trace for %s)\n", className);
} else {
fprintf(stderr, "%s", stackTrace);
if (!(noPrintFlags & NOSTACK_FILE_NOT_FOUND)) {
// Do not print stack for file not found
if (!stackTrace) {
fprintf(stderr, "(unable to get stack trace for %s)\n", className);
} else {
fprintf(stderr, "%s", stackTrace);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
*/
#define PRINT_EXC_ALL 0x00
#define NOPRINT_EXC_FILE_NOT_FOUND 0x01
#define NOSTACK_FILE_NOT_FOUND 0x100
#define NOPRINT_EXC_ACCESS_CONTROL 0x02
#define NOPRINT_EXC_UNRESOLVED_LINK 0x04
#define NOPRINT_EXC_PARENT_NOT_DIRECTORY 0x08
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ static hdfsFile hdfsOpenFileImpl(hdfsFS fs, const char *path, int flags,
jReplication, jBlockSize);
}
if (jthr) {
ret = printExceptionAndFree(env, jthr, PRINT_EXC_ALL,
ret = printExceptionAndFree(env, jthr, NOSTACK_FILE_NOT_FOUND,
"hdfsOpenFile(%s): FileSystem#%s(%s)", path, method, signature);
goto done;
}
Expand Down