--- On Wed, 1/13/10, Adam Heath <doo...@brainfood.com> wrote: > From: Adam Heath <doo...@brainfood.com> > Subject: Re: svn commit: r899053 - > /ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ContextUtil.java > To: dev@ofbiz.apache.org > Cc: comm...@ofbiz.apache.org > Date: Wednesday, January 13, 2010, 8:17 PM > adri...@apache.org > wrote: > > Author: adrianc > > Date: Thu Jan 14 03:54:23 2010 > > New Revision: 899053 > > > > URL: http://svn.apache.org/viewvc?rev=899053&view=rev > > Log: > > Better exception handling - suggested by Adam Heath. > > > > Modified: > > > ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ContextUtil.java > > > > Modified: > ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ContextUtil.java > > URL: > > http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ContextUtil.java?rev=899053&r1=899052&r2=899053&view=diff > > > ============================================================================== > > --- > ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ContextUtil.java > (original) > > +++ > ofbiz/branches/executioncontext20091231/framework/context/src/org/ofbiz/context/ContextUtil.java > Thu Jan 14 03:54:23 2010 > > @@ -20,6 +20,7 @@ > > > > import static > org.ofbiz.api.authorization.BasicPermissions.Access; > > > > +import java.security.AccessControlException; > > import java.util.List; > > > > import javolution.util.FastList; > > @@ -48,7 +49,9 @@ > > try { > > > accessController.checkPermission(Access, > artifactPath); > > > resultList.add(webAppInfo); > > - } catch > (Exception e) {} > > + } catch > (AccessControlException e) { > > + > // This exception is expected - do nothing > > + } > > > artifactPath.restoreState(); > > And what about the OutOfMemoryException that could be > thrown by > resultList.add()? > > Anytime you have a push/pop kind of pattern, you must use > push before > a try, and pop inside the finally. > > foo.push(); > try { > code(); > } finally { > foo.pop(); > }
I really appreciate you taking the time to review my code. In this case, I think you're making much ado about nothing. The object you are concerned about is on the stack, so if any exception is thrown it will be discarded.