Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: checked exception thrown from an initializer ok? Date: Tue, 13 Jan 2015 18:06:13 -0500 Organization: A noiseless patient Spider Lines: 18 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 13 Jan 2015 23:05:51 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="bd4e1cba8d8592bec5d5ed9e4537fbfd"; logging-data="4084"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fdQHPib5Kz/gIV6OXr523" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 In-Reply-To: Cancel-Lock: sha1:Us/CGu4NPKvJRxrwbcIPzR8mDaM= Xref: csiph.com comp.lang.java.programmer:30700 On 1/13/2015 5:40 PM, Andreas Leitgeb wrote: > I just stumbled into a surprise and I can't tell yet, whether > to be relieved or worried... > > To avoid some unneccessary verbosity lateron, I defined in a > central class: > public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1"); > > What surprises me is, that eclipse accepts it without barfing > about the unhandled exception. [...] It's not necessary to handle unchecked exceptions. If they occur, of course, they'll be thrown and you can (if you like) catch them. But the compiler doesn't insist that you do so. -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM