Program: 147297
Project: 147297
Buggy source:
public Conditional<Instruction> executeNative(final FeatureExpr ctx,ThreadInfo ti){
  Object ret=null;
  Object[] args=null;
  MJIEnv env=ti.getMJIEnv();
  NativeStackFrame nativeFrame=(NativeStackFrame)ti.getTopFrame();
  env.setCallEnvironment(this);
  if (isUnsatisfiedLinkError(env)) {
    return new One<>(ti.createAndThrowException(ctx,"String_Node_Str","String_Node_Str" + ci.getName() + '.'+ getName()));
  }
  try {
    args=nativeFrame.getArguments();
    if (RuntimeConstants.debug) {
      System.out.print("String_Node_Str" + name + "String_Node_Str"+ mth.toString());
      for (      Object a : args) {
        System.out.print("String_Node_Str" + a.toString());
      }
      System.out.println();
    }
    boolean supportsConditional=false;
    for (    Class<?> t : mth.getParameterTypes()) {
      if (t.equals(Conditional.class)) {
        supportsConditional=true;
      }
    }
    boolean handled=false;
    if (!supportsConditional) {
      int i=0;
      for (      Object a : args) {
        if (a instanceof One) {
          args[i++]=((One<?>)a).getValue();
        }
 else         if (a instanceof IChoice) {
          Conditional<Object[]> unconditionalArgs=getUnconditionalArgs(args);
          ret=unconditionalArgs.map(new Function<Object[],Object>(){
            @Override public Object apply(            Object[] args){
              try {
                return mth.invoke(peer,args);
              }
 catch (              IllegalAccessException|InvocationTargetException e) {
                System.err.println(mth);
                for (                Object a : args) {
                  System.err.println(a.toString());
                }
                throw new RuntimeException(e);
              }
            }
          }
);
          handled=true;
          break;
        }
 else {
          args[i++]=a;
        }
      }
    }
    try {
      if (!handled) {
        if (mth.getParameterTypes()[1].isPrimitive()) {
          if (args[1] instanceof One) {
            args[1]=((One<?>)args[1]).getValue();
          }
          ret=mth.invoke(peer,args);
        }
 else {
          ret=mth.invoke(peer,args);
        }
      }
    }
 catch (    IllegalAccessException e) {
      System.err.println(mth);
      for (      Object a : args) {
        System.err.println(a.toString());
      }
      throw e;
    }
    if (env.hasException()) {
      return new One<>(ti.throwException(ctx,env.popException()));
    }
    StackFrame top=ti.getTopFrame();
    if (top == nativeFrame) {
      if (env.isInvocationRepeated()) {
        return new One<>(nativeFrame.getPC().getValue());
      }
 else {
        nativeFrame.setReturnValue(ret);
        nativeFrame.setReturnAttr(env.getReturnAttribute());
        return nativeFrame.getPC().mapf(ctx,new BiFunction<FeatureExpr,Instruction,Conditional<Instruction>>(){
          @Override public Conditional<Instruction> apply(          FeatureExpr f,          Instruction y){
            if (Conditional.isContradiction(f)) {
              return new One<>(y);
            }
            if (Conditional.isTautology(f)) {
              return new One<>(y.getNext());
            }
            return ChoiceFactory.create(ctx,new One<>(y.getNext()),new One<>(y));
          }
        }
).simplify();
      }
    }
 else {
      return top.getPC();
    }
  }
 catch (  IllegalArgumentException iax) {
    logger.warning(iax.toString());
    return new One<>(ti.createAndThrowException(ctx,"String_Node_Str","String_Node_Str" + ci.getName() + '.'+ getName()));
  }
catch (  IllegalAccessException ilax) {
    logger.warning(ilax.toString());
    return new One<>(ti.createAndThrowException(ctx,"String_Node_Str","String_Node_Str" + ci.getName() + '.'+ getName()));
  }
catch (  InvocationTargetException itx) {
    if (itx.getTargetException() instanceof ClassInfoException) {
      ClassInfoException cie=(ClassInfoException)itx.getTargetException();
      return new One<>(ti.createAndThrowException(ctx,cie.getExceptionClass(),cie.getMessage()));
    }
    if (itx.getTargetException() instanceof UncaughtException) {
      throw (UncaughtException)itx.getTargetException();
    }
    throw new JPFNativePeerException("String_Node_Str" + ci.getName() + '.'+ getName(),itx.getTargetException());
  }
}

