nus-yam/ex-repair huggingface dataset:
Program: 76749
Project: 76749
Buggy source:
/** 
 * Returns specified command
 * @param commandType command type, value is <code>TYPE_CUT</code> or <code>TYPE_COPY</code>
 * @param transferSource transfer source
 * @param newContainer the new container
 * @param position the position will be added
 * @return command
 */
protected static Command getNewCommand(String commandType,Object transferSource,Object newContainer,int position){
  boolean isCut=TYPE_CUT.equals(commandType);
  if (newContainer instanceof ParameterGroupHandle && (transferSource instanceof ParameterGroupHandle || DEUtil.isParameterGroup(transferSource))) {
    return pasteParameterGroup(commandType,transferSource,(ParameterGroupHandle)newContainer);
  }
 else   if (transferSource instanceof DesignElementHandle) {
    return new PasteCommand((DesignElementHandle)transferSource,newContainer,position,isCut);
  }
 else   if (transferSource instanceof IDesignElement) {
    return new PasteCommand((IDesignElement)transferSource,newContainer,position);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns specified command
 * @param commandType command type, value is <code>TYPE_CUT</code> or <code>TYPE_COPY</code>
 * @param transferSource transfer source
 * @param newContainer the new container
 * @param position the position will be added
 * @return command
 */
protected static Command getNewCommand(String commandType,Object transferSource,Object newContainer,int position) throws SemanticException {
  boolean isCut=TYPE_CUT.equals(commandType);
  if (newContainer instanceof ParameterGroupHandle && (transferSource instanceof ParameterGroupHandle || DEUtil.isParameterGroup(transferSource))) {
    return pasteParameterGroup(commandType,transferSource,(ParameterGroupHandle)newContainer);
  }
 else   if (transferSource instanceof DesignElementHandle) {
    return new PasteCommand((DesignElementHandle)transferSource,newContainer,position,isCut);
  }
 else   if (transferSource instanceof IDesignElement) {
    return new PasteCommand((IDesignElement)transferSource,newContainer,position);
  }
  return null;
}
Program: 76750
Project: 76750
Buggy source:
protected static void addCommandToCompound(Object transferData,Object targetObj,int position,String commandName,String commandType,CompoundCommand commands){
  if (transferData instanceof SlotHandle) {
    transferData=transferSlotHandle(commandType,transferData);
  }
  if (transferData instanceof Object[]) {
    Object[] array=(Object[])transferData;
    for (int i=0; i < array.length; i++) {
      if (array[i] instanceof EmbeddedImageHandle) {
        if (((EmbeddedImageHandle)array[i]).getElementHandle().getRoot() instanceof LibraryHandle) {
          try {
            array[i]=StructureFactory.newEmbeddedImageFrom((EmbeddedImageHandle)array[i],SessionHandleAdapter.getInstance().getReportDesignHandle());
          }
 catch (          LibraryException e) {
          }
        }
      }
      addCommandToCompound(array[i],targetObj,position,commandName,commandType,commands);
      if (position > -1) {
        position++;
      }
    }
  }
 else   if (transferData instanceof DesignElementHandle || transferData instanceof IDesignElement) {
    if (targetObj instanceof DesignElementHandle || targetObj instanceof SlotHandle) {
      commands.add(getNewCommand(commandType,transferData,targetObj,position));
    }
  }
 else   if (transferData instanceof IStructure) {
    commands.add(new PasteStructureCommand((IStructure)transferData,targetObj));
  }
 else   if (transferData instanceof StructureHandle) {
    commands.add(new PasteStructureCommand(((StructureHandle)transferData).getStructure(),targetObj));
  }
}

Fixed version (ground truth):
protected static void addCommandToCompound(Object transferData,Object targetObj,int position,String commandName,String commandType,CompoundCommand commands) throws SemanticException {
  if (transferData instanceof SlotHandle) {
    transferData=transferSlotHandle(commandType,transferData);
  }
  if (transferData instanceof Object[]) {
    Object[] array=(Object[])transferData;
    for (int i=0; i < array.length; i++) {
      if (array[i] instanceof EmbeddedImageHandle) {
        if (((EmbeddedImageHandle)array[i]).getElementHandle().getRoot() instanceof LibraryHandle) {
          try {
            array[i]=StructureFactory.newEmbeddedImageFrom((EmbeddedImageHandle)array[i],SessionHandleAdapter.getInstance().getReportDesignHandle());
          }
 catch (          LibraryException e) {
          }
        }
      }
      addCommandToCompound(array[i],targetObj,position,commandName,commandType,commands);
      if (position > -1) {
        position++;
      }
    }
  }
 else   if (transferData instanceof DesignElementHandle || transferData instanceof IDesignElement) {
    if (targetObj instanceof DesignElementHandle || targetObj instanceof SlotHandle) {
      commands.add(getNewCommand(commandType,transferData,targetObj,position));
    }
  }
 else   if (transferData instanceof IStructure) {
    commands.add(new PasteStructureCommand((IStructure)transferData,targetObj));
  }
 else   if (transferData instanceof StructureHandle) {
    commands.add(new PasteStructureCommand(((StructureHandle)transferData).getStructure(),targetObj));
  }
}
Program: 76751
Project: 76751
Buggy source:
/** 
 * @param transferSource
 * @return true if parameter is parameter group.
 */
public static boolean isParameterGroup(Object transferSource){
  return (transferSource instanceof IDesignElement && ((IDesignElement)transferSource).getDefn().getName().equals(ReportDesignConstants.PARAMETER_GROUP_ELEMENT));
}

Fixed version (ground truth):
/** 
 * @param transferSource
 * @return true if parameter is parameter group.
 */
public static boolean isParameterGroup(Object transferSource){
  return (transferSource instanceof IDesignElement && (((IDesignElement)transferSource).getDefn().getName().equals(ReportDesignConstants.PARAMETER_GROUP_ELEMENT) || ((IDesignElement)transferSource).getDefn().getName().equals(ReportDesignConstants.CASCADING_PARAMETER_GROUP_ELEMENT)));
}
Program: 76753
Project: 76753
Buggy source:
public void focusLost(FocusEvent e){
  if (UIUtil.convertToModelString(keyChooser.getText(),true) != null && UIUtil.convertToModelString(tocEditor.getText(),true) == null) {
    tocEditor.setText(getKeyExpression());
    keyChooser.removeFocusListener(focusListener);
    focusListener=null;
  }
}

Fixed version (ground truth):
public void focusLost(FocusEvent e){
  String key=UIUtil.convertToModelString(keyChooser.getText(),true);
  if (key != null && keyChooser.indexOf(key) != -1) {
    String tocExp=DEUtil.getExpression(columnList.get(keyChooser.indexOf(key)));
    if (!tocEditor.getText().equals(tocExp)) {
      tocEditor.setText(tocExp);
      return;
    }
  }
}
Program: 76755
Project: 76755
Buggy source:
private String getKeyExpression(){
  String exp=null;
  if (keyChooser.getSelectionIndex() != -1) {
    exp=DEUtil.getExpression(columnList.get(keyChooser.getSelectionIndex()));
  }
 else {
    exp=keyChooser.getText().trim();
  }
  return exp;
}

Fixed version (ground truth):
private String getKeyExpression(){
  String exp=null;
  String keyText=UIUtil.convertToModelString(keyChooser.getText(),true);
  if (keyChooser.getSelectionIndex() != -1) {
    exp=DEUtil.getExpression(columnList.get(keyChooser.getSelectionIndex()));
  }
 else   if (keyChooser.indexOf(keyText) != -1) {
    exp=DEUtil.getExpression(columnList.get(keyChooser.indexOf(keyText)));
  }
 else {
    exp=keyChooser.getText().trim();
  }
  return exp;
}
Program: 76756
Project: 76756
Buggy source:
/** 
 * Initializes all member variables within this object recursively Note: Manually written
 */
protected final void initialize(){
  super.initialize();
  Marker sm=MarkerImpl.create(MarkerType.NABLA_LITERAL,4);
  setStartMarker(sm);
  Marker em=MarkerImpl.create(MarkerType.NABLA_LITERAL,4);
  setEndMarker(em);
  setStartMarkerPosition(Position.BELOW_LITERAL);
  setEndMarkerPosition(Position.ABOVE_LITERAL);
  setLabelPosition(Position.ABOVE_LITERAL);
  LineAttributes la=LineAttributesImpl.create(ColorDefinitionImpl.BLACK(),LineStyle.SOLID_LITERAL,1);
  setConnectionLine(la);
  la=LineAttributesImpl.create(ColorDefinitionImpl.BLACK(),LineStyle.SOLID_LITERAL,1);
  la.setVisible(false);
  setOutline(la);
  Label lb=LabelImpl.create();
  setDecorationLabel(lb);
}

Fixed version (ground truth):
/** 
 * Initializes all member variables within this object recursively Note: Manually written
 */
protected final void initialize(){
  super.initialize();
  Marker sm=MarkerImpl.create(MarkerType.NABLA_LITERAL,4);
  sm.setVisible(false);
  setStartMarker(sm);
  Marker em=MarkerImpl.create(MarkerType.NABLA_LITERAL,4);
  setEndMarker(em);
  em.setVisible(false);
  setStartMarkerPosition(Position.BELOW_LITERAL);
  setEndMarkerPosition(Position.ABOVE_LITERAL);
  setLabelPosition(Position.ABOVE_LITERAL);
  LineAttributes la=LineAttributesImpl.create(ColorDefinitionImpl.BLACK(),LineStyle.SOLID_LITERAL,8);
  this.setPaletteLineColor(true);
  setConnectionLine(la);
  la=LineAttributesImpl.create(ColorDefinitionImpl.BLACK(),LineStyle.SOLID_LITERAL,1);
  la.setVisible(true);
  setOutline(la);
  Label lb=LabelImpl.create();
  setDecorationLabel(lb);
}
Program: 76759
Project: 76759
Buggy source:
protected void closeLayout(){
  if (root == null) {
    return;
  }
  IStyle areaStyle=root.getStyle();
  if (!isLast) {
    areaStyle.setProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH,IStyle.NUMBER_0);
    areaStyle.setProperty(IStyle.STYLE_PADDING_BOTTOM,IStyle.NUMBER_0);
    areaStyle.setProperty(IStyle.STYLE_MARGIN_BOTTOM,IStyle.NUMBER_0);
  }
  root.setHeight(getCurrentBP() + getOffsetY() + getDimensionValue(areaStyle.getProperty(StyleConstants.STYLE_PADDING_BOTTOM))+ getDimensionValue(areaStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH)));
}

