Program: 35094
Project: 35094
Buggy source:
/** 
 * Loop over/collapse down input str, solves for either +- or /*.  places result in expression
 * @param regexOperatorType is the type of operators to look for in regex form
 * @param str is the string to operate upon
 */
private static String collapseOps(String regexOperatorType,String str,MathContext mcSolve){
  Pattern ptn=Pattern.compile(Expression.regexGroupedNumber + regexOperatorType + Expression.regexGroupedNumber);
  Matcher mat=ptn.matcher(str);
  BigDecimal result;
  while (mat.find()) {
    BigDecimal operand1;
    BigDecimal operand2;
    String operator;
    try {
      operand1=new BigDecimal(mat.group(1));
      operand2=new BigDecimal(mat.group(3));
      operator=mat.group(2);
    }
 catch (    NumberFormatException e) {
      str=strSyntaxError;
      return str;
    }
    if (operator.equals("String_Node_Str"))     result=operand1.add(operand2,mcSolve);
 else     if (operator.equals("String_Node_Str"))     result=operand1.subtract(operand2,mcSolve);
 else     if (operator.equals("String_Node_Str"))     result=operand1.multiply(operand2,mcSolve);
 else     if (operator.equals("String_Node_Str")) {
      double dResult=Math.pow(operand1.doubleValue(),operand2.doubleValue());
      try {
        result=BigDecimal.valueOf(dResult);
      }
 catch (      NumberFormatException ex) {
        if (dResult == Double.POSITIVE_INFINITY || dResult == Double.NEGATIVE_INFINITY)         str=strInfinityError;
 else         str=strSyntaxError;
        return str;
      }
    }
 else     if (operator.equals("String_Node_Str")) {
      try {
        result=operand1.divide(operand2,mcSolve);
      }
 catch (      ArithmeticException ex) {
        str=strDivideZeroError;
        return str;
      }
    }
 else     throw new IllegalArgumentException("String_Node_Str");
    str=str.substring(0,mat.start()) + result + str.substring(mat.end());
    mat=ptn.matcher(str);
  }
  return str;
}

Fixed version (ground truth):
/** 
 * Loop over/collapse down input str, solves for either +- or /*.  places result in expression
 * @param regexOperatorType is the type of operators to look for in regex form
 * @param str is the string to operate upon
 */
private static String collapseOps(String regexOperatorType,String str,MathContext mcSolve){
  Pattern ptn=Pattern.compile(Expression.regexGroupedNumber + regexOperatorType + Expression.regexGroupedNumber);
  Matcher mat=ptn.matcher(str);
  BigDecimal result;
  while (mat.find()) {
    BigDecimal operand1;
    BigDecimal operand2;
    String operator;
    try {
      operand1=new BigDecimal(mat.group(1));
      operand2=new BigDecimal(mat.group(3));
      operator=mat.group(2);
    }
 catch (    NumberFormatException e) {
      str=strSyntaxError;
      return str;
    }
    if (operator.equals("String_Node_Str")) {
      if (operand1.scale() < -9000 || operand2.scale() < -9000)       return strInfinityError;
      result=operand1.add(operand2,mcSolve);
    }
 else     if (operator.equals("String_Node_Str")) {
      if (operand1.scale() < -9000 || operand2.scale() < -9000)       return strInfinityError;
      result=operand1.subtract(operand2,mcSolve);
    }
 else     if (operator.equals("String_Node_Str"))     result=operand1.multiply(operand2,mcSolve);
 else     if (operator.equals("String_Node_Str")) {
      double dResult=Math.pow(operand1.doubleValue(),operand2.doubleValue());
      try {
        result=BigDecimal.valueOf(dResult);
      }
 catch (      NumberFormatException ex) {
        if (dResult == Double.POSITIVE_INFINITY || dResult == Double.NEGATIVE_INFINITY)         str=strInfinityError;
 else         str=strSyntaxError;
        return str;
      }
    }
 else     if (operator.equals("String_Node_Str")) {
      try {
        result=operand1.divide(operand2,mcSolve);
      }
 catch (      ArithmeticException ex) {
        str=strDivideZeroError;
        return str;
      }
    }
 else     throw new IllegalArgumentException("String_Node_Str");
    str=str.substring(0,mat.start()) + result + str.substring(mat.end());
    mat=ptn.matcher(str);
  }
  return str;
}