Examples of InvalidAdviceException


Examples of org.jboss.aop.advice.InvalidAdviceException

/* 554 */         if (this.indexes[i][1] == -1) {
/*     */           continue;
/*     */         }
/* 557 */         if (this.indexes[i][1] < 0)
/*     */         {
/* 559 */           throw new InvalidAdviceException("Negative joinpoint parameter index found at method '" + AnnotatedParameterAdviceInfo.this.method + "'");
/*     */         }
/*     */
/* 564 */         if (this.indexes[i][1] >= expectedTypes.length)
/*     */         {
/* 566 */           AdviceMethodFactory.appendNewMatchingMessage(AnnotatedParameterAdviceInfo.this.method, "there is no joinpoint argument with index ");
/*     */
/* 568 */           AdviceMethodFactory.appendMatchingMessage(Integer.valueOf(this.indexes[i][1]));
/* 569 */           AdviceMethodFactory.appendMatchingMessage(", since there are ");
/* 570 */           AdviceMethodFactory.appendMatchingMessage(expectedTypes.length == 0 ? "no" : Integer.valueOf(expectedTypes.length));
/* 571 */           AdviceMethodFactory.appendMatchingMessage(" joinpoint arguments available");
/* 572 */           return false;
/*     */         }
/*     */
/* 575 */         if (!AssignabilityAlgorithm.VARIABLE_TARGET.isAssignable(adviceTypes[this.indexes[i][0]], expectedTypes[this.indexes[i][1]], AnnotatedParameterAdviceInfo.this.hierarchy))
/*     */         {
/* 579 */           AdviceMethodFactory.appendNewMatchingMessage(AnnotatedParameterAdviceInfo.this.method, "advice parameter ");
/* 580 */           AdviceMethodFactory.appendMatchingMessage(Integer.valueOf(this.indexes[i][0]));
/* 581 */           AdviceMethodFactory.appendMatchingMessage(", of type '");
/* 582 */           AdviceMethodFactory.appendMatchingMessage(adviceTypes[this.indexes[i][0]]);
/* 583 */           AdviceMethodFactory.appendMatchingMessage("', cannot be assigned to the value of joinpoint argument with index ");
/* 584 */           AdviceMethodFactory.appendMatchingMessage(this.indexes[i][1] + ", whose type is '");
/* 585 */           AdviceMethodFactory.appendMatchingMessage(expectedTypes[this.indexes[i][1]]);
/* 586 */           AdviceMethodFactory.appendMatchingMessage("'");
/* 587 */           return false;
/*     */         }
/*     */
/* 590 */         if (taken[this.indexes[i][1]] != 0)
/*     */         {
/* 592 */           throw new InvalidAdviceException("Joinpoint parameter index '" + this.indexes[i][0] + "' cannot be assigned to more than one " + this.rule + "-annotated advice parameter (on " + AnnotatedParameterAdviceInfo.this.adviceType + " advice method '" + AnnotatedParameterAdviceInfo.this.method + "')");
/*     */         }
/*     */
/* 599 */         taken[this.indexes[i][1]] = true;
/*     */       }
/*     */
View Full Code Here

Examples of org.jboss.aop.advice.InvalidAdviceException

/*     */
/*     */     public final void setIndex(int parameterIndex, Annotation annotation)
/*     */     {
/* 440 */       if (this.index != -1)
/*     */       {
/* 442 */         throw new InvalidAdviceException("Found more than one occurence of '" + this.rule + "' on parameters of " + AnnotatedParameterAdviceInfo.this.adviceType + " advice method '" + AnnotatedParameterAdviceInfo.this.method + "'");
/*     */       }
/*     */
/* 447 */       this.index = parameterIndex;
/* 448 */       AnnotatedParameterAdviceInfo.this.rank += this.rule.getRankGrade();
/*     */     }
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

      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
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.