Program: 85331
Project: 85331
Buggy source:
/** 
 * Return the jimple equivalent of this body.
 * @param m the SootMethod that contains this body
 */
public Body jimplify(Body b,SootMethod m){
  jBody=(JimpleBody)b;
  localGenerator=new LocalGenerator(jBody);
  deferredInstructions=new ArrayList<DeferableInstruction>();
  instructionsToRetype=new HashSet<RetypeableInstruction>();
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    Debug.printDbg(IDalvikTyper.DEBUG,"String_Node_Str");
    DalvikTyper.v().clear();
  }
  Debug.printDbg("String_Node_Str",methodSignature);
  List<Local> paramLocals=new LinkedList<Local>();
  if (!isStatic) {
    int thisRegister=numRegisters - numParameterRegisters - 1;
    Local thisLocal=Jimple.v().newLocal("String_Node_Str" + thisRegister,UnknownType.v());
    jBody.getLocals().add(thisLocal);
    registerLocals[thisRegister]=thisLocal;
    JIdentityStmt idStmt=(JIdentityStmt)Jimple.v().newIdentityStmt(thisLocal,Jimple.v().newThisRef(declaringClassType));
    add(idStmt);
    paramLocals.add(thisLocal);
    if (IDalvikTyper.ENABLE_DVKTYPER) {
      Debug.printDbg(IDalvikTyper.DEBUG,"String_Node_Str",idStmt);
      DalvikTyper.v().setType(idStmt.leftBox,jBody.getMethod().getDeclaringClass().getType(),false);
    }
  }
{
    int i=0;
    int parameterRegister=numRegisters - numParameterRegisters;
    for (    Type t : parameterTypes) {
      Local gen=Jimple.v().newLocal("String_Node_Str" + parameterRegister,UnknownType.v());
      jBody.getLocals().add(gen);
      Debug.printDbg("String_Node_Str",parameterRegister);
      registerLocals[parameterRegister]=gen;
      JIdentityStmt idStmt=(JIdentityStmt)Jimple.v().newIdentityStmt(gen,Jimple.v().newParameterRef(t,i++));
      add(idStmt);
      paramLocals.add(gen);
      if (IDalvikTyper.ENABLE_DVKTYPER) {
        Debug.printDbg(IDalvikTyper.DEBUG,"String_Node_Str" + idStmt);
        DalvikTyper.v().setType(idStmt.leftBox,t,false);
      }
      if (t instanceof LongType || t instanceof DoubleType) {
        parameterRegister++;
        Local g=Jimple.v().newLocal("String_Node_Str" + parameterRegister,UnknownType.v());
        jBody.getLocals().add(g);
        registerLocals[parameterRegister]=g;
      }
      parameterRegister++;
    }
  }
  for (int i=0; i < (numRegisters - numParameterRegisters - (isStatic ? 0 : 1)); i++) {
    Debug.printDbg("String_Node_Str",i);
    registerLocals[i]=Jimple.v().newLocal("String_Node_Str" + i,UnknownType.v());
    jBody.getLocals().add(registerLocals[i]);
  }
  storeResultLocal=Jimple.v().newLocal("String_Node_Str",UnknownType.v());
  jBody.getLocals().add(storeResultLocal);
  final boolean isOdex=dexFile instanceof DexBackedDexFile ? ((DexBackedDexFile)dexFile).isOdexFile() : false;
  int prevLineNumber=-1;
  for (  DexlibAbstractInstruction instruction : instructions) {
    if (isOdex && instruction instanceof OdexInstruction)     ((OdexInstruction)instruction).deOdex(dexFile);
    if (dangling != null) {
      dangling.finalize(this,instruction);
      dangling=null;
    }
    instruction.jimplify(this);
    if (instruction.getLineNumber() > 0)     prevLineNumber=instruction.getLineNumber();
 else {
      instruction.setLineNumber(prevLineNumber);
    }
  }
  for (  DeferableInstruction instruction : deferredInstructions) {
    instruction.deferredJimplify(this);
  }
  if (tries != null)   addTraps();
  instructions=null;
  instructionAtAddress.clear();
  deferredInstructions=null;
  dangling=null;
  tries=null;
  Debug.printDbg("String_Node_Str",jBody);
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  getLocalSplitter().transform(jBody);
  getUnreachableCodeEliminator().transform(jBody);
  DeadAssignmentEliminator.v().transform(jBody);
  UnusedLocalEliminator.v().transform(jBody);
  DexReturnInliner.v().transform(jBody);
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  for (  RetypeableInstruction i : instructionsToRetype)   i.retype(jBody);
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    Debug.printDbg("String_Node_Str");
    DalvikTyper.v().assignType(jBody);
    Debug.printDbg("String_Node_Str");
    jBody.validateUses();
    jBody.validateValueBoxes();
    Validate.validateArrays(jBody);
    Debug.printDbg("String_Node_Str");
  }
 else {
    DexNumTransformer.v().transform(jBody);
    DexReturnValuePropagator.v().transform(jBody);
    getCopyPopagator().transform(jBody);
    DexNullThrowTransformer.v().transform(jBody);
    DexNullTransformer.v().transform(jBody);
    DexIfTransformer.v().transform(jBody);
    DeadAssignmentEliminator.v().transform(jBody);
    UnusedLocalEliminator.v().transform(jBody);
    DexNullArrayRefTransformer.v().transform(jBody);
    Debug.printDbg("String_Node_Str");
  }
  Debug.printDbg("String_Node_Str",(Body)jBody);
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    for (    Local l : jBody.getLocals()) {
      l.setType(UnknownType.v());
    }
  }
  TypeAssigner.v().transform(jBody);
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    for (    Unit u : jBody.getUnits()) {
      if (u instanceof IfStmt) {
        ConditionExpr expr=(ConditionExpr)((IfStmt)u).getCondition();
        if (((expr instanceof EqExpr) || (expr instanceof NeExpr))) {
          Value op1=expr.getOp1();
          Value op2=expr.getOp2();
          if (op1 instanceof Constant && op2 instanceof Local) {
            Local l=(Local)op2;
            Type ltype=l.getType();
            if (ltype instanceof PrimType)             continue;
            if (!(op1 instanceof IntConstant))             continue;
            IntConstant icst=(IntConstant)op1;
            int val=icst.value;
            if (val != 0)             continue;
            expr.setOp1(NullConstant.v());
          }
 else           if (op1 instanceof Local && op2 instanceof Constant) {
            Local l=(Local)op1;
            Type ltype=l.getType();
            if (ltype instanceof PrimType)             continue;
            if (!(op2 instanceof IntConstant))             continue;
            IntConstant icst=(IntConstant)op2;
            int val=icst.value;
            if (val != 0)             continue;
            expr.setOp2(NullConstant.v());
          }
 else           if (op1 instanceof Local && op2 instanceof Local) {
          }
 else {
            throw new RuntimeException("String_Node_Str" + u);
          }
        }
      }
    }
    List<ValueBox> uses=jBody.getUseBoxes();
    List<ValueBox> toNullConstantify=new ArrayList<ValueBox>();
    List<Local> toRemove=new ArrayList<Local>();
    for (    Local l : jBody.getLocals()) {
      if (l.getType() instanceof NullType) {
        toRemove.add(l);
        for (        ValueBox vb : uses) {
          Value v=vb.getValue();
          if (v == l)           toNullConstantify.add(vb);
        }
      }
    }
    for (    ValueBox vb : toNullConstantify) {
      System.out.println("String_Node_Str" + vb + "String_Node_Str");
      vb.setValue(NullConstant.v());
    }
    for (    Local l : toRemove) {
      System.out.println("String_Node_Str" + l);
      l.setType(RefType.v("String_Node_Str"));
    }
  }
  LocalPacker.v().transform(jBody);
  UnusedLocalEliminator.v().transform(jBody);
  LocalNameStandardizer.v().transform(jBody);
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  TrapTightener.v().transform(jBody);
  TrapMinimizer.v().transform(jBody);
  Aggregator.v().transform(jBody);
  ConditionalBranchFolder.v().transform(jBody);
  UnreachableCodeEliminator.v().transform(jBody);
  DeadAssignmentEliminator.v().transform(jBody);
  UnusedLocalEliminator.v().transform(jBody);
  NopEliminator.v().transform(jBody);
  if (m.toString().equals("String_Node_Str"))   System.out.println("String_Node_Str");
  for (  Unit u : jBody.getUnits()) {
    if (u instanceof AssignStmt) {
      AssignStmt ass=(AssignStmt)u;
      if (ass.getRightOp() instanceof CastExpr) {
        CastExpr c=(CastExpr)ass.getRightOp();
        if (c.getType() instanceof NullType) {
          Debug.printDbg("String_Node_Str",u);
          ass.setRightOp(NullConstant.v());
        }
      }
    }
    if (u instanceof DefinitionStmt) {
      DefinitionStmt def=(DefinitionStmt)u;
      if (def.getLeftOp() instanceof Local && def.getRightOp() instanceof CaughtExceptionRef) {
        Type t=def.getLeftOp().getType();
        if (t instanceof RefType) {
          RefType rt=(RefType)t;
          if (rt.getSootClass().isPhantom() && !rt.getSootClass().hasSuperclass() && !rt.getSootClass().getName().equals("String_Node_Str"))           rt.getSootClass().setSuperclass(Scene.v().getSootClass("String_Node_Str"));
        }
      }
    }
  }
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  for (  Local l : jBody.getLocals()) {
    Type t=l.getType();
    if (t instanceof NullType) {
      Debug.printDbg("String_Node_Str",l);
      l.setType(RefType.v("String_Node_Str"));
    }
  }
  return jBody;
}

