Java does not go through catch (Exception e) directly to finally or exit reason

Source: Internet
Author: User
Tags log log throwable

Today has a very wonderful problem! At the time of writing the Hadoop program! New An Object! The program runs directly to the finally code block! The exception in the catch also did not execute.

New Configuration ();

I wonder for a long time! I went to see the source of Hadoop! The new object is not doing anything, just some normal assignment! Later on the internet to find a long time to find that the original was turned into a throwable thrown! And exception is Throwable sub-class, so can not capture, only the time to capture Throwable, the error message to print!

This is due to the fact that there is a static variable in the configuration class of Hadoop and an exception occurred when ClassLoader loaded class.

Private Static Final Log log =    logfactory.getlog (Configuration. class);

My mistake was retarded, just because I didn't add the common-logging bag! Believe the general situation this kind of thing very few people will encounter! But today, it is a lesson to be learned, so that people with this kind of doubt can be solved! So, don't think catch (Exception e) is all right, Throwable is the ultimate boss!

And why is it that Throwable is thrown here instead of exception? I've never found a reason to find it! I hope that Daniel can tell you! My little brother thanked me here!

  

Java does not go through catch (Exception e) directly to finally or exit reason

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.