hupeng1991 / java-image-scaling

Automatically exported from code.google.com/p/java-image-scaling
Other
0 stars 0 forks source link

e.printStackTrace() inside a catched exception #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Get to doFilter method ResampleOp - This method calls waitForAllThreads
2. Interrupt the threads

What is the expected output? What do you see instead?
I would expect to only get a RuntimeException. Instead there's also a 
e.printStackTrace() call. This is written outside of the regular log-flow and 
causing the ".out" file (the one I'm using for printing stdout) to fill up 
quickly.

What version of the product are you using? On what operating system?
java-image-scaling-0.85. OS does not seem relevant - I'm running on different 
OSs (linux and mac mostly)

Please provide any additional information below.
All that needs to be done is to delete line 199 in ResampleOp.java. The caller 
is supposed to handle the exception anyway so there's no behavioural change in 
the flow.

Original issue reported on code.google.com by aetzi...@outbrain.com on 22 Apr 2014 at 7:57

GoogleCodeExporter commented 8 years ago
Adding suggested patch for fix

Original comment by aetzi...@outbrain.com on 22 Apr 2014 at 8:02

Attachments:

GoogleCodeExporter commented 8 years ago
I'd add that there's a bogus handling of interruptions there as well.

You need to restore the thread interrupted state, or you disrespect 
interruptions.

    private void waitForAllThreads(Thread[] threads) {
        try {
            for (Thread t:threads){
                t.join(Long.MAX_VALUE);
            }
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException(e);
        }
    }

Original comment by harel.e...@gmail.com on 22 Apr 2014 at 8:33

GoogleCodeExporter commented 8 years ago
Thanks for reporting the bug. I have fixed the bug as you suggested. 

Original comment by mor...@nobel-joergensen.com on 22 Apr 2014 at 8:56