Thread View: borland.public.jbuilder.java.language
2 messages
2 total messages
Started by Raul Lorenzo
Wed, 10 May 2006 10:26
Exception Question
Author: Raul Lorenzo
Date: Wed, 10 May 2006 10:26
Date: Wed, 10 May 2006 10:26
42 lines
1541 bytes
1541 bytes
Hello,
I have for example the code i attached,
I think that if A.DeleteItem causes an exception, it should be caught in
Doit_subexample, isn�t it? In Init() there isn�t any try, catch.
I have a code similar to this I attached, an the exception isn�t
catched. Why?
class sub_example
{
private void Execute() throws Exception
{
//This method could throw an exception.....
A.DeleteItem(item);
}
public void Init() throws Exception
{
...
Execute();
....
...
}
}
class main_example
{
public void Doit_subexample
{
try
{
sub_example.Init();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Thanks
Re: Exception Question
Author: Kevin Dean [TeamB]
Date: Wed, 10 May 2006 20:40
Date: Wed, 10 May 2006 20:40
26 lines
2114 bytes
2114 bytes
Raul Lorenzo wrote: >I have for example the code i attached, >I think that if A.DeleteItem causes an exception, it should be caught in >Doit_subexample, isn�t it? In Init() there isn�t any try, catch. >I have a code similar to this I attached, an the exception isn�t >catched. Why? Your assumption about your code is correct. However, it is possible to bypass this if the error being thrown descends from java.lang.Error rather than java.lang.Exception; both of them have as their base class java.lang.Throwable. A java.lang.Error, however, indicates a serious error, one that your application is not expected to recover from. -- Kevin Dean [TeamB] Dolphin Data Development Ltd. http://www.datadevelopment.com/ NEW WHITEPAPERS Team Development with JBuilder and Borland Enterprise Server Securing Borland Enterprise Server http://www.datadevelopment.com/papers/index.html Please see Borland's newsgroup guidelines at http://info.borland.com/newsgroups/guide.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads