nus-yam/ex-repair huggingface dataset:
Program: 72401
Project: 72401
Buggy source:
private int getParameterType(int i) throws OdaException {
  if (parameterDefn.getParameterType(i) != Types.CHAR)   return parameterDefn.getParameterType(i);
  IParameterMetaData paramMetaData=getParameterMetaData();
  if (paramMetaData != null && paramMetaData.getParameterCount() > i)   return paramMetaData.getParameterType(i + 1);
 else   return parameterDefn.getParameterType(i);
}

Fixed version (ground truth):
private int getParameterType(int i) throws OdaException {
  if (parameterDefn.getParameterType(i) != Types.CHAR)   return parameterDefn.getParameterType(i);
  IParameterMetaData paramMetaData=getParameterMetaData();
  if (paramMetaData != null && paramMetaData.getParameterCount() >= i)   return paramMetaData.getParameterType(i);
 else   return parameterDefn.getParameterType(i);
}
Program: 72402
Project: 72402
Buggy source:
public IParameterMetaData getParameterMetaData() throws OdaException {
  assertNotNull(callStat);
  if (this.cachedParameterMetaData != null)   return this.cachedParameterMetaData;
  int[] positionArray=paramUtil.getParameterPositions();
  List paramMetaList1=this.getCallableParamMetaData();
  List paramMetaList2=new ArrayList();
  for (int i=0; i < positionArray.length; i++) {
    int index=positionArray[i];
    if (paramMetaList1.size() >= index)     paramMetaList2.add(paramMetaList1.get(index - 1));
 else     throw new OdaException(ResourceConstants.PREPARESTATEMENT_PARAMETER_METADATA_CANNOT_GET);
  }
  cachedParameterMetaData=new SPParameterMetaData(paramMetaList2);
  return cachedParameterMetaData;
}

Fixed version (ground truth):
public IParameterMetaData getParameterMetaData() throws OdaException {
  assertNotNull(callStat);
  if (this.cachedParameterMetaData != null)   return this.cachedParameterMetaData;
  int[] positionArray=paramUtil.getParameterPositions();
  List paramMetaList1=this.getCallableParamMetaData();
  List paramMetaList2=new ArrayList();
  int containsReturnValue=0;
  if (paramMetaList1.size() > 0 && paramUtil.containsReturnValue()) {
    if (((ParameterDefn)paramMetaList1.get(0)).getParamInOutType() == 5) {
      paramMetaList2.add(((ParameterDefn)paramMetaList1.get(0)));
      containsReturnValue++;
    }
  }
  for (int i=0; i < positionArray.length; i++) {
    int index=positionArray[i];
    if (paramMetaList1.size() >= index)     paramMetaList2.add(paramMetaList1.get(index - 1 + containsReturnValue));
 else     throw new OdaException(ResourceConstants.PREPARESTATEMENT_PARAMETER_METADATA_CANNOT_GET);
  }
  cachedParameterMetaData=new SPParameterMetaData(paramMetaList2);
  return cachedParameterMetaData;
}
Program: 72403
Project: 72403
Buggy source:
private java.sql.ResultSet getOutputParamResultSet() throws OdaException, SQLException {
  if (parameterDefn != null) {
    for (int i=0; i < parameterDefn.getParameterCount(); i++) {
      if (parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeOut) {
        Object expected=callStat.getObject(i + 1);
        if (expected instanceof java.sql.ResultSet)         return (java.sql.ResultSet)expected;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private java.sql.ResultSet getOutputParamResultSet() throws OdaException, SQLException {
  if (parameterDefn != null) {
    for (int i=1; i <= parameterDefn.getParameterCount(); i++) {
      if (parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeOut) {
        Object expected=callStat.getObject(i);
        if (expected instanceof java.sql.ResultSet)         return (java.sql.ResultSet)expected;
      }
    }
  }
  return null;
}
Program: 72404
Project: 72404
Buggy source:
public void setNull(int parameterId) throws OdaException {
  assertNotNull(callStat);
  try {
    if (this.getParameterMetaData() != null) {
      this.callStat.setNull(parameterId,this.getParameterMetaData().getParameterType(parameterId));
    }
 else {
      this.callStat.setNull(parameterId,java.sql.Types.OTHER);
    }
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.PREPARESTATEMENT_CANNOT_SET_NULL_VALUE,e);
  }
}

Fixed version (ground truth):
public void setNull(int parameterId) throws OdaException {
  assertNotNull(callStat);
  try {
    if (this.getParameterMetaData() != null) {
      this.callStat.setNull(parameterId,getParameterType(parameterId));
    }
 else {
      this.callStat.setNull(parameterId,java.sql.Types.OTHER);
    }
  }
 catch (  SQLException e) {
    throw new JDBCException(ResourceConstants.PREPARESTATEMENT_CANNOT_SET_NULL_VALUE,e);
  }
}
Program: 72405
Project: 72405
Buggy source:
/** 
 * get parameter metadata for callableStatement, if metadata is null or data mode is unknown or SQLException is thrown, register output parameter on DatabaseMetadata, else register output parameter on statement's metadata.
 * @throws OdaException
 */
private void registerOutputParameter() throws OdaException {
  if (parameterDefn != null) {
    for (int i=0; i < parameterDefn.getParameterCount(); i++) {
      if (parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeOut || parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeInOut) {
        registerOutParameter(i + 1,getParameterType(i));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * get parameter metadata for callableStatement, if metadata is null or data mode is unknown or SQLException is thrown, register output parameter on DatabaseMetadata, else register output parameter on statement's metadata.
 * @throws OdaException
 */
private void registerOutputParameter() throws OdaException {
  if (parameterDefn != null) {
    for (int i=1; i <= parameterDefn.getParameterCount(); i++) {
      if (parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeOut || parameterDefn.getParameterMode(i) == IParameterMetaData.parameterModeInOut) {
        registerOutParameter(i,getParameterType(i));
      }
    }
  }
}
Program: 72406
Project: 72406
Buggy source:
private void parseProcedureName(String sqlTxt,int[] point) throws JDBCException {
  int start=sqlTxt.toLowerCase().indexOf("String_Node_Str");
  int end=point[0];
  if (point[0] == -1 && point[1] == -1) {
    end=sqlTxt.indexOf("String_Node_Str");
  }
  if (start == -1 || start + 4 >= end)   throw new JDBCException(ResourceConstants.INVALID_STORED_PRECEDURE,ResourceConstants.ERROR_INVALID_STATEMENT);
  String name=sqlTxt.substring(start + 4,end).trim();
  String[] pattern=name.split("String_Node_Str");
  for (int i=0; i < pattern.length; i++) {
    pattern[i]=escapeIdentifier(pattern[i]);
  }
  namePattern=pattern;
}

Fixed version (ground truth):
private void parseProcedureName(String sqlTxt,int[] point) throws JDBCException {
  int start=sqlTxt.toLowerCase().indexOf("String_Node_Str");
  int end=point[0];
  if (point[0] == -1 && point[1] == -1) {
    end=sqlTxt.indexOf("String_Node_Str");
  }
  if (start == -1 || start + 4 >= end)   throw new JDBCException(ResourceConstants.INVALID_STORED_PRECEDURE,ResourceConstants.ERROR_INVALID_STATEMENT);
  if (sqlTxt.substring(0,start).matches("String_Node_Str")) {
    this.containsReturnValue=true;
  }
  String name=sqlTxt.substring(start + 4,end).trim();
  String[] pattern=name.split("String_Node_Str");
  for (int i=0; i < pattern.length; i++) {
    pattern[i]=escapeIdentifier(pattern[i]);
  }
  namePattern=pattern;
}
Program: 72407
Project: 72407
Buggy source:
public int compare(Object o1,Object o2){
  Object3D obj1=getObjectFromEvent(o1);
  Object3D obj2=getObjectFromEvent(o2);
  if (obj1.getZMax() > obj2.getZMax()) {
    return -1;
  }
 else   if (obj1.getZMax() < obj2.getZMax()) {
    return 1;
  }
 else {
    return 0;
  }
}

Fixed version (ground truth):
public int compare(Object o1,Object o2){
  Object3D obj1=getObjectFromEvent(o1,true);
  Object3D obj2=getObjectFromEvent(o2,true);
  if (obj1.getZMax() > obj2.getZMax()) {
    return -1;
  }
 else   if (obj1.getZMax() < obj2.getZMax()) {
    return 1;
  }
 else {
    return 0;
  }
}
Program: 72408
Project: 72408
Buggy source:
protected Object3D getObjectFromEvent(Object event){
  if (event instanceof WrappedInstruction) {
    event=((WrappedInstruction)event).getEvent();
  }
  if (event instanceof I3DRenderEvent) {
    if (event instanceof Area3DRenderEvent) {
      return ((I3DRenderEvent)((Area3DRenderEvent)event).getElement(0)).getObject3D();
    }
 else {
      return ((I3DRenderEvent)event).getObject3D();
    }
  }
 else {
    throw new IllegalArgumentException();
  }
}

Fixed version (ground truth):
public static Object3D getObjectFromEvent(Object event,boolean bParent){
  if (event instanceof WrappedInstruction) {
    event=((WrappedInstruction)event).getEvent();
  }
  if (event instanceof I3DRenderEvent) {
    if (event instanceof Area3DRenderEvent) {
      return ((I3DRenderEvent)((Area3DRenderEvent)event).getElement(0)).getObject3D();
    }
 else     if (bParent && event instanceof Line3DRenderEvent && ((Line3DRenderEvent)event).getObject3DParent() != null) {
      return ((Line3DRenderEvent)event).getObject3DParent();
    }
 else {
      return ((I3DRenderEvent)event).getObject3D();
    }
  }
 else {
    throw new IllegalArgumentException();
  }
}
Program: 72409
Project: 72409
Buggy source:
Matrix getTransformMatrix(){
  Matrix m=Matrix.identity(4,4);
  m.set(2,2,-1);
  for (Iterator itr=ROT.getAngles().iterator(); itr.hasNext(); ) {
    Angle3D agl=(Angle3D)itr.next();
    if (agl.getType() == AngleType.NONE_LITERAL) {
      m=rotateMatrixY(m,agl.getYAngle());
      m=rotateMatrixX(m,agl.getXAngle());
      m=rotateMatrixZ(m,agl.getZAngle());
    }
 else {
switch (agl.getType().getValue()) {
case AngleType.X:
        m=rotateMatrixX(m,agl.getAxisAngle());
      break;
case AngleType.Y:
    m=rotateMatrixY(m,agl.getAxisAngle());
  break;
case AngleType.Z:
m=rotateMatrixZ(m,agl.getAxisAngle());
break;
}
}
}
return m;
}

Fixed version (ground truth):
Matrix getTransformMatrix(){
  Matrix m=Matrix.identity(4,4);
  m.set(2,2,-1);
  for (Iterator<?> itr=ROT.getAngles().iterator(); itr.hasNext(); ) {
    Angle3D agl=(Angle3D)itr.next();
    if (agl.getType() == AngleType.NONE_LITERAL) {
      m=rotateMatrixY(m,agl.getYAngle());
      m=rotateMatrixX(m,agl.getXAngle());
      m=rotateMatrixZ(m,agl.getZAngle());
    }
 else {
switch (agl.getType().getValue()) {
case AngleType.X:
        m=rotateMatrixX(m,agl.getAxisAngle());
      break;
case AngleType.Y:
    m=rotateMatrixY(m,agl.getAxisAngle());
  break;
case AngleType.Z:
m=rotateMatrixZ(m,agl.getAxisAngle());
break;
}
}
}
return m;
}
Program: 72410
Project: 72410
Buggy source:
protected void zsort(List rtList){
  Collections.sort(rtList,new Comparator(){
    public int compare(    Object o1,    Object o2){
      Object3D obj1=getObjectFromEvent(o1);
      Object3D obj2=getObjectFromEvent(o2);
      if (obj1.getZMax() > obj2.getZMax()) {
        return -1;
      }
 else       if (obj1.getZMax() < obj2.getZMax()) {
        return 1;
      }
 else {
        return 0;
      }
    }
  }
);
}

Fixed version (ground truth):
protected void zsort(List rtList){
  Collections.sort(rtList,new Comparator(){
    public int compare(    Object o1,    Object o2){
      Object3D obj1=getObjectFromEvent(o1,true);
      Object3D obj2=getObjectFromEvent(o2,true);
      if (obj1.getZMax() > obj2.getZMax()) {
        return -1;
      }
 else       if (obj1.getZMax() < obj2.getZMax()) {
        return 1;
      }
 else {
        return 0;
      }
    }
  }
);
}
Program: 72411
Project: 72411
Buggy source:
protected void overlapSwap(List rtList){
  for (int i=0; i < rtList.size(); i++) {
    long max_loop=rtList.size() - i;
    int n=-1;
    boolean restart=true;
    while (restart && n < max_loop) {
      restart=false;
      n++;
      Object event=rtList.get(i);
      Object3D far=getObjectFromEvent(event);
      for (int j=i + 1; j < rtList.size(); j++) {
        Object event2=rtList.get(j);
        Object3D near=getObjectFromEvent(event2);
        if (far.testZOverlap(near)) {
          if (far.testSwap(near,this)) {
            rtList.set(i,event2);
            rtList.set(j,event);
            restart=true;
            break;
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void overlapSwap(List rtList){
  HashSet<Object> hs=new HashSet<Object>();
  for (int i=0; i < rtList.size(); i++) {
    long max_loop=rtList.size() - i;
    int n=-1;
    boolean restart=true;
    while (restart && n < max_loop) {
      restart=false;
      n++;
      Object event=rtList.get(i);
      Object3D far=getObjectFromEvent(event,true);
      for (int j=i + 1; j < rtList.size(); j++) {
        Object event2=rtList.get(j);
        Object3D near=getObjectFromEvent(event2,true);
        Object3D nearParent=getParentObject(event2);
        if (far == near) {
          if (nearParent == null) {
            rtList.set(i,event2);
            rtList.set(j,event);
            restart=true;
            break;
          }
 else {
            continue;
          }
        }
        if (far.testZOverlap(near)) {
          boolean bSwap=far.testSwap(near,this);
          if (bSwap) {
            boolean bSwapedFromFront=hs.contains(event);
            bSwap=!bSwapedFromFront;
            if (bSwap) {
              hs.add(event2);
            }
          }
          if (bSwap) {
            rtList.set(i,event2);
            rtList.set(j,event);
            restart=true;
            break;
          }
        }
      }
    }
  }
}
Program: 72412
Project: 72412
Buggy source:
/** 
 * compile the expression
 * @param expression
 * @return List contains all column reference
 * @throws BirtException
 */
public static List compileColumnExpression(ExpressionParserUtility util,String expression,boolean rowMode) throws BirtException {
  if (expression == null || expression.trim().length() == 0)   return new ArrayList();
  if (rowMode)   util.ROW_INDICATOR=ROW_COLUMN_INDICATOR;
 else   util.ROW_INDICATOR=DATASETROW_INDICATOR;
  List columnExprList=new ArrayList();
  columnExprList.clear();
  Context context=Context.enter();
  try {
    ScriptOrFnNode tree=util.parse(expression,context);
    util.CompiledExprFromTree(expression,context,tree,columnExprList);
  }
 catch (  Exception ex) {
    throw new CoreException(ResourceConstants.INVALID_EXPRESSION,expression,ex);
  }
 finally {
    Context.exit();
  }
  return columnExprList;
}

Fixed version (ground truth):
/** 
 * compile the expression
 * @param expression
 * @return List contains all column reference
 * @throws BirtException
 */
public static List compileColumnExpression(ExpressionParserUtility util,String expression,String indicator) throws BirtException {
  if (expression == null || expression.trim().length() == 0)   return new ArrayList();
  util.ROW_INDICATOR=indicator;
  List columnExprList=new ArrayList();
  columnExprList.clear();
  Context context=Context.enter();
  try {
    ScriptOrFnNode tree=util.parse(expression,context);
    util.CompiledExprFromTree(expression,context,tree,columnExprList);
  }
 catch (  Exception ex) {
    throw new CoreException(ResourceConstants.INVALID_EXPRESSION,expression,ex);
  }
 finally {
    Context.exit();
  }
  return columnExprList;
}
Program: 72413
Project: 72413
Buggy source:
static boolean isDirectColumnRef(String expression,boolean mode) throws BirtException {
  ExpressionParserUtility util=new ExpressionParserUtility();
  util.isDirectColumnRef=false;
  compileColumnExpression(util,expression,mode);
  return util.isDirectColumnRef;
}

Fixed version (ground truth):
static boolean isDirectColumnRef(String expression,String indicator) throws BirtException {
  ExpressionParserUtility util=new ExpressionParserUtility();
  util.isDirectColumnRef=false;
  compileColumnExpression(util,expression,indicator);
  return util.isDirectColumnRef;
}
Program: 72414
Project: 72414
Buggy source:
/** 
 * @return
 * @throws BirtException 
 */
static boolean hasAggregation(String expression,boolean mode) throws BirtException {
  ExpressionParserUtility util=new ExpressionParserUtility();
  util.hasAggregation=false;
  compileColumnExpression(util,expression,mode);
  return util.hasAggregation;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws BirtException 
 */
static boolean hasAggregation(String expression,String indicator) throws BirtException {
  ExpressionParserUtility util=new ExpressionParserUtility();
  util.hasAggregation=false;
  compileColumnExpression(util,expression,indicator);
  return util.hasAggregation;
}
Program: 72415
Project: 72415
Buggy source:
/** 
 * Get the simplest column binding name. Such as dataSetRow["col1"] pattern, we will return the column name "col1"
 * @param oldExpression
 * @return
 * @throws BirtException
 */
public static String getColumnName(String oldExpression) throws BirtException {
  List columnsLists=extractColumnExpressions(oldExpression,false);
  if (columnsLists.size() != 1 || !ExpressionParserUtility.isDirectColumnRef(oldExpression,false))   return null;
  return ((IColumnBinding)columnsLists.get(0)).getResultSetColumnName();
}

Fixed version (ground truth):
/** 
 * Get the simplest column binding name. Such as dataSetRow["col1"] pattern, we will return the column name "col1"
 * @param oldExpression
 * @return
 * @throws BirtException
 */
public static String getColumnName(String oldExpression) throws BirtException {
  List columnsLists=extractColumnExpressions(oldExpression,ExpressionUtil.DATASET_ROW_INDICATOR);
  if (columnsLists.size() != 1 || !ExpressionParserUtility.isDirectColumnRef(oldExpression,ExpressionUtil.DATASET_ROW_INDICATOR))   return null;
  return ((IColumnBinding)columnsLists.get(0)).getResultSetColumnName();
}
Program: 72416
Project: 72416
Buggy source:
/** 
 * Get the simplest column binding name. Such as row["col1"] pattern, we will return the column name "col1"
 * @param oldExpression
 * @return
 * @throws BirtException
 */
public static String getColumnBindingName(String oldExpression) throws BirtException {
  List columnsLists=extractColumnExpressions(oldExpression,true);
  if (columnsLists.size() != 1 || !ExpressionParserUtility.isDirectColumnRef(oldExpression,true))   return null;
  return ((IColumnBinding)columnsLists.get(0)).getResultSetColumnName();
}

Fixed version (ground truth):
/** 
 * Get the simplest column binding name. Such as row["col1"] pattern, we will return the column name "col1"
 * @param oldExpression
 * @return
 * @throws BirtException
 */
public static String getColumnBindingName(String oldExpression) throws BirtException {
  List columnsLists=extractColumnExpressions(oldExpression,ExpressionUtil.ROW_INDICATOR);
  if (columnsLists.size() != 1 || !ExpressionParserUtility.isDirectColumnRef(oldExpression,ExpressionUtil.ROW_INDICATOR))   return null;
  return ((IColumnBinding)columnsLists.get(0)).getResultSetColumnName();
}
Program: 72417
Project: 72417
Buggy source:
/** 
 * Extract all column expression info
 * @param oldExpression
 * @param mode if true, it means to compile the "row" expression.else extract "dataSetRow" expression
 * @return
 * @throws BirtException
 */
public static List extractColumnExpressions(String oldExpression,boolean mode) throws BirtException {
  if (oldExpression == null || oldExpression.trim().length() == 0)   return new ArrayList();
  return ExpressionParserUtility.compileColumnExpression(new ExpressionParserUtility(),oldExpression,mode);
}

Fixed version (ground truth):
/** 
 * Extract all column expression info
 * @param oldExpression
 * @param mode if true, it means to compile the "row" expression.else extract "dataSetRow" expression
 * @return
 * @throws BirtException
 */
public static List extractColumnExpressions(String oldExpression,String indicator) throws BirtException {
  if (oldExpression == null || oldExpression.trim().length() == 0)   return new ArrayList();
  return ExpressionParserUtility.compileColumnExpression(new ExpressionParserUtility(),oldExpression,indicator);
}
Program: 72418
Project: 72418
Buggy source:
/** 
 * whethter the expression has aggregation 
 * @param oldExpression
 * @return
 * @throws BirtException
 */
public static boolean hasAggregation(String expression){
  if (expression == null)   return false;
  try {
    return ExpressionParserUtility.hasAggregation(expression,true);
  }
 catch (  BirtException e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * whethter the expression has aggregation 
 * @param oldExpression
 * @return
 * @throws BirtException
 */
public static boolean hasAggregation(String expression){
  if (expression == null)   return false;
  try {
    return ExpressionParserUtility.hasAggregation(expression,ExpressionUtil.ROW_INDICATOR);
  }
 catch (  BirtException e) {
    return false;
  }
}
Program: 72419
Project: 72419
Buggy source:
public void testExpression1(){
  String expression=oldExpressions[1];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression1(){
  String expression=oldExpressions[1];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72420
Project: 72420
Buggy source:
public void testExpression9(){
  String expression=oldExpressions[9];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression9(){
  String expression=oldExpressions[9];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72421
Project: 72421
Buggy source:
public void testExpression8(){
  String expression=oldExpressions[8];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression8(){
  String expression=oldExpressions[8];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72422
Project: 72422
Buggy source:
public void testExpression7(){
  String expression=oldExpressions[7];
  try {
    ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    fail("String_Node_Str");
  }
 catch (  BirtException e) {
  }
}

Fixed version (ground truth):
public void testExpression7(){
  String expression=oldExpressions[7];
  try {
    extractColumnExpression(new ScriptExpression(expression));
    fail("String_Node_Str");
  }
 catch (  BirtException e) {
  }
}
Program: 72423
Project: 72423
Buggy source:
public void testExpression6(){
  String expression=oldExpressions[6];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression6(){
  String expression=oldExpressions[6];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72424
Project: 72424
Buggy source:
public void testExpression5(){
  String expression=oldExpressions[5];
  try {
    ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    fail("String_Node_Str");
  }
 catch (  BirtException e) {
  }
}

Fixed version (ground truth):
public void testExpression5(){
  String expression=oldExpressions[5];
  try {
    extractColumnExpression(new ScriptExpression(expression));
    fail("String_Node_Str");
  }
 catch (  BirtException e) {
  }
}
Program: 72425
Project: 72425
Buggy source:
public void testExpression4(){
  String expression=oldExpressions[4];
  try {
    ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    fail("String_Node_Str");
  }
 catch (  BirtException e) {
  }
}

Fixed version (ground truth):
public void testExpression4(){
  String expression=oldExpressions[4];
  try {
    extractColumnExpression(new ScriptExpression(expression));
    fail("String_Node_Str");
  }
 catch (  BirtException e) {
  }
}
Program: 72426
Project: 72426
Buggy source:
public void testExpression3(){
  String expression=oldExpressions[3];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 2);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression3(){
  String expression=oldExpressions[3];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 2);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72427
Project: 72427
Buggy source:
public void testExpression2(){
  String expression=oldExpressions[2];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression2(){
  String expression=oldExpressions[2];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72428
Project: 72428
Buggy source:
public void testAggregationExpression13(){
  String expression="String_Node_Str";
  String expression2="String_Node_Str";
  String expression3="String_Node_Str";
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
    list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression2));
    assertTrue(list.size() == 1);
    list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression3));
    assertTrue(list.size() == 3);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testAggregationExpression13(){
  String expression="String_Node_Str";
  String expression2="String_Node_Str";
  String expression3="String_Node_Str";
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
    list=extractColumnExpression(new ScriptExpression(expression2));
    assertTrue(list.size() == 1);
    list=extractColumnExpression(new ScriptExpression(expression3));
    assertTrue(list.size() == 3);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72429
Project: 72429
Buggy source:
public void testConditionalExpression(){
  IConditionalExpression ce1=new ConditionalExpression("String_Node_Str",1,"String_Node_Str");
  IConditionalExpression ce2=new ConditionalExpression("String_Node_Str",1,"String_Node_Str");
  IConditionalExpression ce3=new ConditionalExpression("String_Node_Str",1,"String_Node_Str");
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(ce1);
    assertEquals(list.size(),2);
    list=ExpressionCompilerUtil.extractColumnExpression(ce2);
    assertEquals(list.size(),1);
    list=ExpressionCompilerUtil.extractColumnExpression(ce3);
    assertEquals(list.size(),3);
  }
 catch (  DataException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testConditionalExpression(){
  IConditionalExpression ce1=new ConditionalExpression("String_Node_Str",1,"String_Node_Str");
  IConditionalExpression ce2=new ConditionalExpression("String_Node_Str",1,"String_Node_Str");
  IConditionalExpression ce3=new ConditionalExpression("String_Node_Str",1,"String_Node_Str");
  try {
    List list=extractColumnExpression(ce1);
    assertEquals(list.size(),2);
    list=extractColumnExpression(ce2);
    assertEquals(list.size(),1);
    list=extractColumnExpression(ce3);
    assertEquals(list.size(),3);
  }
 catch (  DataException e) {
    fail("String_Node_Str");
  }
}
Program: 72430
Project: 72430
Buggy source:
public void testExpression11(){
  String expression=oldExpressions[11];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression11(){
  String expression=oldExpressions[11];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 1);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72431
Project: 72431
Buggy source:
public void testExpression12(){
  String expression=oldExpressions[12];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 2);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression12(){
  String expression=oldExpressions[12];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 2);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72432
Project: 72432
Buggy source:
public void testExpression10(){
  String expression=oldExpressions[10];
  try {
    List list=ExpressionCompilerUtil.extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 2);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
public void testExpression10(){
  String expression=oldExpressions[10];
  try {
    List list=extractColumnExpression(new ScriptExpression(expression));
    assertTrue(list.size() == 2);
  }
 catch (  BirtException e) {
    fail("String_Node_Str");
  }
}
Program: 72433
Project: 72433
Buggy source:
public Object getSummaryValue(){
  if (count <= 1)   return null;
  Number ret=null;
  try {
    ret=calculator.divide(calculator.subtract(calculator.multiply(count,squareSum),calculator.multiply(sum,sum)),calculator.multiply(count,calculator.subtract(count,1)));
    return calculator.getTypedObject(Math.sqrt(ret.doubleValue()));
  }
 catch (  DataException e) {
    return null;
  }
}

Fixed version (ground truth):
public Object getSummaryValue(){
  if (count <= 1)   return null;
  Number ret=null;
  try {
    ret=calculator.divide(calculator.subtract(calculator.multiply(count,squareSum),calculator.multiply(sum,sum)),calculator.multiply(count,calculator.subtract(count,1)));
    return calculator.add(0,Math.sqrt(ret.doubleValue()));
  }
 catch (  DataException e) {
    return null;
  }
}
Program: 72434
Project: 72434
Buggy source:
/** 
 * constructor
 */
public LauncherEngineConfig(){
  super();
  HTMLRenderOption emitterConfig=(HTMLRenderOption)getEmitterConfigs().get(RenderOption.OUTPUT_FORMAT_HTML);
  emitterConfig.setImageHandler(new HTMLCompleteImageHandler());
}

Fixed version (ground truth):
/** 
 * constructor
 */
public LauncherEngineConfig(){
  super();
  HTMLRenderOption emitterConfig=(HTMLRenderOption)getEmitterConfigs().get(RenderOption.OUTPUT_FORMAT_HTML);
  if (emitterConfig == null) {
    emitterConfig=new HTMLRenderOption();
  }
  emitterConfig.setActionHandler(new HTMLActionHandler(){
    public String getURL(    IAction actionDefn,    Object context){
      if (actionDefn.getType() == IAction.ACTION_DRILLTHROUGH)       return "String_Node_Str" + URLEncoder.encode(super.getURL(actionDefn,context));
      return super.getURL(actionDefn,context);
    }
  }
);
  emitterConfig.setImageDirectory(IMAGE_PATH);
  getEmitterConfigs().put(RenderOption.OUTPUT_FORMAT_HTML,emitterConfig);
}
Program: 72435
Project: 72435
Buggy source:
private void configEngine(){
  HTMLRenderOption emitterConfig=new HTMLRenderOption();
  emitterConfig.setActionHandler(new HTMLActionHandler(){
    public String getURL(    IAction actionDefn,    Object context){
      if (actionDefn.getType() == IAction.ACTION_DRILLTHROUGH)       return "String_Node_Str" + URLEncoder.encode(super.getURL(actionDefn,context));
      return super.getURL(actionDefn,context);
    }
  }
);
  engineConfig.getEmitterConfigs().put(RenderOption.OUTPUT_FORMAT_HTML,emitterConfig);
  String userClassPath=getUserClassPath();
  logger.info("String_Node_Str" + userClassPath);
  System.clearProperty(EngineConstants.PROJECT_CLASSPATH_KEY);
  if (userClassPath != null) {
    engineConfig.getAppContext().put(EngineConstants.PROJECT_CLASSPATH_KEY,userClassPath);
    System.setProperty(EngineConstants.PROJECT_CLASSPATH_KEY,userClassPath);
  }
}

Fixed version (ground truth):
private void configEngine(){
  String userClassPath=getUserClassPath();
  logger.info("String_Node_Str" + userClassPath);
  System.clearProperty(EngineConstants.PROJECT_CLASSPATH_KEY);
  if (userClassPath != null) {
    engineConfig.getAppContext().put(EngineConstants.PROJECT_CLASSPATH_KEY,userClassPath);
    System.setProperty(EngineConstants.PROJECT_CLASSPATH_KEY,userClassPath);
  }
}
Program: 72436
Project: 72436
Buggy source:
boolean finalLaunchCheck(final ILaunchConfiguration configuration,String mode,IProgressMonitor monitor) throws CoreException {
  paramValues=new HashMap();
  LauncherEngineConfig engineConfig=new LauncherEngineConfig();
  IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
  final IReportEngine engine=factory.createReportEngine(engineConfig);
  engine.changeLogLevel(Level.WARNING);
  configEngine(engineConfig);
  final String fileName=covertVariables(configuration.getAttribute(ATTR_REPORT_FILE_NAME,"String_Node_Str"));
  final int taskType=configuration.getAttribute(ATTR_TASK_TYPE,DEFAULT_TASK_TYPE);
  Display display=DebugUI.getStandardDisplay();
  if (display.getThread().equals(Thread.currentThread())) {
    return getParameterValues(getInputParameters(fileName,taskType,engine),paramValues);
  }
  final Object[] result=new Object[]{Boolean.FALSE};
  Runnable r=new Runnable(){
    public void run(){
      result[0]=new Boolean(getParameterValues(getInputParameters(fileName,taskType,engine),paramValues));
    }
  }
;
  DebugUI.getStandardDisplay().syncExec(r);
  return ((Boolean)result[0]).booleanValue();
}

Fixed version (ground truth):
boolean finalLaunchCheck(final ILaunchConfiguration configuration,String mode,IProgressMonitor monitor) throws CoreException {
  paramValues=new HashMap();
  LauncherEngineConfig engineConfig=new LauncherEngineConfig();
  IReportEngineFactory factory=(IReportEngineFactory)Platform.createFactoryObject(IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY);
  final IReportEngine engine=factory.createReportEngine(engineConfig);
  engine.changeLogLevel(Level.WARNING);
  final String fileName=covertVariables(configuration.getAttribute(ATTR_REPORT_FILE_NAME,"String_Node_Str"));
  final int taskType=configuration.getAttribute(ATTR_TASK_TYPE,DEFAULT_TASK_TYPE);
  Display display=DebugUI.getStandardDisplay();
  if (display.getThread().equals(Thread.currentThread())) {
    return getParameterValues(getInputParameters(fileName,taskType,engine),paramValues);
  }
  final Object[] result=new Object[]{Boolean.FALSE};
  Runnable r=new Runnable(){
    public void run(){
      result[0]=new Boolean(getParameterValues(getInputParameters(fileName,taskType,engine),paramValues));
    }
  }
;
  DebugUI.getStandardDisplay().syncExec(r);
  return ((Boolean)result[0]).booleanValue();
}
Program: 72442
Project: 72442
Buggy source:
public Object get(String arg0,Scriptable scope){
  try {
    if (ScriptConstants.OUTER_RESULT_KEYWORD.equals(arg0))     return cursor.getObject(ScriptConstants.OUTER_RESULT_KEYWORD);
    return cursor.getObject(arg0);
  }
 catch (  OLAPException e) {
    return null;
  }
}

Fixed version (ground truth):
public Object get(String arg0,Scriptable scope){
  try {
    if (ScriptConstants.OUTER_RESULT_KEYWORD.equals(arg0))     return cursor.getObject(ScriptConstants.OUTER_RESULT_KEYWORD);
    return cursor.getObject(arg0);
  }
 catch (  OLAPException e) {
    throw Context.reportRuntimeError(e.getLocalizedMessage());
  }
}
Program: 72443
Project: 72443
Buggy source:
/** 
 * constructor
 * @param page the viewer
 * @param registry the registry
 */
public LibraryExplorerContextMenuProvider(LibraryExplorerTreeViewPage page){
  super(page.getTreeViewer());
  this.page=page;
  clipboard=new Clipboard(page.getSite().getShell().getDisplay());
  refreshExplorerAction=new RefreshResourceExplorerAction(page);
  useLibraryAction=new AddSelectedLibToCurrentReportDesignAction(page.getTreeViewer());
  deleteLibraryandCssAction=new DeleteResourceAction(page);
  addResourceAction=new AddResourceAction(page);
  renameLibraryandCssAction=new RenameResourceAction(page);
  newFolderAction=new NewFolderAction(page);
  moveLibraryandCssAction=new MoveResourceAction(page);
  newLibraryAction=new NewLibraryAction(page);
  copyLibraryandCssAction=new CopyResourceAction(page,clipboard);
  pasteLibraryandCssAction=new PasteResourceAction(page,clipboard);
}

Fixed version (ground truth):
/** 
 * constructor
 * @param page the viewer
 * @param registry the registry
 */
public LibraryExplorerContextMenuProvider(LibraryExplorerTreeViewPage page){
  super(page.getTreeViewer());
  this.page=page;
  clipboard=new Clipboard(page.getSite().getShell().getDisplay());
  refreshExplorerAction=new RefreshResourceExplorerAction(page);
  useLibraryAction=new AddSelectedLibToCurrentReportDesignAction(page.getTreeViewer());
  deleteLibraryandCssAction=new DeleteResourceAction(page);
  addResourceAction=new AddResourceAction(page);
  renameLibraryandCssAction=new RenameResourceAction(page);
  newFolderAction=new NewFolderAction(page);
  moveLibraryandCssAction=new MoveResourceAction(page);
  newLibraryAction=new NewLibraryAction(page);
  copyLibraryandCssAction=new CopyResourceAction(page,clipboard);
  pasteLibraryandCssAction=new PasteResourceAction(page,clipboard);
  newMenuGroup.add(newFolderAction);
  newMenuGroup.add(newLibraryAction);
}
Program: 72445
Project: 72445
Buggy source:
public void addData(int col,Object data){
  if ((getColumnSize(col) < height) && (col < getColumnCount())) {
    ((List)columns.get(col)).add(data);
  }
  if (data instanceof Data) {
    BookmarkDef bookmark=((Data)data).getBookmark();
    if (null == bookmark) {
      return;
    }
    int rowNo=((Integer)colrow.get(new Integer(col))).intValue() + getColumnSize(col);
    bookmark.setColumnNo(col + 1);
    bookmark.setRowNo(rowNo);
    bookmarks.add(bookmark);
  }
}

Fixed version (ground truth):
public void addData(int col,Object data){
  List column=(List)columns.get(col);
  column.add(data);
  if (data instanceof Data) {
    BookmarkDef bookmark=((Data)data).getBookmark();
    if (null == bookmark) {
      return;
    }
    int rowNo=((Integer)colrow.get(new Integer(col))).intValue() + getColumnSize(col);
    bookmark.setColumnNo(col + 1);
    bookmark.setRowNo(rowNo);
    bookmarks.add(bookmark);
  }
}
Program: 72446
Project: 72446
Buggy source:
public DataCache(int height,int width){
  Integer start=new Integer(0);
  columns.add(new ArrayList());
  colrow.put(start,start);
  this.height=height;
  this.width=width;
}

Fixed version (ground truth):
public DataCache(int width){
  Integer start=new Integer(0);
  columns.add(new ArrayList());
  colrow.put(start,start);
  this.width=width;
}
Program: 72447
Project: 72447
Buggy source:
public void end(IReportContent report){
  engine.complete();
  ExcelWriter writer=new ExcelWriter(out,context);
  writer.writeDeclarations();
  writer.writeDocumentProperties(report);
  writer.declareStyles(engine.getStyleMap());
  writer.defineNames(engine.getNamesRefer());
  writer.startSheet(1);
  writer.startTable(engine.getCoordinates());
  int count=0;
  while (count < engine.getRowCount()) {
    outputData(engine.getRow(count),writer);
    count++;
  }
  writer.endTable();
  writer.closeSheet();
  writer.close(true);
}

Fixed version (ground truth):
public void end(IReportContent report){
  engine.complete();
  ExcelWriter writer=new ExcelWriter(out,context);
  writer.writeDeclarations();
  writer.writeDocumentProperties(report);
  writer.declareStyles(engine.getStyleMap());
  writer.defineNames(engine.getNamesRefer());
  startSheet(writer);
  int count=0;
  while (count < engine.getRowCount()) {
    if ((count % (engine.MAX_ROW + 1)) == 0 && count != 0) {
      endSheet(writer);
      startSheet(writer);
    }
    outputData(engine.getRow(count),writer);
    count++;
  }
  endSheet(writer);
  writer.close(true);
  sheetIndex=1;
}
Program: 72448
Project: 72448
Buggy source:
private void initalize(PageDef page){
  axis=new AxisProcessor();
  axis.addCoordinate(page.contentwidth);
  setCacheSize();
  Rule rule=new Rule(0,page.contentwidth);
  cache=new DataCache(MAX_ROW,MAX_COLUMN);
  engine=new StyleEngine(this);
  containers.push(createContainer(rule,page.style));
}

Fixed version (ground truth):
private void initalize(PageDef page){
  axis=new AxisProcessor();
  axis.addCoordinate(page.contentwidth);
  setCacheSize();
  Rule rule=new Rule(0,page.contentwidth);
  cache=new DataCache(MAX_COLUMN);
  engine=new StyleEngine(this);
  containers.push(createContainer(rule,page.style));
}
Program: 72449
Project: 72449
Buggy source:
public int getRowCount(){
  int realcount=cache.getMaxRow();
  return Math.min(realcount,MAX_ROW - 1);
}

Fixed version (ground truth):
public int getRowCount(){
  int realcount=cache.getMaxRow();
  return realcount;
}
Program: 72450
Project: 72450
Buggy source:
private void calculateText(){
  if (blankLine) {
    this.text=null;
  }
 else {
    this.text=textContent.getText().substring(offset,offset + textLength);
  }
}

Fixed version (ground truth):
private void calculateText(){
  if (blankLine) {
    this.text="String_Node_Str";
  }
 else {
    this.text=textContent.getText().substring(offset,offset + textLength);
  }
}
Program: 72451
Project: 72451
Buggy source:
protected boolean layoutChildren(){
  if (null == textContent)   return false;
  while (comp.hasNextArea()) {
    TextArea area=comp.getNextArea(getFreeSpace());
    if (!area.isBlankLine()) {
      addTextArea(area);
      comp.setNewLineStatus(false);
    }
    if (area.isLineBreak()) {
      if (newLine()) {
        comp.setNewLineStatus(true);
      }
 else {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean layoutChildren(){
  if (null == textContent)   return false;
  while (comp.hasNextArea()) {
    TextArea area=comp.getNextArea(getFreeSpace());
    addTextArea(area);
    comp.setNewLineStatus(false);
    if (area.isLineBreak()) {
      if (newLine()) {
        comp.setNewLineStatus(true);
      }
 else {
        return true;
      }
    }
  }
  return false;
}
Program: 72452
Project: 72452
Buggy source:
/** 
 * layout a word, add the word to the line buffer.
 * @param word the word
 */
private void addWordIntoTextArea(TextArea textArea,Word word){
  int textLength=word.getLength();
  int wordWidth=getWordWidth(fontInfo,word);
  wordWidth+=letterSpacing * textLength;
  if (textArea.hasSpace(wordWidth)) {
    addWord(textArea,textLength,wordWidth);
    wordVestige=null;
    if (remainWords.hasWord()) {
      if (textArea.hasSpace(wordSpacing)) {
        textArea.addWordSpacing(wordSpacing);
      }
 else {
        textArea.setLineBreak(true);
        hasLineBreak=true;
      }
    }
  }
 else {
    if (isNewLine && textArea.isEmpty()) {
      if (hyphenation) {
        doHyphenation(word.getValue(),textArea);
      }
 else {
        addWord(textArea,textLength,wordWidth);
        wordVestige=null;
      }
    }
 else {
      wordVestige=null;
      remainWord=word;
    }
    textArea.setLineBreak(true);
    hasLineBreak=true;
  }
}

Fixed version (ground truth):
/** 
 * layout a word, add the word to the line buffer.
 * @param word the word
 */
private void addWordIntoTextArea(TextArea textArea,Word word){
  int textLength=word.getLength();
  int wordWidth=getWordWidth(fontInfo,word);
  wordWidth+=letterSpacing * textLength;
  if (textArea.hasSpace(wordWidth)) {
    addWord(textArea,textLength,wordWidth);
    if (remainWords.hasWord()) {
      if (textArea.hasSpace(wordSpacing)) {
        textArea.addWordSpacing(wordSpacing);
      }
 else {
        textArea.setLineBreak(true);
        hasLineBreak=true;
      }
    }
  }
 else {
    if (isNewLine && textArea.isEmpty()) {
      if (hyphenation) {
        doHyphenation(word.getValue(),textArea);
      }
 else {
        addWord(textArea,textLength,wordWidth);
      }
    }
 else {
      wordVestige=null;
      remainWord=word;
    }
    textArea.setLineBreak(true);
    hasLineBreak=true;
  }
}
Program: 72453
Project: 72453
Buggy source:
private void doHyphenation(String str,TextArea area){
  IHyphenationManager hm=new DefaultHyphenationManager();
  Hyphenation hyph=hm.getHyphenation(str);
  FontInfo fi=area.getFontInfo();
  int endHyphenIndex=hyphen(0,area.getMaxWidth() - area.getWidth(),hyph,fi);
  if (endHyphenIndex == 0 && area.getWidth() == 0 && area.getMaxWidth() == 0) {
    addWord(area,1,getTextWidth(fi,hyph.getHyphenText(0,1)));
    wordVestige=new Word(str,1,str.length());
  }
 else {
    addWord(area,endHyphenIndex,getTextWidth(fi,hyph.getHyphenText(0,endHyphenIndex)) + letterSpacing * (endHyphenIndex - 1));
    wordVestige=new Word(str,endHyphenIndex,str.length());
  }
}

Fixed version (ground truth):
private void doHyphenation(String str,TextArea area){
  IHyphenationManager hm=new DefaultHyphenationManager();
  Hyphenation hyph=hm.getHyphenation(str);
  FontInfo fi=area.getFontInfo();
  if (area.getMaxWidth() < 0) {
    addWordVestige(area,1,getTextWidth(fi,hyph.getHyphenText(0,1)),str.substring(1,str.length()));
    return;
  }
  int endHyphenIndex=hyphen(0,area.getMaxWidth() - area.getWidth(),hyph,fi);
  if (endHyphenIndex == 0 && area.getWidth() == 0) {
    addWordVestige(area,1,getTextWidth(fi,hyph.getHyphenText(0,1)),str.substring(1,str.length()));
  }
 else {
    addWordVestige(area,endHyphenIndex,getTextWidth(fi,hyph.getHyphenText(0,endHyphenIndex)) + letterSpacing * (endHyphenIndex - 1),str.substring(endHyphenIndex,str.length()));
  }
}
Program: 72454
Project: 72454
Buggy source:
public static double convertTo(DimensionType value){
  if (value == null || DimensionType.UNITS_PERCENTAGE.equalsIgnoreCase(value.getUnits())) {
    return -1;
  }
  if (DimensionType.UNITS_PX.equalsIgnoreCase(value.getUnits())) {
    return value.getMeasure() * PX_TWIPS;
  }
  double val=value.convertTo(DimensionType.UNITS_IN);
  return val * INCH_TWIPS;
}

Fixed version (ground truth):
public static double convertTo(DimensionType value){
  if (value == null || DimensionType.UNITS_PERCENTAGE.equalsIgnoreCase(value.getUnits())) {
    return -1;
  }
  if (DimensionType.UNITS_PX.equalsIgnoreCase(value.getUnits())) {
    return value.getMeasure() * PX_TWIPS;
  }
  if (DimensionType.UNITS_EM.equalsIgnoreCase(value.getUnits()) || DimensionType.UNITS_EX.equalsIgnoreCase(value.getUnits())) {
    return value.getMeasure() * 12 * PT_TWIPS;
  }
  double val=value.convertTo(DimensionType.UNITS_IN);
  return val * INCH_TWIPS;
}
Program: 72455
Project: 72455
Buggy source:
private void outputNamedImageSource(String name,ImageSource imageSource){
  out.println('/' + name + "String_Node_Str");
  int count=outputImageSource(imageSource,"String_Node_Str","String_Node_Str");
  out.print("String_Node_Str" + count + "String_Node_Str");
  out.println(imageSource.getWidth() + "String_Node_Str" + imageSource.getHeight()+ "String_Node_Str");
}

Fixed version (ground truth):
private void outputNamedImageSource(String name,ArrayImageSource imageSource){
  out.println('/' + name + "String_Node_Str");
  int count=outputImageSource(imageSource,"String_Node_Str","String_Node_Str");
  out.print("String_Node_Str" + count + "String_Node_Str");
  out.println(imageSource.getWidth() + "String_Node_Str" + imageSource.getHeight()+ "String_Node_Str");
}