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

Exception stack trace overwritten #13

Closed
raduioanstoica opened this issue Feb 27, 2017 · 1 comment
Closed

Exception stack trace overwritten #13

raduioanstoica opened this issue Feb 27, 2017 · 1 comment

Comments

@raduioanstoica
Copy link
Member

Catch all clauses sometimes obfuscate the original exception. For example, in client/src/main/java/com/ibm/crail/CrailBufferedInputStream.java:230, the catch clause creates and throws a new exception which results in loosing the actual stack trace:

       private void triggerFetch() throws IOException {
                try {
                        if (future == null && internalBuf.remaining() == 0){
                                internalBuf.clear();
                                future = inputStream.read(internalBuf);
                                if (future == null){
                                        internalBuf.clear().flip();
                                }
                        }
                } catch(Exception e) {
                        throw new IOException(e);
                }
        }

A simple solution would be to print the original stack trace. A better solution would be to remove the try-catch and force the enclosed code to properly deal with all non-IOExceptions.

@patrickstuedi
Copy link
Member

Inner exception can always be accessed, stacktrace is maintained.

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

No branches or pull requests

2 participants