Fixed version (ground truth):
protected void closeLayout(){
  if (root == null) {
    return;
  }
  IStyle areaStyle=root.getStyle();
  if (!isLast) {
    areaStyle.setProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH,IStyle.NUMBER_0);
    areaStyle.setProperty(IStyle.STYLE_PADDING_BOTTOM,IStyle.NUMBER_0);
    areaStyle.setProperty(IStyle.STYLE_MARGIN_BOTTOM,IStyle.NUMBER_0);
  }
  int height=getCurrentBP() + getOffsetY() + getDimensionValue(areaStyle.getProperty(StyleConstants.STYLE_PADDING_BOTTOM))+ getDimensionValue(areaStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH));
  if (isFirst && isLast) {
    calculateSpecifiedHeight();
    if (specifiedHeight > height) {
      CSSValue verticalAlign=areaStyle.getProperty(IStyle.STYLE_VERTICAL_ALIGN);
      if (IStyle.BOTTOM_VALUE.equals(verticalAlign) || IStyle.MIDDLE_VALUE.equals(verticalAlign)) {
        int offset=specifiedHeight - height;
        if (IStyle.BOTTOM_VALUE.equals(verticalAlign)) {
          Iterator iter=root.getChildren();
          while (iter.hasNext()) {
            AbstractArea child=(AbstractArea)iter.next();
            child.setAllocatedPosition(child.getAllocatedX(),child.getAllocatedY() + offset);
          }
        }
 else         if (IStyle.MIDDLE_VALUE.equals(verticalAlign)) {
          Iterator iter=root.getChildren();
          while (iter.hasNext()) {
            AbstractArea child=(AbstractArea)iter.next();
            child.setAllocatedPosition(child.getAllocatedX(),child.getAllocatedY() + offset / 2);
          }
        }
      }
      height=specifiedHeight;
    }
  }
  root.setHeight(height);
}
Program: 76760
Project: 76760
Buggy source:
/** 
 * Creates a PdfAction.
 * @param hyperlink			the hyperlink.
 * @param bookmark			the bookmark.
 * @param target			if target equals "_blank", the target will be opened in a new window,else the target will be opened in the current window.
 * @return					the created PdfAction.
 */
