Examples of InvalidAdviceException


Examples of org.jboss.aop.advice.InvalidAdviceException

      this.hierarchy = new VariableHierarchy();
      this.applyRules(properties);
     
      if (returnType == ReturnType.VOID && method.getReturnType()!= void.class)
      {
         throw new InvalidAdviceException("The " + adviceType +
               " advice method '" + method + "' return type must be void");
      }
     
      for (int i = 0; i < mutuallyExclusive.length; i++)
      {
         int[] exclusiveParamTypes = mutuallyExclusive[i];
         int found = -1;
         for (int j = 0; j < exclusiveParamTypes.length; j++)
         {
            if (contextParamTypes[exclusiveParamTypes[j]].isSet())
            {
               if (found != -1)
               {
                  throw new InvalidAdviceException(
                        "Mutually exclusive parameter annotations '"
                        + contextParamTypes[exclusiveParamTypes[found]].rule
                        + "' and '" + contextParamTypes[exclusiveParamTypes[j]].rule
                        + "' found on " + adviceType + " advice method '" + method +
                        "'");
               }
               found = j;
            }
         }
      }
     
      if (compulsory != null)
      {
        for (int i = 0; i < compulsory.length; i++)
        {
           ParameterAnnotationType precondition = paramTypes[compulsory[i][0]];
           if (precondition.isSet())
           {
              for (int j = 1; j < compulsory[i].length; j++)
              {
                 if (!paramTypes[compulsory[i][j]].isSet())
                 {
                    throw new InvalidAdviceException(
                          "Compulsory " + paramTypes[compulsory[i][j]].rule
                          + "-annotated parameter not found on " + adviceType +
                          " advice method '" + method +
                          "' (this parameter is compulsory in the presence of a " +
                          precondition.rule + "-annotated parameter)");
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

            {
               typeFound = findAnnotationType(annotation, i);
            }
            else if (findAnnotationType(annotation, i) != null)
            {
               throw new InvalidAdviceException("Parameter " + i  + " of " +
                     adviceType + " advice method '" + method +
                     "' contains more than one valid annotation");
            }
         }
         if (typeFound == null)
         {
            if (paramAnnotations[i].length == 0)
            {
               throw new InvalidAdviceException("Parameter " + i  + " of " +
                     adviceType + " advice method '" + method +
                     "' is not annotated\nFor interception of joinpoint " +
                     properties.getJoinPoint() + " expecting one of annotations: " +
                     getDescription(paramTypes) + getDescription(contextParamTypes));
            }
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

     
      public final void setIndex(int parameterIndex, Annotation annotation)
      {
         if (this.index != -1)
         {
            throw new InvalidAdviceException(
                  "Found more than one occurence of '"
                  + rule + "' on parameters of " + adviceType + " advice method '" +
                  method + "'");
         }
         this.index = parameterIndex;
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

            if (indexes[i][1] != -1)
            {
               // negative index
               if (indexes[i][1] < 0)
               {
                  throw new InvalidAdviceException(
                        "Negative joinpoint parameter index found at method '" +
                        method + "'");
               }
               // wrong index
               if (indexes[i][1] >= expectedTypes.length)
               {
                  AdviceMethodFactory.appendNewMatchingMessage(method,
                        "there is no joinpoint argument with index ");
                  AdviceMethodFactory.appendMatchingMessage(indexes[i][1]);
                  AdviceMethodFactory.appendMatchingMessage(", since there are ");
                  AdviceMethodFactory.appendMatchingMessage(expectedTypes.length == 0? "no": expectedTypes.length);
                  AdviceMethodFactory.appendMatchingMessage(" joinpoint arguments available");
                  return false;
               }
               // wrong type
               if (!AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(
                     adviceTypes[indexes[i][0]], expectedTypes[indexes[i][1]],
                     hierarchy))
               {
                  AdviceMethodFactory.appendNewMatchingMessage(method, "advice parameter ");
                  AdviceMethodFactory.appendMatchingMessage(indexes[i][0]);
                  AdviceMethodFactory.appendMatchingMessage(", of type '");
                  AdviceMethodFactory.appendMatchingMessage(adviceTypes[indexes[i][0]]);
                  AdviceMethodFactory.appendMatchingMessage("', cannot be assigned to the value of joinpoint argument with index ");
                  AdviceMethodFactory.appendMatchingMessage(indexes[i][1] + ", whose type is '");
                  AdviceMethodFactory.appendMatchingMessage(expectedTypes[indexes[i][1]]);
                  AdviceMethodFactory.appendMatchingMessage("'");
                  return false;
               }
               // index set more than once
               if (taken[indexes[i][1]])
               {
                  throw new InvalidAdviceException(
                        "Joinpoint parameter index '" + indexes[i][0] +
                        "' cannot be assigned to more than one " +  rule +
                        "-annotated advice parameter (on " + adviceType +
                        " advice method '" + method + "')");
               }
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

            if (indexes[i][1] != -1)
            {
               // negative index
               if (indexes[i][1] < 0)
               {
                  throw new InvalidAdviceException(
                        "Negative joinpoint parameter index found at method '" +
                        method + "'");
               }
               // wrong index
               if (indexes[i][1] >= expectedTypes.length)
               {
                  AdviceMethodFactory.appendNewMatchingMessage(method,
                        "there is no joinpoint argument with index ");
                  AdviceMethodFactory.appendMatchingMessage(indexes[i][1]);
                  AdviceMethodFactory.appendMatchingMessage(", since there are ");
                  AdviceMethodFactory.appendMatchingMessage(expectedTypes.length == 0? "no": expectedTypes.length);
                  AdviceMethodFactory.appendMatchingMessage(" joinpoint arguments available");
                  return false;
               }
               // wrong type
               if (!AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(
                     adviceTypes[indexes[i][0]], expectedTypes[indexes[i][1]],
                     hierarchy))
               {
                  AdviceMethodFactory.appendNewMatchingMessage(method, "advice parameter ");
                  AdviceMethodFactory.appendMatchingMessage(indexes[i][0]);
                  AdviceMethodFactory.appendMatchingMessage(", of type '");
                  AdviceMethodFactory.appendMatchingMessage(adviceTypes[indexes[i][0]]);
                  AdviceMethodFactory.appendMatchingMessage("', cannot be assigned to the value of joinpoint argument with index ");
                  AdviceMethodFactory.appendMatchingMessage(indexes[i][1] + ", whose type is '");
                  AdviceMethodFactory.appendMatchingMessage(expectedTypes[indexes[i][1]]);
                  AdviceMethodFactory.appendMatchingMessage("'");
                  return false;
               }
               // index set more than once
               if (taken[indexes[i][1]])
               {
                  throw new InvalidAdviceException(
                        "Joinpoint parameter index '" + indexes[i][0] +
                        "' cannot be assigned to more than one " +  rule +
                        "-annotated advice parameter (on " + adviceType +
                        " advice method '" + method + "')");
               }
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

      this.hierarchy = new VariableHierarchy();
      this.applyRules(properties);
     
      if (returnType == ReturnType.VOID && method.getReturnType()!= void.class)
      {
         throw new InvalidAdviceException("The " + adviceType +
               " advice method '" + method + "' return type must be void");
      }
     
      for (int i = 0; i < mutuallyExclusive.length; i++)
      {
         int[] exclusiveParamTypes = mutuallyExclusive[i];
         int found = -1;
         for (int j = 0; j < exclusiveParamTypes.length; j++)
         {
            if (contextParamTypes[exclusiveParamTypes[j]].isSet())
            {
               if (found != -1)
               {
                  throw new InvalidAdviceException(
                        "Mutually exclusive parameter annotations '"
                        + contextParamTypes[exclusiveParamTypes[found]].rule
                        + "' and '" + contextParamTypes[exclusiveParamTypes[j]].rule
                        + "' found on " + adviceType + " advice method '" + method +
                        "'");
               }
               found = j;
            }
         }
      }
     
      if (compulsory != null)
      {
        for (int i = 0; i < compulsory.length; i++)
        {
           ParameterAnnotationType precondition = paramTypes[compulsory[i][0]];
           if (precondition.isSet())
           {
              for (int j = 1; j < compulsory[i].length; j++)
              {
                 if (!paramTypes[compulsory[i][j]].isSet())
                 {
                    throw new InvalidAdviceException(
                          "Compulsory " + paramTypes[compulsory[i][j]].rule
                          + "-annotated parameter not found on " + adviceType +
                          " advice method '" + method +
                          "' (this parameter is compulsory in the presence of a " +
                          precondition.rule + "-annotated parameter)");
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

            {
               typeFound = findAnnotationType(annotation, i);
            }
            else if (findAnnotationType(annotation, i) != null)
            {
               throw new InvalidAdviceException("Parameter " + i  + " of " +
                     adviceType + " advice method '" + method +
                     "' contains more than one valid annotation");
            }
         }
         if (typeFound == null)
         {
            if (paramAnnotations[i].length == 0)
            {
               throw new InvalidAdviceException("Parameter " + i  + " of " +
                     adviceType + " advice method '" + method +
                     "' is not annotated\nFor interception of joinpoint " +
                     properties.getJoinPoint() + " expecting one of annotations: " +
                     getDescription(paramTypes) + getDescription(contextParamTypes));
            }
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

     
      public final void setIndex(int parameterIndex, Annotation annotation)
      {
         if (this.index != -1)
         {
            throw new InvalidAdviceException(
                  "Found more than one occurence of '"
                  + rule + "' on parameters of " + adviceType + " advice method '" +
                  method + "'");
         }
         this.index = parameterIndex;
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

/*  61 */     this.hierarchy = new VariableHierarchy();
/*  62 */     applyRules(properties);
/*     */
/*  64 */     if ((returnType == AdviceMethodFactory.ReturnType.VOID) && (method.getReturnType() != Void.TYPE))
/*     */     {
/*  66 */       throw new InvalidAdviceException("The " + adviceType + " advice method '" + method + "' return type must be void");
/*     */     }
/*     */
/*  70 */     for (int i = 0; i < mutuallyExclusive.length; i++)
/*     */     {
/*  72 */       int[] exclusiveParamTypes = mutuallyExclusive[i];
/*  73 */       int found = -1;
/*  74 */       for (int j = 0; j < exclusiveParamTypes.length; j++)
/*     */       {
/*  76 */         if (!this.contextParamTypes[exclusiveParamTypes[j]].isSet())
/*     */           continue;
/*  78 */         if (found != -1)
/*     */         {
/*  80 */           throw new InvalidAdviceException("Mutually exclusive parameter annotations '" + this.contextParamTypes[exclusiveParamTypes[found]].rule + "' and '" + this.contextParamTypes[exclusiveParamTypes[j]].rule + "' found on " + adviceType + " advice method '" + method + "'");
/*     */         }
/*     */
/*  87 */         found = j;
/*     */       }
/*     */
/*     */     }
/*     */
/*  92 */     if (compulsory != null)
/*     */     {
/*  94 */       for (int i = 0; i < compulsory.length; i++)
/*     */       {
/*  96 */         ParameterAnnotationType precondition = this.paramTypes[compulsory[i][0]];
/*  97 */         if (!precondition.isSet())
/*     */           continue;
/*  99 */         for (int j = 1; j < compulsory[i].length; j++)
/*     */         {
/* 101 */           if (this.paramTypes[compulsory[i][j]].isSet())
/*     */             continue;
/* 103 */           throw new InvalidAdviceException("Compulsory " + this.paramTypes[compulsory[i][j]].rule + "-annotated parameter not found on " + adviceType + " advice method '" + method + "' (this parameter is compulsory in the presence of a " + precondition.rule + "-annotated parameter)");
/*     */         }
/*     */       }
/*     */     }
/*     */   }
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

/*     */         {
/* 243 */           typeFound = findAnnotationType(annotation, i);
/*     */         } else {
/* 245 */           if (findAnnotationType(annotation, i) == null)
/*     */             continue;
/* 247 */           throw new InvalidAdviceException("Parameter " + i + " of " + this.adviceType + " advice method '" + this.method + "' contains more than one valid annotation");
/*     */         }
/*     */
/*     */       }
/*     */
/* 252 */       if (typeFound == null)
/*     */       {
/* 254 */         if (paramAnnotations[i].length == 0)
/*     */         {
/* 256 */           throw new InvalidAdviceException("Parameter " + i + " of " + this.adviceType + " advice method '" + this.method + "' is not annotated\nFor interception of joinpoint " + properties.getJoinPoint() + " expecting one of annotations: " + getDescription(this.paramTypes) + getDescription(this.contextParamTypes));
/*     */         }
/*     */
/* 262 */         AdviceMethodFactory.appendNewMatchingMessage(this.method, "parameter ");
/* 263 */         AdviceMethodFactory.appendMatchingMessage(Integer.valueOf(i));
/* 264 */         AdviceMethodFactory.appendMatchingMessage("' is not annotated correctly. Expecting one of: ");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.