Fixed version (ground truth):
public Conditional<Instruction> executeNative(final FeatureExpr ctx,ThreadInfo ti){
  Object ret=null;
  Object[] args=null;
  MJIEnv env=ti.getMJIEnv();
  NativeStackFrame nativeFrame=(NativeStackFrame)ti.getTopFrame();
  env.setCallEnvironment(this);
  if (isUnsatisfiedLinkError(env)) {
    return new One<>(ti.createAndThrowException(ctx,"String_Node_Str","String_Node_Str" + ci.getName() + '.'+ getName()));
  }
  try {
    args=nativeFrame.getArguments();
    if (RuntimeConstants.debug) {
      System.out.print("String_Node_Str" + name + "String_Node_Str"+ mth.toString());
      for (      Object a : args) {
        System.out.print("String_Node_Str" + a.toString());
      }
      System.out.println();
    }
    boolean supportsConditional=false;
    for (    Class<?> t : mth.getParameterTypes()) {
      if (t.equals(Conditional.class)) {
        supportsConditional=true;
      }
    }
    boolean handled=false;
    if (!supportsConditional) {
      int i=0;
      for (      Object a : args) {
        if (a instanceof One) {
          args[i++]=((One<?>)a).getValue();
        }
 else         if (a instanceof IChoice) {
          Conditional<Object[]> unconditionalArgs=getUnconditionalArgs(args);
          ret=unconditionalArgs.map(new Function<Object[],Object>(){
            @Override public Object apply(            Object[] args){
              try {
                return mth.invoke(peer,args);
              }
 catch (              IllegalAccessException|InvocationTargetException e) {
                System.err.println(mth);
                for (                Object a : args) {
                  System.err.println(a.toString());
                }
                throw new RuntimeException(e);
              }
            }
          }
);
          handled=true;
          break;
        }
 else {
          args[i++]=a;
        }
      }
    }
    try {
      if (!handled) {
        if (mth.getParameterTypes()[1].isPrimitive()) {
          if (args[1] instanceof One) {
            args[1]=((One<?>)args[1]).getValue();
          }
          ret=mth.invoke(peer,args);
        }
 else {
          ret=mth.invoke(peer,args);
        }
      }
    }
 catch (    IllegalAccessException e) {
      System.err.println(mth);
      for (      Object a : args) {
        System.err.println(a.toString());
      }
      throw e;
    }
    if (env.hasException()) {
      return new One<>(ti.throwException(ctx,env.popException()));
    }
    StackFrame top=ti.getTopFrame();
    if (top == nativeFrame) {
      if (env.isInvocationRepeated()) {
        return new One<>(nativeFrame.getPC().getValue());
      }
 else {
        nativeFrame.setReturnValue(ret);
        nativeFrame.setReturnAttr(env.getReturnAttribute());
        return nativeFrame.getPC().mapf(ctx,new BiFunction<FeatureExpr,Instruction,Conditional<Instruction>>(){
          @Override public Conditional<Instruction> apply(          FeatureExpr f,          Instruction y){
            if (Conditional.isContradiction(f)) {
              return new One<>(y);
            }
            if (Conditional.isTautology(f)) {
              return new One<>(y.getNext());
            }
            return ChoiceFactory.create(ctx,new One<>(y.getNext()),new One<>(y));
          }
        }
).simplify();
      }
    }
 else {
      return top.getPC();
    }
  }
 catch (  IllegalArgumentException iax) {
    logger.warning(iax.toString());
    return new One<>(ti.createAndThrowException(ctx,"String_Node_Str","String_Node_Str" + ci.getName() + '.'+ getName()));
  }
catch (  IllegalAccessException ilax) {
    logger.warning(ilax.toString());
    return new One<>(ti.createAndThrowException(ctx,"String_Node_Str","String_Node_Str" + ci.getName() + '.'+ getName()));
  }
catch (  InvocationTargetException itx) {
    if (itx.getTargetException() instanceof ClassInfoException) {
      ClassInfoException cie=(ClassInfoException)itx.getTargetException();
      return new One<>(new EXCEPTION(cie.getExceptionClass().toString(),cie.getMessage()));
    }
    if (itx.getTargetException() instanceof UncaughtException) {
      throw (UncaughtException)itx.getTargetException();
    }
    throw new JPFNativePeerException("String_Node_Str" + ci.getName() + '.'+ getName(),itx.getTargetException());
  }
}