Article View: borland.public.jbuilder.java.language
Article #17try{}catch{}finally{} bloks
From: Vladimir Olenin
Date: Sat, 03 Oct 1998 00:00
Date: Sat, 03 Oct 1998 00:00
84 lines
3358 bytes
3358 bytes
This is a multi-part message in MIME format.
--------------BAB29CC8B6DD4F77907A5FCE
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit
Well, the problem is that in the following fragment of program statement
after catch and finally blocks is unreachable. When i just quote finally
block out, evrth compiles fine. Just that human curiosity... It seems
like finally block executes anyway no matter was there an exception or
not. As i know it should be executed only if an exception occurred. So,
am i right or wrong?
public void run(){
String inMessage[] = new String[2];
try{
while(true){
try{
inMessage = (String[])in.readObject();
}
catch(IOException eIO){
inMessage[0] = "Server";
inMessage[1] = "I/O error occured while message receiving. U
are to be disconnected";
// processConnectionEvent(
// new ConnectionEvent(this, inMessage,
ConnectionEvent.EXCEPTION));
// throw new Exception();
}
catch(ClassNotFoundException eCNF){
inMessage[0] = "Server";
inMessage[1] = "Serialization error occured while message
receiving. U are to be disconnected";
// processConnectionEvent(
// new ConnectionEvent(this, inMessage,
ConnectionEvent.EXCEPTION));
// throw new Exception();
}
catch(NullPointerException NPe){
inMessage[0] = "Server";
inMessage[1] = "Null object has been received. U are to be
disconnected";
// processConnectionEvent(
// new ConnectionEvent(this, inMessage,
ConnectionEvent.EXCEPTION));
// throw new Exception();
}
finally{
processConnectionEvent(
new ConnectionEvent(this, inMessage,
ConnectionEvent.EXCEPTION));
throw new Exception();
}
processConnectionEvent(
new ConnectionEvent(this, inMessage,
parseMessage(inMessage)));
}
}
catch(Exception e){
closeConnection();
this.stop();
}
}
--------------BAB29CC8B6DD4F77907A5FCE
Content-Type: text/x-vcard; charset=koi8-r;
name="keenonjava.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Vladimir Olenin
Content-Disposition: attachment;
filename="keenonjava.vcf"
begin:vcard
n:Vladimir;Olenin
x-mozilla-html:FALSE
adr:version:2.1
version:2.1
email;internet:keenonjava@collegemail.com
note:Java programmer. Open for project development offers. See my home page at: http://www.geocities.com/SiliconValley/Heights/9815/
end:vcard
--------------BAB29CC8B6DD4F77907A5FCE--
Technical Details
Message-ID:
<361559E1.9DB2FC20@collegemail.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ff01d,2e77fed1ab62b91a,start
X-Google-Attributes: gidff01d,public
X-Google-Thread: f74b3,2e77fed1ab62b91a,start
X-Google-Attributes: gidf74b3,public
From: Vladimir Olenin <keenonjava@collegemail.com>
Subject: try{}catch{}finally{} bloks
Date: 1998/10/03
Message-ID: <361559E1.9DB2FC20@collegemail.com>
X-Deja-AN: 397180000
X-Accept-Language: en,ru
Content-Type: multipart/mixed; boundary="------------BAB29CC8B6DD4F77907A5FCE"
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language,borland.public.jbuilder.applet-issues