Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 57   Methods: 2
NCLOC: 39   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CheckNonSerializableInterceptor.java 50% 81.8% 100% 76.5%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7   
 8    package org.jboss.cache.pojo.interceptors;
 9   
 10    import org.jboss.aop.joinpoint.Invocation;
 11    import org.jboss.aop.joinpoint.MethodInvocation;
 12    import org.jboss.cache.Fqn;
 13    import org.jboss.cache.pojo.util.AopUtil;
 14   
 15    /**
 16    * Interceptor (done via aop advice) to check the validity of the id specified by the user.
 17    *
 18    * @version $Id: CheckNonSerializableInterceptor.java,v 1.2 2007/05/23 10:28:56 msurtani Exp $
 19    */
 20    public class CheckNonSerializableInterceptor extends AbstractInterceptor
 21    {
 22    private boolean marshallNonSerializable_ = false;
 23   
 24  7640 public Object invoke(Invocation in) throws Throwable
 25    {
 26  7640 if (!(in instanceof MethodInvocation))
 27    {
 28  0 throw new IllegalArgumentException("CheckIdInterceptor.invoke(): invocation not MethodInvocation");
 29    }
 30   
 31  7640 MethodInvocation invocation = (MethodInvocation) in;
 32  7640 Fqn id = (Fqn) invocation.getArguments()[0];
 33  7640 Object obj = invocation.getArguments()[1];
 34  7640 if (!marshallNonSerializable_)
 35    {
 36  7640 AopUtil.checkObjectType(obj);
 37    }
 38    else
 39    {
 40  0 log.debug("invoke(): marshallNonSerializable is set to true. We will skip object type checking for id:"
 41    + id.toString());
 42    }
 43   
 44  7640 try
 45    {
 46  7640 return invocation.invokeNext(); // proceed to next advice or actual call
 47    }
 48    finally
 49    {
 50    }
 51    }
 52   
 53  429 public void setMarshallNonSerializable(boolean isTrue)
 54    {
 55  429 marshallNonSerializable_ = isTrue;
 56    }
 57    }