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(); }