Examples of VerificationResult


Examples of org.apache.bcel.verifier.VerificationResult

    Type t = o.getType(cpg);
    if (t instanceof ObjectType){
      String name = ((ObjectType)t).getClassName();
      Verifier v = VerifierFactory.getVerifier( name );
      VerificationResult vr = v.doPass2();
      if (vr.getStatus() != VerificationResult.VERIFIED_OK){
        constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
      }
    }

View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

   
    Type t = o.getType(cpg);
    if (t instanceof ObjectType){
      String name = ((ObjectType)t).getClassName();
      Verifier v = VerifierFactory.getVerifier( name );
      VerificationResult vr = v.doPass2();
      if (vr.getStatus() != VerificationResult.VERIFIED_OK){
        constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
      }
    }

    Type[] argtypes = o.getArgumentTypes(cpg);
View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

    Type t = o.getType(cpg);
    if (t instanceof ObjectType){
      String name = ((ObjectType)t).getClassName();
      Verifier v = VerifierFactory.getVerifier( name );
      VerificationResult vr = v.doPass2();
      if (vr.getStatus() != VerificationResult.VERIFIED_OK){
        constraintViolated((Instruction) o, "Class '"+name+"' is referenced, but cannot be loaded and resolved: '"+vr+"'.");
      }
    }

View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

        circulationPump(cfg, cfg.contextOf(mg.getInstructionList().getStart()), f, icv, ev);
      }
    }
    catch (VerifierConstraintViolatedException ce){
      ce.extendMessage("Constraint violated in method '"+methods[method_no]+"':\n","");
      return new VerificationResult(VerificationResult.VERIFIED_REJECTED, ce.getMessage());
    }
    catch (RuntimeException re){
      // These are internal errors

      StringWriter sw = new StringWriter();
View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

     */
    public void visitLoadClass(LoadClass o){
      ObjectType t = o.getLoadClassType(cpg);
      if (t != null){// null means "no class is loaded"
        Verifier v = VerifierFactory.getVerifier(t.getClassName());
        VerificationResult vr = v.doPass1();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK){
          constraintViolated((Instruction) o, "Class '"+o.getLoadClassType(cpg).getClassName()+"' is referenced, but cannot be loaded: '"+vr+"'.");
        }
      }
    }
View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

      if (t instanceof ArrayType){
        t = ((ArrayType) t).getBasicType();
      }
      if (t instanceof ObjectType){
        Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
        VerificationResult vr = v.doPass2();
        if (vr.getStatus() != VerificationResult.VERIFIED_OK){
          constraintViolated(o, "Return type class/interface could not be verified successfully: '"+vr.getMessage()+"'.");
        }
      }
     
      Type[] ts = o.getArgumentTypes(cpg);
      for (int i=0; i<ts.length; i++){
        t = ts[i];
        if (t instanceof ArrayType){
          t = ((ArrayType) t).getBasicType();
        }
        if (t instanceof ObjectType){
          Verifier v = VerifierFactory.getVerifier(((ObjectType) t).getClassName());
          VerificationResult vr = v.doPass2();
          if (vr.getStatus() != VerificationResult.VERIFIED_OK){
            constraintViolated(o, "Argument type class/interface could not be verified successfully: '"+vr.getMessage()+"'.");
          }
        }
      }
     
    }
View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

   *
   * @see org.apache.bcel.verifier.statics.Pass3aVerifier
   */
  public VerificationResult do_verify(){
      try {
    VerificationResult vr1 = myOwner.doPass1();
    if (vr1.equals(VerificationResult.VR_OK)){
     
      // For every method, we could have information about the local variables out of LocalVariableTable attributes of
      // the Code attributes.
      localVariablesInfos = new LocalVariablesInfo[Repository.lookupClass(myOwner.getClassName()).getMethods().length];

      VerificationResult vr = VerificationResult.VR_OK; // default.
      try{
        constant_pool_entries_satisfy_static_constraints();
        field_and_method_refs_are_valid();
        every_class_has_an_accessible_superclass();
        final_methods_are_not_overridden();
      }
      catch (ClassConstraintException cce){
        vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, cce.getMessage());
      }
      return vr;
    } else {
            return VerificationResult.VR_NOTYET;
        }
View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

        String supername = jc.getSuperclassName();
        if (! hs.add(supername)){  // If supername already is in the list
          throw new ClassConstraintException("Circular superclass hierarchy detected.");
        }
        Verifier v = VerifierFactory.getVerifier(supername);
        VerificationResult vr = v.doPass1();

        if (vr != VerificationResult.VR_OK){
          throw new ClassConstraintException("Could not load in ancestor class '"+supername+"'.");
        }
        jc = Repository.lookupClass(supername);
View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

      // instruction and so on.
      try{
        instructionList = new InstructionList(method.getCode().getCode());
      }
      catch(RuntimeException re){
        return new VerificationResult(VerificationResult.VERIFIED_REJECTED, "Bad bytecode in the code array of the Code attribute of method '"+method+"'.");
      }
     
      instructionList.setPositions(true);

      // Start verification.
      VerificationResult vr = VerificationResult.VR_OK; //default
      try{
        delayedPass2Checks();
      }
      catch(ClassConstraintException cce){
        vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, cce.getMessage());
        return vr;
      }
      try{
        pass3StaticInstructionChecks();
        pass3StaticInstructionOperandsChecks();
      }
      catch(StaticCodeConstraintException scce){
        vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, scce.getMessage());
      }
      catch(ClassCastException cce){
        vr = new VerificationResult(VerificationResult.VERIFIED_REJECTED, "Class Cast Exception: " + cce.getMessage());
      }
      return vr;
    }
    else{ //did not pass Pass 2.
      return VerificationResult.VR_NOTYET;
View Full Code Here

Examples of org.apache.bcel.verifier.VerificationResult

      if (act instanceof ArrayType) {
                act = ((ArrayType) act).getBasicType();
            }
      if (act instanceof ObjectType){
        Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
        VerificationResult vr = v.doPass1();
        if (vr != VerificationResult.VR_OK) {
          throw new ClassConstraintException("Method '"+tostring(obj)+"' has a return type that does not pass verification pass 1: '"+vr+"'.");
        }
      }

      for (int i=0; i<ts.length; i++){
        act = ts[i];
        if (act instanceof ArrayType) {
                    act = ((ArrayType) act).getBasicType();
                }
        if (act instanceof ObjectType){
          Verifier v = VerifierFactory.getVerifier( ((ObjectType) act).getClassName() );
          VerificationResult vr = v.doPass1();
          if (vr != VerificationResult.VR_OK) {
            throw new ClassConstraintException("Method '"+tostring(obj)+"' has an argument type that does not pass verification pass 1: '"+vr+"'.");
          }
        }
      }
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.