Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8437
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Jan Burse <janburse@fastmail.fm> |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: Avoid creating a stacktrace prior to JDK 1.7 |
| Date | Sat, 01 Oct 2011 13:22:46 +0200 |
| Organization | albasani.net |
| Lines | 49 |
| Message-ID | <j66t6a$9ta$1@news.albasani.net> (permalink) |
| References | <j64ht6$o64$1@news.albasani.net> <j66puk$h0j$1@dont-email.me> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-15; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.albasani.net Hagnx9hnA9nuGc2s6oluFHtJKeMxIPRLP/DOYadx41m2bqw58J+8ljUXFUeEUosERA0OmQriXItzAQKMVClXlQ== |
| NNTP-Posting-Date | Sat, 1 Oct 2011 11:22:50 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="LaLM2S0/CKREsXqGJPZ70tlisDlr8J6c08568slmjp8qINDqGRWzrCK5hOlVdbQR4BGXpF6+Ft7pTj+VvEPY6jx5IzqePuYFwrOtzS37xCgD4x9803MMurvQMZMV+z3t"; mail-complaints-to="abuse@albasani.net" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0.2) Gecko/20110902 Firefox/6.0.2 SeaMonkey/2.3.3 |
| In-Reply-To | <j66puk$h0j$1@dont-email.me> |
| Cancel-Lock | sha1:E0Vtb9XIiiIscgTQh8Mt/run8mU= |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:8437 |
Show key headers only | View raw
Stanimir Stamenkov schrieb:
> Fri, 30 Sep 2011 15:57:57 +0200, /Jan Burse/:
>
>> I have the following code deep down in a
>> recursion which eats up a lot of stack.
>> The recursion is not shown but only
>> the code:
>>
>> Class<?> class;
>> try {
>> class = Class.forName(str);
>> } catch (ClassNotFoundException x) {
>> class = null;
>> }
>>
>> Will it every time I call it for a
>> non-existing class build the whole stack
>> trace for the exception x and then
>> immediately forget about it?
>
> I guess so.
>
>> [...]
>> Can I instruct an exception
>> to not fill the stack trace? And way
>> arround?
>
> You may perform a check which avoids the exceptional situation like:
>
> Class<?> class;
> try {
> class = (Class.getResource(str + ".class") != null)
> ? Class.forName(str)
> : null;
> } catch (ClassNotFoundException x) {
> class = null;
> }
>
> The Class.forName(String) could still fail if the access to the resource
> content is restricted, I imagine.
>
Yes, this would change the role of exceptions,
not use it for business logic, only for
exceptional flow.
gr8, thx
Bye
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-09-30 15:57 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Stanimir Stamenkov <s7an10@netscape.net> - 2011-10-01 13:27 +0300
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-01 13:22 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Lew <lewbloch@gmail.com> - 2011-10-01 09:10 -0700
Re: Avoid creating a stacktrace prior to JDK 1.7 Stanimir Stamenkov <s7an10@netscape.net> - 2011-10-01 20:31 +0300
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-01 20:02 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Lew <lewbloch@gmail.com> - 2011-10-01 12:21 -0700
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-01 22:04 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-01 16:24 -0400
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-01 23:14 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-01 17:28 -0400
Re: Avoid creating a stacktrace prior to JDK 1.7 Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-01 23:45 +0000
Re: Avoid creating a stacktrace prior to JDK 1.7 Stanimir Stamenkov <s7an10@netscape.net> - 2011-10-02 00:58 +0300
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-02 02:04 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Lew <lewbloch@gmail.com> - 2011-10-01 20:06 -0700
Re: Avoid creating a stacktrace prior to JDK 1.7 Stanimir Stamenkov <s7an10@netscape.net> - 2011-10-02 13:14 +0300
Re: Avoid creating a stacktrace prior to JDK 1.7 Lew <lewbloch@gmail.com> - 2011-10-02 08:37 -0700
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-02 20:26 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-02 17:51 -0400
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-03 01:32 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Stanimir Stamenkov <s7an10@netscape.net> - 2011-10-01 20:19 +0300
Re: Avoid creating a stacktrace prior to JDK 1.7 Jan Burse <janburse@fastmail.fm> - 2011-10-01 20:04 +0200
Re: Avoid creating a stacktrace prior to JDK 1.7 Stanimir Stamenkov <s7an10@netscape.net> - 2011-10-01 21:15 +0300
csiph-web