private PdfAction createPdfAction(String hyperlink,String bookmark,String target,int type){
  if ("String_Node_Str".equalsIgnoreCase(target)) {
    return new PdfAction(hyperlink);
  }
 else {
    if (type == IHyperlinkAction.ACTION_BOOKMARK) {
      return PdfAction.gotoLocalPage(bookmark,false);
    }
 else {
      if (type == IHyperlinkAction.ACTION_HYPERLINK) {
        return PdfAction.gotoRemotePage(hyperlink,bookmark,false,false);
      }
 else {
        return new PdfAction(hyperlink);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a PdfAction.
 * @param hyperlink			the hyperlink.
 * @param bookmark			the bookmark.
 * @param target			if target equals "_blank", the target will be opened in a new window,else the target will be opened in the current window.
 * @return					the created PdfAction.
 */
private PdfAction createPdfAction(String hyperlink,String bookmark,String target,int type){
  if ("String_Node_Str".equalsIgnoreCase(target)) {
    return new PdfAction(hyperlink);
  }
 else {
    if (type == IHyperlinkAction.ACTION_BOOKMARK) {
      return PdfAction.gotoLocalPage(bookmark,false);
    }
 else {
      return PdfAction.gotoRemotePage(hyperlink,bookmark,false,false);
    }
  }
}
Program: 76763
Project: 76763
Buggy source:
/** 
 * Build size style string say, "width: 10.0mm;".
 * @param content The <code>StringBuffer</code> to which the result is output.
 * @param name The property name
 * @param value The values of the property
 */
public static void buildSize(StringBuffer content,String name,DimensionType value){
  if (value != null) {
    if (HTMLTags.ATTR_MIN_HEIGHT.equals(name)) {
      addPropName(content,HTMLTags.ATTR_MIN_HEIGHT);
      addPropValue(content,"String_Node_Str");
      content.append(';');
      addPropName(content,HTMLTags.ATTR_HEIGHT);
      addPropValue(content,value.toString());
      content.append(';');
      addPropName(content,HTMLTags.ATTR_MIN_HEIGHT);
      addPropValue(content,value.toString());
      content.append(';');
    }
 else {
      addPropName(content,name);
      addPropValue(content,value.toString());
      content.append(';');
    }
  }
}

Fixed version (ground truth):
/** 
 * Build size style string say, "width: 10.0mm;".
 * @param content The <code>StringBuffer</code> to which the result is output.
 * @param name The property name
 * @param value The values of the property
 */
public static void buildSize(StringBuffer content,String name,DimensionType value){
  if (value != null) {
    if (HTMLTags.ATTR_MIN_HEIGHT.equals(name)) {
      addPropName(content,HTMLTags.ATTR_HEIGHT);
      addPropValue(content,"String_Node_Str");
      content.append(';');
      addPropName(content,HTMLTags.ATTR_HEIGHT);
      addPropValue(content,value.toString());
      content.append(';');
      addPropName(content,HTMLTags.ATTR_MIN_HEIGHT);
      addPropValue(content,value.toString());
      content.append(';');
    }
 else {
      addPropName(content,name);
      addPropValue(content,value.toString());
      content.append(';');
    }
  }
}
Program: 76766
Project: 76766
Buggy source:
public void test_sortOnGroupKey() throws Exception {
  String sqlStatement="String_Node_Str" + getTestTableName();
  ((OdaDataSetDesign)this.dataSet).setQueryText(sqlStatement);
  IBaseExpression[] expressions=new IBaseExpression[]{new ScriptExpression("String_Node_Str",0),new ScriptExpression("String_Node_Str",2)};
  GroupDefinition[] groupDefn=new GroupDefinition[]{new GroupDefinition()};
}

Fixed version (ground truth):
public void test_sortOnGroupKey() throws Exception {
  String sqlStatement="String_Node_Str" + getTestTableName();
  ((OdaDataSetDesign)this.dataSet).setQueryText(sqlStatement);
}
Program: 76769
Project: 76769
Buggy source:
/** 
 * Convert string to date with check. JDK may do incorrect converse, for example: 2005/1/1 Local.US, format pattern is MM/dd/YY. Above conversion can be done without error, but obviously the result is not right. This method will do such a simple check, in DateFormat.SHORT case instead of all cases. Year is not lower than 0. Month is from 1 to 12. Day is from 1 to 31.  
 * @param source
 * @param locale
 * @return Date
 * @throws BirtException
 */
public static Date toDateWithCheck(String source,ULocale locale) throws BirtException {
  DateFormat dateFormat=DateFormatHolder.getDateInstance(DateFormat.SHORT,locale);
  Date resultDate=null;
  try {
    resultDate=dateFormat.parse(source);
  }
 catch (  ParseException e) {
    return toDate(source,locale);
  }
  if (DateUtil.checkValid(dateFormat,source) == false) {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
  return resultDate;
}

Fixed version (ground truth):
/** 
 * Convert string to date with check. JDK may do incorrect converse, for example: 2005/1/1 Local.US, format pattern is MM/dd/YY. Above conversion can be done without error, but obviously the result is not right. This method will do such a simple check, in DateFormat.SHORT case instead of all cases. Year is not lower than 0. Month is from 1 to 12. Day is from 1 to 31.  
 * @param source
 * @param locale
 * @return Date
 * @throws BirtException
 */
public static Date toDateWithCheck(String source,ULocale locale) throws BirtException {
  DateFormat dateFormat=DateFormatFactory.getDateInstance(DateFormat.SHORT,locale);
  Date resultDate=null;
  try {
    resultDate=dateFormat.parse(source);
  }
 catch (  ParseException e) {
    return toDate(source,locale);
  }
  if (DateUtil.checkValid(dateFormat,source) == false) {
    throw new CoreException(ResourceConstants.CONVERT_FAILS,new Object[]{source.toString(),"String_Node_Str"});
  }
  return resultDate;
}
Program: 76770
Project: 76770
Buggy source:
/** 
 * Handle IFrame definition
 * @return
 */
protected String __handleIFrameDefinition(){
  String iframe="String_Node_Str" + viewer.getId() + "String_Node_Str"+ viewer.getBorder()+ "String_Node_Str";
  if (viewer.getScrolling() != null)   iframe+="String_Node_Str" + viewer.getScrolling() + "String_Node_Str";
  iframe+=__handleAppearance() + "String_Node_Str";
  return iframe;
}

Fixed version (ground truth):
/** 
 * Handle IFrame definition
 * @return
 */
protected String __handleIFrameDefinition(){
  String iframe="String_Node_Str" + viewer.getId() + "String_Node_Str"+ viewer.getFrameborder()+ "String_Node_Str";
  if (viewer.getScrolling() != null)   iframe+="String_Node_Str" + viewer.getScrolling() + "String_Node_Str";
  iframe+=__handleAppearance() + "String_Node_Str";
  return iframe;
}
Program: 76771
Project: 76771
Buggy source:
/** 
 * DIV Appearance style
 * @return
 */
protected String __handleDivAppearance(){
  String style="String_Node_Str";
  if (viewer.getPosition() != null)   style+="String_Node_Str" + viewer.getPosition() + "String_Node_Str";
  if (viewer.getBorder() > 0)   style+="String_Node_Str" + viewer.getBorder() + "String_Node_Str";
  if (viewer.getHeight() >= 0)   style+="String_Node_Str" + viewer.getHeight() + "String_Node_Str";
  if (viewer.getWidth() >= 0)   style+="String_Node_Str" + viewer.getWidth() + "String_Node_Str";
  if (viewer.getTop() >= 0)   style+="String_Node_Str" + viewer.getTop() + "String_Node_Str";
  if (viewer.getLeft() >= 0)   style=style + "String_Node_Str" + viewer.getLeft()+ "String_Node_Str";
  if (SCROLLING_YES.equalsIgnoreCase(viewer.getScrolling())) {
    style=style + "String_Node_Str";
  }
 else   if (SCROLLING_AUTO.equalsIgnoreCase(viewer.getScrolling())) {
    style=style + "String_Node_Str";
  }
  if (viewer.getStyle() != null)   style+=viewer.getStyle() + "String_Node_Str";
  style+="String_Node_Str";
  return style;
}

Fixed version (ground truth):
/** 
 * DIV Appearance style
 * @return
 */
protected String __handleDivAppearance(){
  String style="String_Node_Str";
  if (viewer.getPosition() != null)   style+="String_Node_Str" + viewer.getPosition() + "String_Node_Str";
  if (viewer.getHeight() >= 0)   style+="String_Node_Str" + viewer.getHeight() + "String_Node_Str";
  if (viewer.getWidth() >= 0)   style+="String_Node_Str" + viewer.getWidth() + "String_Node_Str";
  if (viewer.getTop() >= 0)   style+="String_Node_Str" + viewer.getTop() + "String_Node_Str";
  if (viewer.getLeft() >= 0)   style=style + "String_Node_Str" + viewer.getLeft()+ "String_Node_Str";
  if (SCROLLING_YES.equalsIgnoreCase(viewer.getScrolling())) {
    style=style + "String_Node_Str";
  }
 else   if (SCROLLING_AUTO.equalsIgnoreCase(viewer.getScrolling())) {
    style=style + "String_Node_Str";
  }
  if (viewer.getStyle() != null)   style+=viewer.getStyle() + "String_Node_Str";
  style+="String_Node_Str";
  return style;
}
Program: 76772
Project: 76772
Buggy source:
/** 
 * Handle use IFrame to show parameter page.
 * @throws Exception
 */
protected void __handleIFrame() throws Exception {
  JspWriter writer=pageContext.getOut();
  String iframe="String_Node_Str";
  if (viewer.getId() != null)   iframe+="String_Node_Str" + viewer.getId() + "String_Node_Str";
  if (viewer.getName() != null)   iframe+="String_Node_Str" + viewer.getName() + "String_Node_Str";
  String src=viewer.createURI(IBirtConstants.VIEWER_PARAMETER) + "String_Node_Str" + ParameterAccessor.PARAM_NOCACHE_PARAMETER;
  iframe+="String_Node_Str" + src + "String_Node_Str";
  iframe+="String_Node_Str" + viewer.getBorder() + "String_Node_Str";
  if (viewer.getScrolling() != null)   iframe+="String_Node_Str" + viewer.getScrolling() + "String_Node_Str";
  iframe+=__handleAppearance() + "String_Node_Str";
  writer.write(iframe);
}

Fixed version (ground truth):
/** 
 * Handle use IFrame to show parameter page.
 * @throws Exception
 */
protected void __handleIFrame() throws Exception {
  JspWriter writer=pageContext.getOut();
  String iframe="String_Node_Str";
  if (viewer.getId() != null)   iframe+="String_Node_Str" + viewer.getId() + "String_Node_Str";
  if (viewer.getName() != null)   iframe+="String_Node_Str" + viewer.getName() + "String_Node_Str";
  String src=viewer.createURI(IBirtConstants.VIEWER_PARAMETER) + "String_Node_Str" + ParameterAccessor.PARAM_NOCACHE_PARAMETER;
  iframe+="String_Node_Str" + src + "String_Node_Str";
  iframe+="String_Node_Str" + viewer.getFrameborder() + "String_Node_Str";
  if (viewer.getScrolling() != null)   iframe+="String_Node_Str" + viewer.getScrolling() + "String_Node_Str";
  iframe+=__handleAppearance() + "String_Node_Str";
  writer.write(iframe);
}
Program: 76773
Project: 76773
Buggy source:
/** 
 * DIV Appearance style
 * @return
 */
protected String __handleDivAppearance(){
  String style="String_Node_Str";
  if (viewer.getPosition() != null)   style+="String_Node_Str" + viewer.getPosition() + "String_Node_Str";
  if (viewer.getBorder() > 0)   style+="String_Node_Str" + viewer.getBorder() + "String_Node_Str";
  if (viewer.getHeight() >= 0)   style+="String_Node_Str" + viewer.getHeight() + "String_Node_Str";
  if (viewer.getWidth() >= 0)   style+="String_Node_Str" + viewer.getWidth() + "String_Node_Str";
  if (viewer.getTop() >= 0)   style+="String_Node_Str" + viewer.getTop() + "String_Node_Str";
  if (viewer.getLeft() >= 0)   style=style + "String_Node_Str" + viewer.getLeft()+ "String_Node_Str";
  if (viewer.getScrolling() != null && SCROLLING_YES.equalsIgnoreCase(viewer.getScrolling())) {
    style=style + "String_Node_Str";
  }
 else {
    style=style + "String_Node_Str";
  }
  if (viewer.getStyle() != null)   style+=viewer.getStyle() + "String_Node_Str";
  style+="String_Node_Str";
  return style;
}

Fixed version (ground truth):
/** 
 * DIV Appearance style
 * @return
 */
protected String __handleDivAppearance(){
  String style="String_Node_Str";
  if (viewer.getPosition() != null)   style+="String_Node_Str" + viewer.getPosition() + "String_Node_Str";
  if (viewer.getHeight() >= 0)   style+="String_Node_Str" + viewer.getHeight() + "String_Node_Str";
  if (viewer.getWidth() >= 0)   style+="String_Node_Str" + viewer.getWidth() + "String_Node_Str";
  if (viewer.getTop() >= 0)   style+="String_Node_Str" + viewer.getTop() + "String_Node_Str";
  if (viewer.getLeft() >= 0)   style=style + "String_Node_Str" + viewer.getLeft()+ "String_Node_Str";
  if (viewer.getScrolling() != null && SCROLLING_YES.equalsIgnoreCase(viewer.getScrolling())) {
    style=style + "String_Node_Str";
  }
 else {
    style=style + "String_Node_Str";
  }
  if (viewer.getStyle() != null)   style+=viewer.getStyle() + "String_Node_Str";
  style+="String_Node_Str";
  return style;
}
Program: 76774
Project: 76774
Buggy source:
/** 
 * Adds input and output parameter hints to odaStatement
 */
private void addParameterDefns() throws DataException {
  if (this.parameterHints == null)   return;
  Iterator it=this.parameterHints.iterator();
  while (it.hasNext()) {
    ParameterHint parameterHint=(ParameterHint)it.next();
    odaStatement.addParameterHint(parameterHint);
    if (parameterHint.isInputMode() && parameterHint.getDefaultInputValue() != null) {
      Class paramHintDataType=parameterHint.getDataType();
      if (paramHintDataType == Date.class)       paramHintDataType=parameterHint.getEffectiveDataType(dataSource.getDriverName(),queryType);
      Object inputValue=convertToValue(parameterHint.getDefaultInputValue(),paramHintDataType);
      if (isParameterPositionValid(parameterHint.getPosition()))       this.setInputParamValue(parameterHint.getPosition(),inputValue);
 else       this.setInputParamValue(parameterHint.getName(),inputValue);
    }
  }
  this.setInputParameterBinding();
}

Fixed version (ground truth):
/** 
 * Adds input and output parameter hints to odaStatement
 */
private void addParameterDefns() throws DataException {
  if (this.parameterHints == null)   return;
  Iterator it=this.parameterHints.iterator();
  while (it.hasNext()) {
    ParameterHint parameterHint=(ParameterHint)it.next();
    odaStatement.addParameterHint(parameterHint);
    if (parameterHint.isInputMode() && parameterHint.getDefaultInputValue() != null) {
      Class paramHintDataType=parameterHint.getDataType();
      if (paramHintDataType == Date.class)       paramHintDataType=parameterHint.getEffectiveDataType(dataSource.getDriverName(),queryType);
      Object inputValue=parameterHint.getDefaultInputValue();
      if (paramHintDataType != IBlob.class && paramHintDataType != IClob.class)       inputValue=convertToValue(parameterHint.getDefaultInputValue(),paramHintDataType);
      if (isParameterPositionValid(parameterHint.getPosition()))       this.setInputParamValue(parameterHint.getPosition(),inputValue);
 else       this.setInputParamValue(parameterHint.getName(),inputValue);
    }
  }
  this.setInputParameterBinding();
}
Program: 76775
Project: 76775
Buggy source:
public void close(){
  if (this.resultSetPopulator == null || this.resultSetPopulator.getCache() == null)   return;
  this.resultSetPopulator.getCache().close();
  resultSetPopulator=null;
}

Fixed version (ground truth):
public void close(){
  if (this.resultSetPopulator == null || this.resultSetPopulator.getCache() == null)   return;
  this.resultSetPopulator.getCache().close();
  resultSetPopulator=null;
  try {
    if (resultSet != null)     resultSet.close();
  }
 catch (  DataException e) {
    logger.logp(Level.FINE,className,"String_Node_Str","String_Node_Str",e);
  }
}
Program: 76777
Project: 76777
Buggy source:
/** 
 * Returns the style that the highlight rule links with.
 * @return the style
 */
public StyleHandle getStyle(){
  Object value=structRef.getValue(getModule(),getElement());
  if (value instanceof ElementRefValue) {
    ElementRefValue refValue=(ElementRefValue)value;
    if (refValue.isResolved()) {
      Style style=(Style)refValue.getElement();
      return (StyleHandle)style.getHandle(style.getRoot());
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the style that the highlight rule links with.
 * @return the style
 */
public StyleHandle getStyle(){
  Object value=((Structure)getStructure()).getLocalProperty(getModule(),HighlightRule.STYLE_MEMBER);
  if (value instanceof ElementRefValue) {
    ElementRefValue refValue=(ElementRefValue)value;
    if (refValue.isResolved()) {
      Style style=(Style)refValue.getElement();
      return (StyleHandle)style.getHandle(style.getRoot());
    }
  }
  return null;
}
Program: 76779
Project: 76779
Buggy source:
/** 
 * URL encoding based on incoming encoding format.
 * @param s string to be encoded.
 * @param format encoding format.
 * @return
 */
protected static String urlEncode(String s,String format){
}

Fixed version (ground truth):
/** 
 * URL encoding based on incoming encoding format.
 * @param s string to be encoded.
 * @param format encoding format.
 * @return
 */
public static String urlEncode(String s,String format){
  String encodedString=s;
  if (s != null) {
    try {
      encodedString=URLEncoder.encode(s,format);
    }
 catch (    UnsupportedEncodingException e) {
      encodedString=s;
    }
  }
  return encodedString;
}
Program: 76780
Project: 76780
Buggy source:
/** 
 * Convers Scale unit type to ICU Calendar constant.
 * @param unitType Scale unit type
 * @return Calendar constant or -1 if not found
 */
public static int convertUnitTypeToCalendarConstant(ScaleUnitType unitType){
switch (unitType.getValue()) {
case ScaleUnitType.DAYS:
    return Calendar.DATE;
case ScaleUnitType.HOURS:
  return Calendar.HOUR_OF_DAY;
case ScaleUnitType.MINUTES:
return Calendar.MINUTE;
case ScaleUnitType.MONTHS:
return Calendar.MONTH;
case ScaleUnitType.SECONDS:
return Calendar.SECOND;
case ScaleUnitType.WEEKS:
return Calendar.WEEK_OF_MONTH;
case ScaleUnitType.YEARS:
return Calendar.YEAR;
}
return -1;
}

Fixed version (ground truth):
/** 
 * Convers Scale unit type to ICU Calendar constant.
 * @param unitType Scale unit type
 * @return Calendar constant or -1 if not found
 */
public static int convertUnitTypeToCalendarConstant(ScaleUnitType unitType){
switch (unitType.getValue()) {
case ScaleUnitType.DAYS:
    return Calendar.DATE;
case ScaleUnitType.HOURS:
  return Calendar.HOUR_OF_DAY;
case ScaleUnitType.MINUTES:
return Calendar.MINUTE;
case ScaleUnitType.MONTHS:
return Calendar.MONTH;
case ScaleUnitType.SECONDS:
return Calendar.SECOND;
case ScaleUnitType.WEEKS:
return Calendar.WEEK_OF_YEAR;
case ScaleUnitType.YEARS:
return Calendar.YEAR;
}
return -1;
}
Program: 76781
Project: 76781
Buggy source:
public boolean next() throws BirtException {
  checkStarted();
  boolean hasNext=false;
  if (state == BEFORE_FIRST_ROW) {
    state=ON_ROW;
    hasNext=odiResult.getCurrentResult() != null;
  }
 else {
    hasNext=hasNextRow();
  }
  if (hasNext)   this.prepareCurrentRow();
  if (!hasNext)   state=AFTER_LAST_ROW;
  return hasNext;
}

Fixed version (ground truth):
public boolean next() throws BirtException {
  if (this.isFromDummyQuery) {
    this.isFromDummyQuery=false;
    return true;
  }
  checkStarted();
  boolean hasNext=false;
  if (state == BEFORE_FIRST_ROW) {
    state=ON_ROW;
    hasNext=odiResult.getCurrentResult() != null;
  }
 else {
    hasNext=hasNextRow();
  }
  if (hasNext)   this.prepareCurrentRow();
  if (!hasNext)   state=AFTER_LAST_ROW;
  return hasNext;
}
Program: 76782
Project: 76782
Buggy source:
/** 
 * @return
 * @throws DataException
 */
private IRDSave getRdSave() throws DataException {
  if (this.rdSave == null)   this.rdSave=RDUtil.newSave(this.context,this.queryDefn,odiResult.getRowCount(),new QueryResultInfo(this.idInfo.getQueryResultID(),this.idInfo.getsubQueryName(),this.idInfo.getsubQueryIndex()));
  return this.rdSave;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws DataException
 */
private IRDSave getRdSave() throws DataException {
  if (this.rdSave == null)   this.rdSave=RDUtil.newSave(this.context,this.queryDefn,isDummyQuery(this.queryDefn,this.odiResult) ? 1 : odiResult.getRowCount(),new QueryResultInfo(this.idInfo.getQueryResultID(),this.idInfo.getsubQueryName(),this.idInfo.getsubQueryIndex()));
  return this.rdSave;
}
Program: 76783
Project: 76783
Buggy source:
public boolean addArea(IArea area,boolean keepWithPrevious,boolean keepWithNext){
  if (area == null) {
    return true;
  }
  keepWith=keepWithNext || pageBreakAvoid;
  if (!keepWith && !keepWithPrevious) {
    clearCache();
  }
  AbstractArea aArea=(AbstractArea)area;
  if (keepWithCache.getHeight() + aArea.getAllocatedHeight() + getCurrentBP() > getMaxAvaHeight()) {
    context.setAutoPageBreak(true);
    return false;
  }
 else {
    if (keepWithPrevious || keepWith) {
      keepWithCache.add(area);
    }
 else {
      addToRoot(aArea);
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean addArea(IArea area,boolean keepWithPrevious,boolean keepWithNext){
  if (area == null) {
    return true;
  }
  keepWith=keepWith || keepWithNext || pageBreakAvoid;
  if (!keepWith && !keepWithPrevious) {
    clearCache();
  }
  AbstractArea aArea=(AbstractArea)area;
  if (keepWithCache.getHeight() + aArea.getAllocatedHeight() + getCurrentBP() > getMaxAvaHeight()) {
    context.setAutoPageBreak(true);
    return false;
  }
 else {
    if (keepWithPrevious || keepWith) {
      keepWithCache.add(area);
    }
 else {
      addToRoot(aArea);
    }
  }
  return true;
}
Program: 76784
Project: 76784
Buggy source:
protected boolean layoutLines(){
  Iterator iter=lines.iterator();
  while (iter.hasNext()) {
    boolean keepWithNext=false;
    IArea area=(IArea)iter.next();
    if (current < widows - 1 || current > size - orphans - 1) {
      keepWithNext=true;
    }
    if (!super.addArea(area,false,keepWithNext)) {
      return true;
    }
 else {
      iter.remove();
      current++;
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean layoutLines(){
  Iterator iter=lines.iterator();
  while (iter.hasNext()) {
    boolean keepWithNext=false;
    IArea area=(IArea)iter.next();
    if (current < orphans - 1 || current > size - widows - 1) {
      keepWithNext=true;
    }
    if (!super.addArea(area,false,keepWithNext)) {
      return true;
    }
 else {
      iter.remove();
      current++;
    }
  }
  return false;
}
Program: 76785
Project: 76785
Buggy source:
protected int getWidows(){
  IStyle style=content.getStyle();
  String widows=style.getWidows();
  if (widows != null) {
    try {
      return Integer.parseInt(widows);
    }
 catch (    NumberFormatException e) {
      logger.log(Level.WARNING,"String_Node_Str",widows);
    }
  }
  return 2;
}

Fixed version (ground truth):
protected int getWidows(){
  IStyle style=content.getStyle();
  String widows=style.getWidows();
  if (widows != null) {
    try {
      return Integer.parseInt(widows);
    }
 catch (    NumberFormatException e) {
      logger.log(Level.WARNING,"String_Node_Str",widows);
    }
  }
  return 0;
}
Program: 76786
Project: 76786
Buggy source:
protected int getOrphans(){
  IStyle style=content.getStyle();
  String orphans=style.getOrphans();
  if (orphans != null) {
    try {
      return Integer.parseInt(orphans);
    }
 catch (    NumberFormatException e) {
      logger.log(Level.WARNING,"String_Node_Str",orphans);
    }
  }
  return 2;
}

Fixed version (ground truth):
protected int getOrphans(){
  IStyle style=content.getStyle();
  String orphans=style.getOrphans();
  if (orphans != null) {
    try {
      return Integer.parseInt(orphans);
    }
 catch (    NumberFormatException e) {
      logger.log(Level.WARNING,"String_Node_Str",orphans);
    }
  }
  return 0;
}
Program: 76787
Project: 76787
Buggy source:
/** 
 * @param s
 * @return
 */
private static String cleanDate(String s){
  s=s.trim();
  if (s.indexOf('T') < 12) {
    s=s.replaceFirst("String_Node_Str","String_Node_Str");
  }
  int zoneIndex=s.indexOf("String_Node_Str");
  if (zoneIndex > 0) {
    return s.substring(0,zoneIndex);
  }
  zoneIndex=s.indexOf('Z');
  if (zoneIndex == s.length() - 1) {
    return s.substring(0,zoneIndex);
  }
  zoneIndex=s.indexOf('+');
  if (zoneIndex > 0) {
    return s.substring(0,zoneIndex);
  }
  return s;
}

Fixed version (ground truth):
/** 
 * @param s
 * @return
 */
private static String cleanDate(String s){
  s=s.trim();
  if (s.indexOf('T') < 12) {
    s=s.replaceFirst("String_Node_Str","String_Node_Str");
  }
  int zoneIndex=s.indexOf("String_Node_Str");
  if (zoneIndex > 0) {
    return s.substring(0,zoneIndex).trim();
  }
  zoneIndex=s.indexOf('Z');
  if (zoneIndex == s.length() - 1) {
    return s.substring(0,zoneIndex).trim();
  }
  zoneIndex=s.indexOf('+');
  if (zoneIndex > 0) {
    return s.substring(0,zoneIndex).trim();
  }
  return s;
}
Program: 76788
Project: 76788
Buggy source:
private String getInputDisplayName(){
  String displayName=null;
  if (DesignChoiceConstants.PARAM_CONTROL_LIST_BOX.equals(selectedParameter.getControlType())) {
    if (selectedParameter.isMustMatch()) {
      displayName=DISPLAY_NAME_CONTROL_COMBO;
    }
 else {
      displayName=DISPLAY_NAME_CONTROL_LIST;
    }
  }
  return displayName;
}

Fixed version (ground truth):
private String getInputDisplayName(){
  String displayName=null;
  if (DesignChoiceConstants.PARAM_CONTROL_LIST_BOX.equals(selectedParameter.getControlType())) {
    if (selectedParameter.isMustMatch()) {
      displayName=DISPLAY_NAME_CONTROL_LIST;
    }
 else {
      displayName=DISPLAY_NAME_CONTROL_COMBO;
    }
  }
  return displayName;
}
Program: 76790
Project: 76790
Buggy source:
/** 
 * @param absPos the vertical position relative to its containing box
 * @param containerBaseAbsPos the absolute position of the container's top
 * @param containerSize container height
 * @param ImageSize the height of template which image lies in
 * @return a triple(the vertical position of template's left-bottom origin,template height, and image's vertical translation relative to the template )
 */
private tplValueTriple computeTplVerticalValTriple(float absPos,float containerBaseAbsPos,float containerSize,float ImageSize){
  float tplOrigin=0.0f, tplSize=0.0f, translation=0.0f;
  if (absPos <= 0) {
    if (ImageSize + absPos > 0 && ImageSize + absPos <= containerSize) {
      tplOrigin=containerBaseAbsPos - ImageSize - absPos;
      tplSize=ImageSize + absPos;
    }
 else     if (ImageSize + absPos > containerSize) {
      tplOrigin=containerBaseAbsPos - containerSize;
      tplSize=containerSize;
    }
 else {
    }
    translation=0;
  }
 else   if (absPos >= containerSize) {
  }
 else {
    if (ImageSize + absPos <= containerSize) {
      tplOrigin=containerBaseAbsPos - ImageSize - absPos;
      tplSize=ImageSize;
      translation=0.0f;
    }
 else {
      tplOrigin=containerBaseAbsPos - containerSize;
      tplSize=containerSize - absPos;
      translation=containerSize - absPos - ImageSize;
    }
  }
  return new tplValueTriple(tplOrigin,tplSize,translation);
}

Fixed version (ground truth):
/** 
 * @param absPos the vertical position relative to its containing box
 * @param containerBaseAbsPos the absolute position of the container's top
 * @param containerSize container height
 * @param ImageSize the height of template which image lies in
 * @return a triple(the vertical position of template's left-bottom origin,template height, and image's vertical translation relative to the template )
 */
private tplValueTriple computeTplVerticalValTriple(float absPos,float containerBaseAbsPos,float containerSize,float ImageSize){
  float tplOrigin=0.0f, tplSize=0.0f, translation=0.0f;
  if (absPos <= 0) {
    if (ImageSize + absPos > 0 && ImageSize + absPos <= containerSize) {
      tplOrigin=containerBaseAbsPos - ImageSize - absPos;
      tplSize=ImageSize + absPos;
    }
 else     if (ImageSize + absPos > containerSize) {
      tplOrigin=containerBaseAbsPos - containerSize;
      tplSize=containerSize;
      translation=containerSize - ImageSize;
    }
 else {
    }
  }
 else   if (absPos >= containerSize) {
  }
 else {
    if (ImageSize + absPos <= containerSize) {
      tplOrigin=containerBaseAbsPos - ImageSize - absPos;
      tplSize=ImageSize;
      translation=0.0f;
    }
 else {
      tplOrigin=containerBaseAbsPos - containerSize;
      tplSize=containerSize - absPos;
      translation=containerSize - absPos - ImageSize;
    }
  }
  return new tplValueTriple(tplOrigin,tplSize,translation);
}
Program: 76791
Project: 76791
Buggy source:
private void createDrillthroughSelectFormat(Composite container){
  Group group=new Group(container,SWT.NONE);
  group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  group.setText(Messages.getString("String_Node_Str"));
  group.setLayout(new GridLayout());
  ReportEngine engine=new ReportEngine(new EngineConfig());
  supportedFormats=engine.getSupportedFormats();
  formatCheckBtns=new HashMap();
  for (int i=0; i < supportedFormats.length; i++) {
    Button btn=new Button(group,SWT.RADIO);
    btn.setText(supportedFormats[i]);
    formatCheckBtns.put(supportedFormats[i],btn);
    btn.addSelectionListener(new SelectionListener(){
      public void widgetSelected(      SelectionEvent e){
        if (tocButton.getSelection()) {
          initAnchorChooser(targetReportHandle,true);
        }
 else         if (targetBookmarkButton.getSelection()) {
          initAnchorChooser(targetReportHandle,false);
        }
      }
      public void widgetDefaultSelected(      SelectionEvent e){
      }
    }
);
  }
}

Fixed version (ground truth):
private void createDrillthroughSelectFormat(Composite container){
  Group group=new Group(container,SWT.NONE);
  group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  group.setText(Messages.getString("String_Node_Str"));
  group.setLayout(new GridLayout());
  ReportEngine engine=new ReportEngine(new EngineConfig());
  supportedFormats=engine.getSupportedFormats();
  formatCheckBtns=new HashMap();
  for (int i=0; i < supportedFormats.length; i++) {
    Button btn=new Button(group,SWT.RADIO);
    btn.setText(supportedFormats[i]);
    formatCheckBtns.put(supportedFormats[i],btn);
    btn.addSelectionListener(new SelectionListener(){
      public void widgetSelected(      SelectionEvent e){
        if (tocButton.getSelection() && targetReportHandle instanceof IReportDocument) {
          initAnchorChooser(targetReportHandle,true);
        }
      }
      public void widgetDefaultSelected(      SelectionEvent e){
      }
    }
);
  }
}
Program: 76793
Project: 76793
Buggy source:
/** 
 * Return expression string value as expression required format. For example number type: Integer value 1 to String value "1" Boolean type: Boolean value true to String value "true" other types: String value "abc" to String value "\"abc\"" Date value "2000-10-10" to String value "\"2000-10-10\""
 * @return expression value
 */
public String getSelectedExprValue(){
  String exprValue=null;
  if (selectedIndices != null && selectedIndices.length > 0) {
    int firstIndex=selectedIndices[0];
    Object modelValue=modelValueList.get(firstIndex);
    String viewerValue=(String)viewerValueList.get(firstIndex);
    if (modelValue instanceof Boolean || modelValue instanceof Integer || modelValue instanceof Double|| modelValue instanceof BigDecimal) {
      exprValue=viewerValue;
    }
 else {
      exprValue="String_Node_Str" + viewerValue + "String_Node_Str";
    }
  }
  return exprValue;
}

Fixed version (ground truth):
/** 
 * Return expression string value as expression required format. For example number type: Integer value 1 to String value "1" Boolean type: Boolean value true to String value "true" other types: String value "abc" to String value "\"abc\"" Date value "2000-10-10" to String value "\"2000-10-10\""
 * @return expression value
 */
public String getSelectedExprValue(){
  String exprValue=null;
  if (selectedIndices != null && selectedIndices.length > 0) {
    int firstIndex=selectedIndices[0];
    Object modelValue=modelValueList.get(firstIndex);
    String viewerValue=(String)viewerValueList.get(firstIndex);
    if (modelValue instanceof Boolean || modelValue instanceof Integer || modelValue instanceof Double|| modelValue instanceof BigDecimal) {
      exprValue=viewerValue;
    }
 else {
      exprValue="String_Node_Str" + JavascriptEvalUtil.transformToJsConstants(viewerValue) + "String_Node_Str";
    }
  }
  return exprValue;
}
Program: 76797
Project: 76797
Buggy source:
/** 
 * set total pass level. the total pass level must be the max of passLevel
 * @param passLevel
 */
private void setTotalPassLevel(int passLevel){
  if (this.totalPassLevel < passLevel)   this.totalPassLevel=passLevel;
 else   this.totalPassLevel=0;
}

Fixed version (ground truth):
/** 
 * set total pass level. the total pass level must be the max of passLevel
 * @param passLevel
 */
private void setTotalPassLevel(int passLevel){
  if (this.totalPassLevel < passLevel)   this.totalPassLevel=passLevel;
}
Program: 76798
Project: 76798
Buggy source:
/** 
 * reset the helper status
 * @param availableAggrObj
 */
void setCompilerStatus(List availableAggrObj){
  this.hasAggregate=false;
  this.hasNesetedAggregate=false;
  this.caculatedAggregateList=availableAggrObj;
  this.aggrObjList=new ArrayList();
}

Fixed version (ground truth):
/** 
 * reset the helper status
 * @param availableAggrObj
 */
void setCompilerStatus(List availableAggrObj){
  this.hasAggregate=false;
  this.hasNesetedAggregate=false;
  this.caculatedAggregateList=availableAggrObj;
  this.aggrObjList=new ArrayList();
  this.passLevel=0;
  this.totalPassLevel=0;
}
Program: 76799
Project: 76799
Buggy source:
/** 
 * @param PRE_add_filter
 * @param PRE_add_sort
 * @param PRE_use_oldbinding
 * @return
 */
private QueryDefinition newPreIVReportQuery(){
  QueryDefinition qd=new QueryDefinition();
  if (GEN_add_filter == true) {
    qd.addFilter(GEN_filterDefn);
  }
  if (PRE_add_filter == true) {
    ScriptExpression filterExpr=new ScriptExpression("String_Node_Str");
    FilterDefinition fd=new FilterDefinition(filterExpr);
    qd.addFilter(fd);
  }
  if (PRE_add_sort) {
    SortDefinition sd=new SortDefinition();
    sd.setExpression("String_Node_Str");
    sd.setSortDirection(ISortDefinition.SORT_ASC);
    qd.addSort(sd);
  }
  if (PRE_add_group == true) {
    String columnBindingNameGroup="String_Node_Str";
    IBaseExpression columnBindingExprGroup=new ScriptExpression("String_Node_Str");
    GroupDefinition gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addResultSetExpression(columnBindingNameGroup,columnBindingExprGroup);
    qd.addGroup(gd);
  }
  for (int i=0; i < rowExprName.length; i++) {
    if (PRE_use_oldbinding) {
      qd.addResultSetExpression(this.rowExprName[i],this.rowBeArray[i]);
    }
 else {
      qd.addResultSetExpression(this.rowExprName[i],new ScriptExpression("String_Node_Str" + this.rowExprName[i] + "String_Node_Str"));
    }
  }
  for (int i=0; i < totalExprName.length; i++) {
    if (PRE_use_oldbinding) {
      qd.addResultSetExpression(this.totalExprName[i],this.totalBeArray[i]);
    }
 else {
      qd.addResultSetExpression(this.totalExprName[i],new ScriptExpression("String_Node_Str" + this.totalExprName[i] + "String_Node_Str"));
    }
  }
  return qd;
}

Fixed version (ground truth):
/** 
 * @param PRE_add_filter
 * @param PRE_add_sort
 * @param PRE_use_oldbinding
 * @return
 */
private QueryDefinition newPreIVReportQuery(){
  QueryDefinition qd=new QueryDefinition();
  if (GEN_add_filter == true) {
    qd.addFilter(GEN_filterDefn);
  }
  if (PRE_add_filter == true) {
    ScriptExpression filterExpr=new ScriptExpression("String_Node_Str");
    FilterDefinition fd=new FilterDefinition(filterExpr);
    qd.addFilter(fd);
  }
  if (PRE_add_sort) {
    SortDefinition sd=new SortDefinition();
    sd.setExpression("String_Node_Str");
    sd.setSortDirection(ISortDefinition.SORT_ASC);
    qd.addSort(sd);
  }
  if (PRE_add_group == true) {
    String columnBindingNameGroup="String_Node_Str";
    IBaseExpression columnBindingExprGroup=new ScriptExpression("String_Node_Str");
    GroupDefinition gd=new GroupDefinition();
    gd.setKeyColumn("String_Node_Str");
    qd.addResultSetExpression(columnBindingNameGroup,columnBindingExprGroup);
    qd.addGroup(gd);
  }
  for (int i=0; i < rowExprName.length; i++) {
    if (PRE_change_oldbinding && i == rowExprName.length - 1) {
      qd.addResultSetExpression(this.rowExprName[i],new ScriptExpression("String_Node_Str"));
    }
 else {
      qd.addResultSetExpression(this.rowExprName[i],this.rowBeArray[i]);
    }
  }
  for (int i=0; i < totalExprName.length; i++) {
    qd.addResultSetExpression(this.totalExprName[i],this.totalBeArray[i]);
  }
  return qd;
}