Fixed version (ground truth):
/** 
 * Return the jimple equivalent of this body.
 * @param m the SootMethod that contains this body
 */
public Body jimplify(Body b,SootMethod m){
  jBody=(JimpleBody)b;
  localGenerator=new LocalGenerator(jBody);
  deferredInstructions=new ArrayList<DeferableInstruction>();
  instructionsToRetype=new HashSet<RetypeableInstruction>();
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    Debug.printDbg(IDalvikTyper.DEBUG,"String_Node_Str");
    DalvikTyper.v().clear();
  }
  Debug.printDbg("String_Node_Str",methodSignature);
  List<Local> paramLocals=new LinkedList<Local>();
  if (!isStatic) {
    int thisRegister=numRegisters - numParameterRegisters - 1;
    Local thisLocal=Jimple.v().newLocal("String_Node_Str" + thisRegister,UnknownType.v());
    jBody.getLocals().add(thisLocal);
    registerLocals[thisRegister]=thisLocal;
    JIdentityStmt idStmt=(JIdentityStmt)Jimple.v().newIdentityStmt(thisLocal,Jimple.v().newThisRef(declaringClassType));
    add(idStmt);
    paramLocals.add(thisLocal);
    if (IDalvikTyper.ENABLE_DVKTYPER) {
      Debug.printDbg(IDalvikTyper.DEBUG,"String_Node_Str",idStmt);
      DalvikTyper.v().setType(idStmt.leftBox,jBody.getMethod().getDeclaringClass().getType(),false);
    }
  }
{
    int i=0;
    int parameterRegister=numRegisters - numParameterRegisters;
    for (    Type t : parameterTypes) {
      Local gen=Jimple.v().newLocal("String_Node_Str" + parameterRegister,UnknownType.v());
      jBody.getLocals().add(gen);
      Debug.printDbg("String_Node_Str",parameterRegister);
      registerLocals[parameterRegister]=gen;
      JIdentityStmt idStmt=(JIdentityStmt)Jimple.v().newIdentityStmt(gen,Jimple.v().newParameterRef(t,i++));
      add(idStmt);
      paramLocals.add(gen);
      if (IDalvikTyper.ENABLE_DVKTYPER) {
        Debug.printDbg(IDalvikTyper.DEBUG,"String_Node_Str" + idStmt);
        DalvikTyper.v().setType(idStmt.leftBox,t,false);
      }
      if (t instanceof LongType || t instanceof DoubleType) {
        parameterRegister++;
        Local g=Jimple.v().newLocal("String_Node_Str" + parameterRegister,UnknownType.v());
        jBody.getLocals().add(g);
        registerLocals[parameterRegister]=g;
      }
      parameterRegister++;
    }
  }
  for (int i=0; i < (numRegisters - numParameterRegisters - (isStatic ? 0 : 1)); i++) {
    Debug.printDbg("String_Node_Str",i);
    registerLocals[i]=Jimple.v().newLocal("String_Node_Str" + i,UnknownType.v());
    jBody.getLocals().add(registerLocals[i]);
  }
  storeResultLocal=Jimple.v().newLocal("String_Node_Str",UnknownType.v());
  jBody.getLocals().add(storeResultLocal);
  final boolean isOdex=dexFile instanceof DexBackedDexFile ? ((DexBackedDexFile)dexFile).isOdexFile() : false;
  int prevLineNumber=-1;
  for (  DexlibAbstractInstruction instruction : instructions) {
    if (isOdex && instruction instanceof OdexInstruction)     ((OdexInstruction)instruction).deOdex(dexFile);
    if (dangling != null) {
      dangling.finalize(this,instruction);
      dangling=null;
    }
    instruction.jimplify(this);
    if (instruction.getLineNumber() > 0)     prevLineNumber=instruction.getLineNumber();
 else {
      instruction.setLineNumber(prevLineNumber);
    }
  }
  for (  DeferableInstruction instruction : deferredInstructions) {
    instruction.deferredJimplify(this);
  }
  if (tries != null)   addTraps();
  instructions=null;
  instructionAtAddress.clear();
  deferredInstructions=null;
  dangling=null;
  tries=null;
  Debug.printDbg("String_Node_Str",jBody);
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  getLocalSplitter().transform(jBody);
  getUnreachableCodeEliminator().transform(jBody);
  DeadAssignmentEliminator.v().transform(jBody);
  UnusedLocalEliminator.v().transform(jBody);
  DexReturnInliner.v().transform(jBody);
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  for (  RetypeableInstruction i : instructionsToRetype)   i.retype(jBody);
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    Debug.printDbg("String_Node_Str");
    DalvikTyper.v().assignType(jBody);
    Debug.printDbg("String_Node_Str");
    jBody.validateUses();
    jBody.validateValueBoxes();
    Validate.validateArrays(jBody);
    Debug.printDbg("String_Node_Str");
  }
 else {
    DexNumTransformer.v().transform(jBody);
    DexReturnValuePropagator.v().transform(jBody);
    getCopyPopagator().transform(jBody);
    DexNullThrowTransformer.v().transform(jBody);
    DexNullTransformer.v().transform(jBody);
    DexIfTransformer.v().transform(jBody);
    DeadAssignmentEliminator.v().transform(jBody);
    UnusedLocalEliminator.v().transform(jBody);
    DexNullArrayRefTransformer.v().transform(jBody);
    Debug.printDbg("String_Node_Str");
  }
  Debug.printDbg("String_Node_Str",(Body)jBody);
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    for (    Local l : jBody.getLocals()) {
      l.setType(UnknownType.v());
    }
  }
  TypeAssigner.v().transform(jBody);
  if (IDalvikTyper.ENABLE_DVKTYPER) {
    for (    Unit u : jBody.getUnits()) {
      if (u instanceof IfStmt) {
        ConditionExpr expr=(ConditionExpr)((IfStmt)u).getCondition();
        if (((expr instanceof EqExpr) || (expr instanceof NeExpr))) {
          Value op1=expr.getOp1();
          Value op2=expr.getOp2();
          if (op1 instanceof Constant && op2 instanceof Local) {
            Local l=(Local)op2;
            Type ltype=l.getType();
            if (ltype instanceof PrimType)             continue;
            if (!(op1 instanceof IntConstant))             continue;
            IntConstant icst=(IntConstant)op1;
            int val=icst.value;
            if (val != 0)             continue;
            expr.setOp1(NullConstant.v());
          }
 else           if (op1 instanceof Local && op2 instanceof Constant) {
            Local l=(Local)op1;
            Type ltype=l.getType();
            if (ltype instanceof PrimType)             continue;
            if (!(op2 instanceof IntConstant))             continue;
            IntConstant icst=(IntConstant)op2;
            int val=icst.value;
            if (val != 0)             continue;
            expr.setOp2(NullConstant.v());
          }
 else           if (op1 instanceof Local && op2 instanceof Local) {
          }
 else {
            throw new RuntimeException("String_Node_Str" + u);
          }
        }
      }
    }
    List<ValueBox> uses=jBody.getUseBoxes();
    List<ValueBox> toNullConstantify=new ArrayList<ValueBox>();
    List<Local> toRemove=new ArrayList<Local>();
    for (    Local l : jBody.getLocals()) {
      if (l.getType() instanceof NullType) {
        toRemove.add(l);
        for (        ValueBox vb : uses) {
          Value v=vb.getValue();
          if (v == l)           toNullConstantify.add(vb);
        }
      }
    }
    for (    ValueBox vb : toNullConstantify) {
      System.out.println("String_Node_Str" + vb + "String_Node_Str");
      vb.setValue(NullConstant.v());
    }
    for (    Local l : toRemove) {
      System.out.println("String_Node_Str" + l);
      l.setType(RefType.v("String_Node_Str"));
    }
  }
  LocalPacker.v().transform(jBody);
  UnusedLocalEliminator.v().transform(jBody);
  LocalNameStandardizer.v().transform(jBody);
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  TrapTightener.v().transform(jBody);
  TrapMinimizer.v().transform(jBody);
  Aggregator.v().transform(jBody);
  ConditionalBranchFolder.v().transform(jBody);
  ConstantCastEliminator.v().transform(jBody);
  UnreachableCodeEliminator.v().transform(jBody);
  DeadAssignmentEliminator.v().transform(jBody);
  UnusedLocalEliminator.v().transform(jBody);
  NopEliminator.v().transform(jBody);
  if (m.toString().equals("String_Node_Str"))   System.out.println("String_Node_Str");
  for (  Unit u : jBody.getUnits()) {
    if (u instanceof AssignStmt) {
      AssignStmt ass=(AssignStmt)u;
      if (ass.getRightOp() instanceof CastExpr) {
        CastExpr c=(CastExpr)ass.getRightOp();
        if (c.getType() instanceof NullType) {
          Debug.printDbg("String_Node_Str",u);
          ass.setRightOp(NullConstant.v());
        }
      }
    }
    if (u instanceof DefinitionStmt) {
      DefinitionStmt def=(DefinitionStmt)u;
      if (def.getLeftOp() instanceof Local && def.getRightOp() instanceof CaughtExceptionRef) {
        Type t=def.getLeftOp().getType();
        if (t instanceof RefType) {
          RefType rt=(RefType)t;
          if (rt.getSootClass().isPhantom() && !rt.getSootClass().hasSuperclass() && !rt.getSootClass().getName().equals("String_Node_Str"))           rt.getSootClass().setSuperclass(Scene.v().getSootClass("String_Node_Str"));
        }
      }
    }
  }
  Debug.printDbg("String_Node_Str");
  Debug.printDbg("String_Node_Str",(Body)jBody);
  for (  Local l : jBody.getLocals()) {
    Type t=l.getType();
    if (t instanceof NullType) {
      Debug.printDbg("String_Node_Str",l);
      l.setType(RefType.v("String_Node_Str"));
    }
  }
  return jBody;
}