<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Greetings:<div><br></div><div>Not too often do I get personally involved in Java/J2EE disputes among those who are virtually experts at this game. However, exceptions is one of my pet peeves. NOT catching an exception shows a bit of disregard for the integrity of the product itself and, IMHO, everything should be in a try / catch block such that the exception is NOT caught only in trivial circumstances. (And if it's so trivial that it doesn't need a try/catch block, is it necessary at all?)</div><div><br></div><div>As an old C programmer (yes, there are still a few of us around) if we thought that we were really, really good programmers we would run "lint" on our program before sending it to QA. And QA always ran "lint" just for the fun of showing up our poor programming. It was usually an humbling experience. Catching all of the exceptions during testing should be required. Catching all of the exceptions during run time is debatable. I would think that NOT catching exceptions is what makes for run time problems that could have been caught during compile/design time.</div><div><br></div><div>The final question is WHAT to do with a caught exception? This is where experience shows up and with some you can just toss an error statement in a log somewhere with a warning. Others require an error routine and stopping the program. Then that becomes a matter of judgement. Catch and release? Nahhh... I only fish to eat, not for sport. :-)</div><div><br></div><div>Just two cents.</div><div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 18px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div>SDG</div><div>James Owen</div><div>Senior Consultant / Architect</div><div>817.656.4553 office</div><div>214.684.5272 cell</div><div><font class="Apple-style-span" face="'Bodoni SvtyTwo SC ITC TT'"><font class="Apple-style-span" color="#FF0000">Founder KnowledgeBased Systems Corporation</font></font></div><div><font class="Apple-style-span" face="'Bodoni SvtyTwo SC ITC TT'"><font class="Apple-style-span" color="#FF0000"><a href="http://www.kbsc.com">http://www.kbsc.com</a></font></font></div><div><font class="Apple-style-span" face="'Bodoni SvtyTwo SC ITC TT'"><font class="Apple-style-span" color="#FF0000">Founder October Rules Fest</font></font></div><div><font class="Apple-style-span" face="'Bodoni SvtyTwo SC ITC TT'"><font class="Apple-style-span" color="#FF0000"><a href="http://www.OctoberRulesFest.org">http://www.OctoberRulesFest.org</a></font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF">Blogs:</font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF"><a href="http://JavaRules.blogspot.com">http://JavaRules.blogspot.com</a> [Java-Oriented Rulebased Systems]</font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF"><a href="http://ORF2009.blogspot.com">http://ORF2009.blogspot.com</a> [October Rules Fest]</font></font></div><div><font class="Apple-style-span" face="Garamond"><font class="Apple-style-span" color="#0000FF"><a href="http://exscg.blogspot.com/">http://exscg.blogspot.com/</a> [Expert Systems Consulting Group]</font></font></div><div><font class="Apple-style-span" face="'Blackmoor LET'"><b><font class="Apple-style-span" color="#996633">"This above all: to thine own self be true,</font></b></font></div><div><div><font class="Apple-style-span" face="'Blackmoor LET'"><b><font class="Apple-style-span" color="#996633">And it must follow, as the night the day,</font></b></font></div><div><font class="Apple-style-span" face="'Blackmoor LET'"><b><font class="Apple-style-span" color="#996633">Thou canst not then be false to any man."</font></b></font></div><div><font class="Apple-style-span" face="'Blackmoor LET'"><b><font class="Apple-style-span" color="#996633">Hamlet, Act 1, Scene III</font></b></font></div><div><font class="Apple-style-span" face="'Blackmoor LET'"><b><font class="Apple-style-span" color="#996633"><a href="http://www-tech.mit.edu/Shakespeare/hamlet/hamlet.1.3.html">http://www-tech.mit.edu/Shakespeare/hamlet/hamlet.1.3.html</a></font></b></font></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></span></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br><div><div>On Dec 12, 2008, at 10:30 AM, Greg Barton wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I vote for runtime exception. That gives you the option of catching it or not. Just from experience I can't tell you how nice it was when HibernateException went from a checked to an unchecked exception.<br><br>That being said, the API methods that can throw it should still declare it in the throws clause, even if it's a runtime exception. That helps IDEs like Eclipse wrap method calls in the right try/catch blocks when generating code. (See the "Source->Surround With->try/catch block" menu option)<br><br>--- On Fri, 12/12/08, Zoltan Farkas <<a href="mailto:zoly@daxtechnologies.com">zoly@daxtechnologies.com</a>> wrote:<br><br><blockquote type="cite">From: Zoltan Farkas <<a href="mailto:zoly@daxtechnologies.com">zoly@daxtechnologies.com</a>><br></blockquote><blockquote type="cite">Subject: RE: [rules-dev] Drools API improvement sugestion<br></blockquote><blockquote type="cite">To: "Rules Dev List" <<a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a>><br></blockquote><blockquote type="cite">Date: Friday, December 12, 2008, 10:10 AM<br></blockquote><blockquote type="cite"><blockquote type="cite">From my point of view as a developer who writes code<br></blockquote></blockquote><blockquote type="cite">against the api, <br></blockquote><blockquote type="cite">I have to handle to case of a Resource not being there, or<br></blockquote><blockquote type="cite">being<br></blockquote><blockquote type="cite">invalid/corupt... theese are casses that I need to recover<br></blockquote><blockquote type="cite">from in my<br></blockquote><blockquote type="cite">code...<br></blockquote><blockquote type="cite">and I have no way of knowing what do I need to catch and<br></blockquote><blockquote type="cite">where, without<br></blockquote><blockquote type="cite">first writing the code, run tests against it, and examine<br></blockquote><blockquote type="cite">stack traces.<br></blockquote><blockquote type="cite">I find this quite inefficient...<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">If you google for ResourceNotFoundException, you will find<br></blockquote><blockquote type="cite">out that<br></blockquote><blockquote type="cite">there is quite a few APIs out there that implement it.<br></blockquote><blockquote type="cite">There is other<br></blockquote><blockquote type="cite">apis that have InvalidResourceException... or<br></blockquote><blockquote type="cite">javx.resource.ResourceException<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">My preference would be toward catched Exceptions in this<br></blockquote><blockquote type="cite">case.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--zoly<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">________________________________<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">From: <a href="mailto:rules-dev-bounces@lists.jboss.org">rules-dev-bounces@lists.jboss.org</a><br></blockquote><blockquote type="cite">[<a href="mailto:rules-dev-bounces@lists.jboss.org">mailto:rules-dev-bounces@lists.jboss.org</a>] On Behalf Of<br></blockquote><blockquote type="cite">Mark Proctor<br></blockquote><blockquote type="cite">Sent: Thursday, December 11, 2008 8:04 PM<br></blockquote><blockquote type="cite">To: Rules Dev List<br></blockquote><blockquote type="cite">Subject: Re: [rules-dev] Drools API improvement sugestion<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Zoltan Farkas wrote: <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>Based on current implementation, the following methods I<br></blockquote><blockquote type="cite">think<br></blockquote><blockquote type="cite">should throw a exception, something like: <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>ResourceNotFoundException<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">do you want this as runtime or catched exception? At the<br></blockquote><blockquote type="cite">moment we are<br></blockquote><blockquote type="cite">trying to avoid catched exceptions.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Mark<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span> <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>org.drools.compiler.PackageBuilder.addKnowledgeResource()<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>org.drools.builder.impl.KnowledgeBuilderImpl.add()<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>another option might be to verify the validity of a<br></blockquote><blockquote type="cite">Resource<br></blockquote><blockquote type="cite">object at creation time and make ResourceFactory factory<br></blockquote><blockquote type="cite">methods throw<br></blockquote><blockquote type="cite">ResourceNotFoundException.<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span> <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>I believe the case of a "not found resource" the<br></blockquote><blockquote type="cite">user of the api<br></blockquote><blockquote type="cite">should be "ecouraged" to handle.<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span> <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>Another case that might be needed to be handled could be<br></blockquote><blockquote type="cite">InvalidResource?<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span> <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>Let me know what you guys think<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span> <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>Regards<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span> <br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>--zoly<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><br></blockquote><blockquote type="cite">________________________________<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>_______________________________________________<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span>rules-dev mailing list<br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span><a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br></blockquote><blockquote type="cite"><span class="Apple-tab-span" style="white-space:pre">        </span> <br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">rules-dev mailing list<br></blockquote><blockquote type="cite"><a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br></blockquote><blockquote type="cite"><a href="https://lists.jboss.org/mailman/listinfo/rules-dev">https://lists.jboss.org/mailman/listinfo/rules-dev</a><br></blockquote><br><br><br>_______________________________________________<br>rules-dev mailing list<br><a href="mailto:rules-dev@lists.jboss.org">rules-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/rules-dev<br></div></blockquote></div><br></div></body></html>