Examples of AssertionViolatedException


Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

                // Sanity check
                InstructionContext lastJSR = null;
                int skip_jsr = 0;
                for (int ss=oldchain.size()-1; ss >= 0; ss--){
                    if (skip_jsr < 0){
                        throw new AssertionViolatedException("More RET than JSR in execution chain?!");
                    }
//System.err.println("+"+oldchain.get(ss));
                    if ((oldchain.get(ss)).getInstruction().getInstruction() instanceof JsrInstruction){
                        if (skip_jsr == 0){
                            lastJSR = oldchain.get(ss);
                            break;
                        }
                        else{
                            skip_jsr--;
                        }
                    }
                    if ((oldchain.get(ss)).getInstruction().getInstruction() instanceof RET){
                        skip_jsr++;
                    }
                }
                if (lastJSR == null){
                    throw new AssertionViolatedException("RET without a JSR before in ExecutionChain?! EC: '"+oldchain+"'.");
                }
                JsrInstruction jsr = (JsrInstruction) (lastJSR.getInstruction().getInstruction());
                if ( theSuccessor != (cfg.contextOf(jsr.physicalSuccessor())) ){
                    throw new AssertionViolatedException("RET '"+u.getInstruction()+"' info inconsistent: jump back to '"+theSuccessor+"' or '"+cfg.contextOf(jsr.physicalSuccessor())+"'?");
                }
               
                if (theSuccessor.execute(u.getOutFrame(oldchain), newchain, icv, ev)){
                    icq.add(theSuccessor, new ArrayList<InstructionContext> (newchain));
                }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            re.printStackTrace(pw);

            throw new AssertionViolatedException("Some RuntimeException occured while verify()ing class '"+jc.getClassName()+"', method '"+methods[method_no]+"'. Original RuntimeException's stack trace:\n---\n"+sw+"---\n");
        }
        return VerificationResult.VR_OK;
    }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

   * Ensures the general preconditions of a CPInstruction instance.
   */
  public void visitCPInstruction(CPInstruction o){
    int idx = o.getIndex();
    if ((idx < 0) || (idx >= cpg.getSize())){
      throw new AssertionViolatedException("Huh?! Constant pool index of instruction '"+o+"' illegal? Pass 3a should have checked this!");
    }
  }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

        constraintViolated(o, "The type of 'value' ('"+value+"') is not assignment compatible to the components of the array 'arrayref' refers to. ('"+((ArrayType) arrayref).getElementType()+"')");
      }
    }
      } catch (ClassNotFoundException e) {
    // FIXME: maybe not the best way to handle this
    throw new AssertionViolatedException("Missing class: " + e.toString());
      }
  }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

    if ( (! (exc.subclassOf(throwable)) ) && (! (exc.equals(throwable))) ){
      constraintViolated(o, "The 'objectref' is not of class Throwable or of a subclass of Throwable, but of '"+stack().peek()+"'.");
    }
      } catch (ClassNotFoundException e) {
    // FIXME: maybe not the best way to handle this
    throw new AssertionViolatedException("Missing class: " + e.toString());
      }
  }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

  /**
   * Ensures the specific preconditions of the said instruction.
   */
  public void visitBREAKPOINT(BREAKPOINT o){
    throw new AssertionViolatedException("In this JustIce verification pass there should not occur an illegal instruction such as BREAKPOINT.");
  }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

            }
          }
        }
      }
      if (f == null) {
                throw new AssertionViolatedException("Field '"+field_name+"' not found?!?");
            }
    }

    if (f.isProtected()){
      ObjectType classtype = o.getClassType(cpg);
      ObjectType curr = new ObjectType(mg.getClassName());

      if classtype.equals(curr) ||
            curr.subclassOf(classtype)  ){
        Type t = stack().peek();
        if (t == Type.NULL){
          return;
        }
        if (! (t instanceof ObjectType) ){
          constraintViolated(o, "The 'objectref' must refer to an object that's not an array. Found instead: '"+t+"'.");
        }
        ObjectType objreftype = (ObjectType) t;
        if (! ( objreftype.equals(curr) ||
                objreftype.subclassOf(curr) ) ){
          //TODO: One day move to Staerk-et-al's "Set of object types" instead of "wider" object types
          //      created during the verification.
          //      "Wider" object types don't allow us to check for things like that below.
          //constraintViolated(o, "The referenced field has the ACC_PROTECTED modifier, and it's a member of the current class or a superclass of the current class. However, the referenced object type '"+stack().peek()+"' is not the current class or a subclass of the current class.");
        }
      }
    }
   
    // TODO: Could go into Pass 3a.
    if (f.isStatic()){
      constraintViolated(o, "Referenced field '"+f+"' is static which it shouldn't be.");
    }

      } catch (ClassNotFoundException e) {
    // FIXME: maybe not the best way to handle this
    throw new AssertionViolatedException("Missing class: " + e.toString());
      }
  }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

  /**
   * Ensures the specific preconditions of the said instruction.
   */
  public void visitIMPDEP1(IMPDEP1 o){
    throw new AssertionViolatedException("In this JustIce verification pass there should not occur an illegal instruction such as IMPDEP1.");
  }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

  /**
   * Ensures the specific preconditions of the said instruction.
   */
  public void visitIMPDEP2(IMPDEP2 o){
    throw new AssertionViolatedException("In this JustIce verification pass there should not occur an illegal instruction such as IMPDEP2.");
  }
View Full Code Here

Examples of org.apache.bcel.verifier.exc.AssertionViolatedException

      constraintViolated(o, "The 'objref' item '"+objref+"' does not implement '"+theClass+"' as expected.");
   
   
      } catch (ClassNotFoundException e) {
    // FIXME: maybe not the best way to handle this
    throw new AssertionViolatedException("Missing class: " + e.toString());
      }
  }
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.