<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.1">
</HEAD>
<BODY>
<BR>
On Mon, 2008-03-17 at 10:29 -0400, King Dark wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<BR>
<TT><FONT COLOR="#000000">By the way, the "try catch" seems cannot catch the exception such as "divided by zero". It crushed after running such code.</FONT></TT><BR>
</BLOCKQUOTE>
<BR>
Although your aforementioned problem appears relatively legitimate, attempting to catch an exception resulting from division by zero is a terribly bad practice. Try testing to see if the input value (the <I>untrusted</I> value) is non-zero first instead. This is what reasonable programs do (kind of like testing for an object being null before calling a method on it, rather than trying to catch and handle the exception which results from calling a method on a null value).<BR>
<BR>
Cheers,<BR>
Scott S. McCoy
</BODY>
</HTML>