nus-yam/ex-repair huggingface dataset:
Program: 76696
Project: 76696
Buggy source:
protected void openReportDocument(IReportDocument reportDoc){
  this.reportDoc=reportDoc;
  executionContext.setReportDocument(reportDoc);
  setParameterValues(reportDoc.getParameterValues());
  usingParameterValues();
  executionContext.registerGlobalBeans(reportDoc.getGlobalVariables(null));
}

Fixed version (ground truth):
protected void openReportDocument(IReportDocument reportDoc){
  this.reportDoc=reportDoc;
  executionContext.setReportDocument(reportDoc);
  setParameterValues(reportDoc.getParameterValues());
  setParameterDisplayTexts(reportDoc.getParameterDisplayTexts());
  usingParameterValues();
  executionContext.registerGlobalBeans(reportDoc.getGlobalVariables(null));
}
Program: 76697
Project: 76697
Buggy source:
public ReportDocumentInfo(ExecutionContext context,long pageNumber,boolean finished){
  this.context=context;
  this.pageNumber=pageNumber;
  this.finished=finished;
  params.putAll(context.getParameterValues());
  beans.putAll(context.getGlobalBeans());
  errors=context.getErrors();
}

Fixed version (ground truth):
public ReportDocumentInfo(ExecutionContext context,long pageNumber,boolean finished){
  this.context=context;
  this.pageNumber=pageNumber;
  this.finished=finished;
  params.putAll(context.getParameterValues());
  parameterDisplayTexts.putAll(context.getParameterDisplayTexts());
  beans.putAll(context.getGlobalBeans());
  errors=context.getErrors();
}
Program: 76698
Project: 76698
Buggy source:
/** 
 * open the document for reading, the document must be closed by the caller.
 * @return
 */
public IReportDocument openReportDocument() throws BirtException {
  IReportEngine engine=context.getEngine();
  String documentName=context.getReportDocWriter().getName();
  if (new File(documentName).isDirectory()) {
    char lastChar=documentName.charAt(documentName.length() - 1);
    if (lastChar != '\\' && lastChar != '/' && lastChar != File.separatorChar) {
      documentName=documentName + File.separatorChar;
    }
  }
  IReportDocument document=engine.openReportDocument(documentName);
  return new TransientReportDocument(document,pageNumber,params,beans,finished);
}

Fixed version (ground truth):
/** 
 * open the document for reading, the document must be closed by the caller.
 * @return
 */
public IReportDocument openReportDocument() throws BirtException {
  IReportEngine engine=context.getEngine();
  String documentName=context.getReportDocWriter().getName();
  if (new File(documentName).isDirectory()) {
    char lastChar=documentName.charAt(documentName.length() - 1);
    if (lastChar != '\\' && lastChar != '/' && lastChar != File.separatorChar) {
      documentName=documentName + File.separatorChar;
    }
  }
  IReportDocument document=engine.openReportDocument(documentName);
  return new TransientReportDocument(document,pageNumber,params,parameterDisplayTexts,beans,finished);
}
Program: 76699
Project: 76699
Buggy source:
TransientReportDocument(IReportDocument document,long pageNumber,Map paramters,Map globalVariables,boolean isComplete){
  this.document=document;
  this.pageNumber=pageNumber;
  this.parameters=paramters;
  this.globalVariables=globalVariables;
  this.isComplete=isComplete;
}

Fixed version (ground truth):
TransientReportDocument(IReportDocument document,long pageNumber,Map paramters,Map parameterDisplayTexts,Map globalVariables,boolean isComplete){
  this.document=document;
  this.pageNumber=pageNumber;
  this.parameters=paramters;
  this.parameterDisplayTexts=parameterDisplayTexts;
  this.globalVariables=globalVariables;
  this.isComplete=isComplete;
}
Program: 76700
Project: 76700
Buggy source:
public void contextInitialized(ServletContextEvent event){
  ParameterAccessor.initParameters(event.getServletContext());
}

Fixed version (ground truth):
public void contextInitialized(ServletContextEvent event){
  ParameterAccessor.initParameters(event.getServletContext());
  IViewerReportService instance=new BirtViewerReportService(event.getServletContext());
  BirtReportServiceFactory.init(instance);
}
Program: 76701
Project: 76701
Buggy source:
public Collection getSelectionListForCascadingGroup(IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  HttpServletRequest request=(HttpServletRequest)options.getOption(InputOptions.OPT_REQUEST);
  try {
    task=getParameterDefinitionTask(design,options);
    if (task != null) {
      ViewerAttributeBean bean=getViewerAttrBean(options);
      if (bean != null)       task.setParameterValues(bean.getParameters());
      BirtUtility.addTask(request,task);
      task.evaluateQuery(groupName);
      Collection selectionList=task.getSelectionListForCascadingGroup(groupName,groupKeys);
      return convertEngineParameterSelectionChoice(selectionList);
    }
  }
  finally {
    BirtUtility.removeTask(request);
    if (task != null)     task.close();
  }
  return null;
}

Fixed version (ground truth):
public Collection getSelectionListForCascadingGroup(IViewerReportDesignHandle design,String groupName,Object[] groupKeys,InputOptions options) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  HttpServletRequest request=(HttpServletRequest)options.getOption(InputOptions.OPT_REQUEST);
  try {
    task=getParameterDefinitionTask(design,options);
    if (task != null) {
      ViewerAttributeBean bean=getViewerAttrBean(options);
      if (bean != null) {
        task.setLocale(bean.getLocale());
        task.setParameterValues(bean.getParameters());
      }
      BirtUtility.addTask(request,task);
      task.evaluateQuery(groupName);
      Collection selectionList=task.getSelectionListForCascadingGroup(groupName,groupKeys);
      return convertEngineParameterSelectionChoice(selectionList);
    }
  }
  finally {
    BirtUtility.removeTask(request);
    if (task != null)     task.close();
  }
  return null;
}
Program: 76702
Project: 76702
Buggy source:
public BirtViewerReportService(ServletConfig conf){
  try {
    ReportEngineService.initEngineInstance(conf);
  }
 catch (  BirtException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public BirtViewerReportService(ServletContext context){
  try {
    ReportEngineService.initEngineInstance(context);
  }
 catch (  BirtException e) {
    e.printStackTrace();
  }
}
Program: 76703
Project: 76703
Buggy source:
public Collection getParameterSelectionList(IViewerReportDesignHandle design,InputOptions runOptions,String paramName) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  try {
    task=getParameterDefinitionTask(design,runOptions);
    if (task != null) {
      ViewerAttributeBean bean=getViewerAttrBean(runOptions);
      if (bean != null)       task.setParameterValues(bean.getParameters());
      Collection selectionList=task.getSelectionList(paramName);
      return convertEngineParameterSelectionChoice(selectionList);
    }
  }
  finally {
    if (task != null)     task.close();
  }
  return null;
}

Fixed version (ground truth):
public Collection getParameterSelectionList(IViewerReportDesignHandle design,InputOptions runOptions,String paramName) throws ReportServiceException {
  IGetParameterDefinitionTask task=null;
  try {
    task=getParameterDefinitionTask(design,runOptions);
    if (task != null) {
      ViewerAttributeBean bean=getViewerAttrBean(runOptions);
      if (bean != null) {
        task.setLocale(bean.getLocale());
        task.setParameterValues(bean.getParameters());
      }
      Collection selectionList=task.getSelectionList(paramName);
      return convertEngineParameterSelectionChoice(selectionList);
    }
  }
  finally {
    if (task != null)     task.close();
  }
  return null;
}
Program: 76705
Project: 76705
Buggy source:
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;
    }
  }
}

Fixed version (ground truth):
public void focusLost(FocusEvent e){
  String key=UIUtil.convertToModelString(keyChooser.getText(),true);
  if (key != null) {
    String tocExp=null;
    if (keyChooser.indexOf(key) != -1) {
      tocExp=DEUtil.getExpression(columnList.get(keyChooser.indexOf(key)));
    }
 else {
      for (int i=0; i < columnList.size(); i++) {
        if (key.equals(DEUtil.getExpression(columnList.get(i)))) {
          tocExp=DEUtil.getExpression(columnList.get(i));
          break;
        }
      }
    }
    if (!tocEditor.getText().equals(tocExp)) {
      tocEditor.setText(tocExp);
      return;
    }
  }
}
Program: 76707
Project: 76707
Buggy source:
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;
}

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 (keyText != null && keyChooser.indexOf(keyText) != -1) {
    exp=DEUtil.getExpression(columnList.get(keyChooser.indexOf(keyText)));
  }
 else {
    exp=keyChooser.getText().trim();
  }
  return exp;
}
Program: 76709
Project: 76709
Buggy source:
/** 
 * Adds a bound column to the list.
 * @param addColumn the bound column to add
 * @param inForce <code>true</code> the column is added to the list regardless of duplicate expression. <code>false</code> do not add the column if the expression already exist
 * @param column the bound column
 * @return the newly created <code>ComputedColumnHandle</code> or theexisted <code>ComputedColumnHandle</code> in the list
 * @throws SemanticException if expression is not duplicate but the name duplicates the exsiting bound column. Or, if the both name/expression are duplicate, but <code>inForce</code> is <code>true</code>.
 */
public ComputedColumnHandle addColumnBinding(ComputedColumn addColumn,boolean inForce) throws SemanticException {
  if (addColumn == null)   return null;
  String expr=addColumn.getExpression();
  if (expr == null)   return null;
  List columns=(List)getProperty(BOUND_DATA_COLUMNS_PROP);
  if (columns == null)   return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
  ComputedColumn column=DataBoundColumnUtil.getColumn(columns,expr);
  if (column != null && !inForce) {
    return (ComputedColumnHandle)column.handle(getPropertyHandle(BOUND_DATA_COLUMNS_PROP),columns.indexOf(column));
  }
  return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
}

Fixed version (ground truth):
/** 
 * Adds a bound column to the list.
 * @param addColumn the bound column to add
 * @param inForce <code>true</code> the column is added to the list regardless of duplicate expression. <code>false</code> do not add the column if the expression already exist
 * @param column the bound column
 * @return the newly created <code>ComputedColumnHandle</code> or theexisted <code>ComputedColumnHandle</code> in the list
 * @throws SemanticException if expression is not duplicate but the name duplicates the exsiting bound column. Or, if the both name/expression are duplicate, but <code>inForce</code> is <code>true</code>.
 */
public ComputedColumnHandle addColumnBinding(ComputedColumn addColumn,boolean inForce) throws SemanticException {
  if (addColumn == null)   return null;
  String expr=addColumn.getExpression();
  if (expr == null)   return null;
  List columns=(List)getProperty(BOUND_DATA_COLUMNS_PROP);
  if (columns == null)   return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
  String aggregateOn=addColumn.getAggregateOn();
  ComputedColumn column=DataBoundColumnUtil.getColumn(columns,expr,aggregateOn);
  if (column != null && !inForce) {
    return (ComputedColumnHandle)column.handle(getPropertyHandle(BOUND_DATA_COLUMNS_PROP),columns.indexOf(column));
  }
  return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
}
Program: 76710
Project: 76710
Buggy source:
/** 
 * Adds a bound column to the list.
 * @param addColumn the bound column to add
 * @param inForce <code>true</code> the column is added to the list regardless of duplicate expression. <code>false</code> do not add the column if the expression already exist
 * @param column the bound column
 * @return the newly created <code>ComputedColumnHandle</code> or theexisted <code>ComputedColumnHandle</code> in the list
 * @throws SemanticException if expression is not duplicate but the name duplicates the exsiting bound column. Or, if the both name/expression are duplicate, but <code>inForce</code> is <code>true</code>.
 */
public ComputedColumnHandle addColumnBinding(ComputedColumn addColumn,boolean inForce) throws SemanticException {
  if (addColumn == null)   return null;
  String expr=addColumn.getExpression();
  if (expr == null)   return null;
  List columns=(List)getProperty(BOUND_DATA_COLUMNS_PROP);
  if (columns == null)   return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
  ComputedColumn column=DataBoundColumnUtil.getColumn(columns,expr);
  if (column != null && !inForce) {
    return (ComputedColumnHandle)column.handle(getPropertyHandle(BOUND_DATA_COLUMNS_PROP),columns.indexOf(column));
  }
  return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
}

Fixed version (ground truth):
/** 
 * Adds a bound column to the list.
 * @param addColumn the bound column to add
 * @param inForce <code>true</code> the column is added to the list regardless of duplicate expression. <code>false</code> do not add the column if the expression already exist
 * @param column the bound column
 * @return the newly created <code>ComputedColumnHandle</code> or theexisted <code>ComputedColumnHandle</code> in the list
 * @throws SemanticException if expression is not duplicate but the name duplicates the exsiting bound column. Or, if the both name/expression are duplicate, but <code>inForce</code> is <code>true</code>.
 */
public ComputedColumnHandle addColumnBinding(ComputedColumn addColumn,boolean inForce) throws SemanticException {
  if (addColumn == null)   return null;
  String expr=addColumn.getExpression();
  if (expr == null)   return null;
  List columns=(List)getProperty(BOUND_DATA_COLUMNS_PROP);
  if (columns == null)   return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
  String aggregateOn=addColumn.getAggregateOn();
  ComputedColumn column=DataBoundColumnUtil.getColumn(columns,expr,aggregateOn);
  if (column != null && !inForce) {
    return (ComputedColumnHandle)column.handle(getPropertyHandle(BOUND_DATA_COLUMNS_PROP),columns.indexOf(column));
  }
  return (ComputedColumnHandle)getPropertyHandle(BOUND_DATA_COLUMNS_PROP).addItem(addColumn);
}
Program: 76711
Project: 76711
Buggy source:
public void visitText(ITextArea textArea){
  ContainerPosition curPos;
  if (!containerStack.isEmpty())   curPos=(ContainerPosition)containerStack.peek();
 else   curPos=new ContainerPosition(0,0);
  int x=curPos.x + textArea.getX();
  int y=curPos.y + textArea.getY();
  drawTextAt(textArea,x,y,cb,pageHeight);
  makeBookmark(textArea,curPos);
  handleHyperlinkAction(textArea,curPos);
}

Fixed version (ground truth):
public void visitText(ITextArea textArea){
  ContainerPosition curPos;
  if (!containerStack.isEmpty())   curPos=(ContainerPosition)containerStack.peek();
 else   curPos=new ContainerPosition(0,0);
  int x=curPos.x + textArea.getX() + (int)(textArea.getFontInfo().getFontSize() * 70);
  int y=curPos.y + textArea.getY() + (int)(textArea.getFontInfo().getFontSize() * 100);
  drawTextAt(textArea,x,y,cb,pageHeight);
  makeBookmark(textArea,curPos);
  handleHyperlinkAction(textArea,curPos);
}
Program: 76712
Project: 76712
Buggy source:
CellArea(ICellContent cell){
  super(cell);
  removeBorder();
}

Fixed version (ground truth):
CellArea(ICellContent cell){
  super(cell);
  removeBorder();
  setDefaultPadding();
}
Program: 76713
Project: 76713
Buggy source:
public boolean layout(){
  boolean childBreak=super.layout();
  if (childBreak) {
    if (tbl != null) {
      if (!isFinished() && needPageBreakBefore(null)) {
        tbl.setTableCloseStateAsForced();
      }
 else       if (isFinished() && needPageBreakAfter(null)) {
        tbl.setTableCloseStateAsForced();
      }
    }
  }
  return childBreak;
}

Fixed version (ground truth):
public boolean layout(){
  boolean childBreak=super.layout();
  if (childBreak) {
    if (tbl != null) {
      IStyle cStyle=content.getStyle();
      if (!isFinished() && needPageBreakBefore(cStyle.getPageBreakBefore())) {
        tbl.setTableCloseStateAsForced();
      }
 else       if (isFinished() && needPageBreakAfter(cStyle.getPageBreakAfter())) {
        tbl.setTableCloseStateAsForced();
      }
    }
  }
  return childBreak;
}
Program: 76714
Project: 76714
Buggy source:
/** 
 * Gets the height of the specified word.
 * @return					the height of the font, it equals ascent+|descent|+leading
 */
public float getWordHeight(){
  if (bf == null)   return fontSize;
  return bf.getFontDescriptor(BaseFont.AWT_ASCENT,fontSize) - bf.getFontDescriptor(BaseFont.AWT_DESCENT,fontSize) + bf.getFontDescriptor(BaseFont.AWT_LEADING,fontSize) + fontSize / 5f;
}

Fixed version (ground truth):
/** 
 * Gets the height of the specified word.
 * @return					the height of the font, it equals ascent+|descent|+leading
 */
public float getWordHeight(){
  if (bf == null)   return fontSize;
  return bf.getFontDescriptor(BaseFont.AWT_ASCENT,fontSize) - bf.getFontDescriptor(BaseFont.AWT_DESCENT,fontSize) + bf.getFontDescriptor(BaseFont.AWT_LEADING,fontSize) + fontSize / 4f;
}
Program: 76715
Project: 76715
Buggy source:
protected Object convertToType(Object value,String type){
  try {
    if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(type)) {
      return DataTypeUtil.toBoolean(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(type)) {
      return DataTypeUtil.toDate(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(type)) {
      return DataTypeUtil.toBigDecimal(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(type)) {
      return DataTypeUtil.toDouble(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(type)) {
      return DataTypeUtil.toString(value);
    }
    return value;
  }
 catch (  BirtException e) {
    log.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
  return null;
}

Fixed version (ground truth):
protected Object convertToType(Object value,String type){
  try {
    if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(type)) {
      return DataTypeUtil.toBoolean(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(type)) {
      return DataTypeUtil.toDate(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(type)) {
      return DataTypeUtil.toBigDecimal(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(type)) {
      return DataTypeUtil.toDouble(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(type)) {
      return DataTypeUtil.toString(value);
    }
 else     if (DesignChoiceConstants.PARAM_TYPE_INTEGER.equals(type)) {
      return DataTypeUtil.toInteger(value);
    }
    return value;
  }
 catch (  BirtException e) {
    log.log(Level.SEVERE,e.getLocalizedMessage(),e);
  }
  return null;
}
Program: 76716
Project: 76716
Buggy source:
public void load(){
  setEnabled(true);
  String[] result=(String[])provider.load();
  if (result.length == 1)   setInput(result[0]);
  if (result.length == 2)   setInput(result[0],result[1]);
}

Fixed version (ground truth):
public void load(){
  setEnabled(true);
  String[] result=(String[])provider.load();
  if (result == null)   return;
  if (result.length == 1)   setInput(result[0]);
  if (result.length == 2)   setInput(result[0],result[1]);
}
Program: 76717
Project: 76717
Buggy source:
private boolean isModelInModuleHandle(){
  List list=getModelChildren();
  int size=list.size();
  for (int i=0; i < size; i++) {
    Object obj=list.get(i);
    if (obj instanceof DesignElementHandle) {
      DesignElementHandle handle=(DesignElementHandle)obj;
      if (handle.getRoot() == null) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean isModelInModuleHandle(){
  List list=getModelChildren();
  int size=list.size();
  for (int i=0; i < size; i++) {
    Object obj=list.get(i);
    if (obj instanceof DesignElementHandle) {
      DesignElementHandle handle=(DesignElementHandle)obj;
      if (handle.getRoot() == null && (!getChildren().isEmpty() && ((EditPart)getChildren().get(0)).getModel().equals(handle))) {
        return false;
      }
    }
  }
  return true;
}
Program: 76718
Project: 76718
Buggy source:
public void setTotalPage(ITextArea totalPage){
  drawTextAt(totalPage,0,0,tpl,tpl.getHeight());
}

Fixed version (ground truth):
public void setTotalPage(ITextArea totalPage){
  if (tpl != null) {
    drawTextAt(totalPage,0,0,tpl,tpl.getHeight());
  }
}
Program: 76719
Project: 76719
Buggy source:
public void testGroup() throws ScriptException {
  GroupHandle groupHandle=factory.newTableGroup();
  IGroup group=new Group(groupHandle);
  group.setInterval(YEAR);
  assertEquals(YEAR,group.getInterval());
  group.setIntervalBase(INTERVAL_BASE);
  assertEquals(INTERVAL_BASE,group.getIntervalBase());
  group.setIntervalRange(INTERVAL_RANGE);
  assertTrue(INTERVAL_RANGE == group.getIntervalRange());
  group.setKeyExpr(EXPRESSION);
  assertEquals(EXPRESSION,group.getKeyExpr());
  group.setName(NAME);
  assertEquals(NAME,group.getName());
  group.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
  assertEquals(DesignChoiceConstants.SORT_DIRECTION_DESC,group.getSortDirection());
  try {
    group.setSortDirection(TEST);
    fail("String_Node_Str");
  }
 catch (  ScriptException e) {
  }
  group.setTocExpression(TOC);
  assertEquals(TOC,group.getTocExpression());
}

Fixed version (ground truth):
public void testGroup() throws ScriptException {
  GroupHandle groupHandle=factory.newTableGroup();
  IGroup group=new Group(groupHandle);
  group.setInterval(YEAR);
  assertEquals(YEAR,group.getInterval());
  group.setIntervalBase(INTERVAL_BASE);
  assertEquals(INTERVAL_BASE,group.getIntervalBase());
  group.setIntervalRange(INTERVAL_RANGE);
  assertTrue(INTERVAL_RANGE == group.getIntervalRange());
  group.setKeyExpr(EXPRESSION);
  assertEquals(EXPRESSION,group.getKeyExpr());
  group.setName(NAME);
  assertEquals(NAME,group.getName());
  group.setSortDirection(DesignChoiceConstants.SORT_DIRECTION_DESC);
  assertEquals(DesignChoiceConstants.SORT_DIRECTION_DESC,group.getSortDirection());
  try {
    group.setSortDirection(TEST);
    fail("String_Node_Str");
  }
 catch (  ScriptException e) {
  }
  group.setTocExpression(TOC);
  assertEquals(TOC,group.getTocExpression());
  group.setHideDetail(true);
  assertTrue(group.getHideDetail());
}
Program: 76720
Project: 76720
Buggy source:
/** 
 * handle generate report content
 * @param out
 * @throws Exception
 */
protected void __handleOutputReport(OutputStream out) throws Exception {
  if (this.documentInUrl) {
    String doc=createAbsolutePath(viewer.getReportDocument());
    if (viewer.getReportletId() != null) {
      getReportService().renderReportlet(doc,viewer.getReportletId(),this.options,new ArrayList(),out);
    }
 else {
      getReportService().renderReport(doc,null,this.options,out);
    }
  }
 else {
    Map params=__handleParameters(reportDesignHandle,null);
    Map displayTexts=BirtUtility.getDisplayTexts(null,(HttpServletRequest)pageContext.getRequest());
    getReportService().runAndRenderReport(reportDesignHandle,null,this.options,params,out,new ArrayList(),displayTexts);
  }
}

Fixed version (ground truth):
/** 
 * handle generate report content
 * @param out
 * @throws Exception
 */
protected void __handleOutputReport(OutputStream out) throws Exception {
  ReportEngineService.getInstance().setMaxRows(viewer.getMaxRowsOfRecords());
  if (this.documentInUrl) {
    String doc=createAbsolutePath(viewer.getReportDocument());
    if (viewer.getReportletId() != null) {
      getReportService().renderReportlet(doc,viewer.getReportletId(),this.options,new ArrayList(),out);
    }
 else {
      getReportService().renderReport(doc,null,this.options,out);
    }
  }
 else {
    Map params=__handleParameters(reportDesignHandle,null);
    Map displayTexts=BirtUtility.getDisplayTexts(null,(HttpServletRequest)pageContext.getRequest());
    getReportService().runAndRenderReport(reportDesignHandle,null,this.options,params,out,new ArrayList(),displayTexts);
  }
}
Program: 76721
Project: 76721
Buggy source:
/** 
 * Get column bindings of certain query.
 * @param defn
 * @return
 */
private Map getColumnBindings(IBaseQueryDefinition defn){
  Map result=defn.getResultSetExpressions();
  result.putAll(populateGroupColumnBindings(defn.getGroups().iterator()));
  result.putAll(populateSubQueryColumnBindings(defn.getSubqueries().iterator()));
  return result;
}

Fixed version (ground truth):
/** 
 * Get column bindings of certain query.
 * @param defn
 * @return
 */
private Map getColumnBindings(IBaseQueryDefinition defn){
  Map result=new HashMap();
  Iterator temp=defn.getResultSetExpressions().keySet().iterator();
  while (temp.hasNext()) {
    Object key=temp.next();
    result.put(key,defn.getResultSetExpressions().get(key));
  }
  result.putAll(populateGroupColumnBindings(defn.getGroups().iterator()));
  result.putAll(populateSubQueryColumnBindings(defn.getSubqueries().iterator()));
  return result;
}
Program: 76724
Project: 76724
Buggy source:
public void elementChanged(DesignElementHandle focus,NotificationEvent ev){
  PropertyEvent event=(PropertyEvent)ev;
  String propertyName=event.getPropertyName();
  if (propertyName.equals(StyleHandle.BORDER_TOP_WIDTH_PROP) || propertyName.equals(StyleHandle.BORDER_LEFT_WIDTH_PROP) || propertyName.equals(StyleHandle.BORDER_BOTTOM_WIDTH_PROP)|| propertyName.equals(StyleHandle.BORDER_RIGHT_WIDTH_PROP)) {
    load();
  }
}

Fixed version (ground truth):
public void elementChanged(DesignElementHandle focus,NotificationEvent ev){
  PropertyEvent event=(PropertyEvent)ev;
  String propertyName=event.getPropertyName();
  if (propertyName.equals(StyleHandle.BORDER_BOTTOM_WIDTH_PROP) || propertyName.equals(StyleHandle.BORDER_TOP_WIDTH_PROP) || propertyName.equals(StyleHandle.BORDER_LEFT_WIDTH_PROP)|| propertyName.equals(StyleHandle.BORDER_RIGHT_WIDTH_PROP)) {
    load();
  }
 else   if (propertyName.equals(StyleHandle.BORDER_BOTTOM_STYLE_PROP) || propertyName.equals(StyleHandle.BORDER_TOP_STYLE_PROP) || propertyName.equals(StyleHandle.BORDER_LEFT_STYLE_PROP)|| propertyName.equals(StyleHandle.BORDER_RIGHT_STYLE_PROP)) {
    load();
  }
 else   if (propertyName.equals(StyleHandle.BORDER_BOTTOM_COLOR_PROP) || propertyName.equals(StyleHandle.BORDER_LEFT_COLOR_PROP) || propertyName.equals(StyleHandle.BORDER_RIGHT_COLOR_PROP)|| propertyName.equals(StyleHandle.BORDER_TOP_COLOR_PROP)) {
    load();
  }
}
Program: 76725
Project: 76725
Buggy source:
public void load(){
  boolean init=false;
  for (int i=toggleProviders.length - 1; i >= 0; i--) {
    BorderInfomation info=(BorderInfomation)toggleProviders[i].load();
    previewCanvas.setBorderInfomation(info);
    if (!info.getStyle().equals("String_Node_Str")) {
      toggles[i].setSelection(true);
      if ((!init && restoreButton == null) || toggles[i] == restoreButton) {
        refreshStyle(info.getStyle());
        refreshWidth(info.getWidth());
        refreshColor(info.getColor());
        init=true;
      }
    }
 else     toggles[i].setSelection(false);
  }
  previewCanvas.redraw();
  if (!init) {
    if (styleCombo.getSelectedItem() == null) {
      String borderStyle=styleProvider.load().toString();
      refreshStyle(borderStyle);
    }
    if (widthCombo.getSelectedItem() == null) {
      String borderWidth=widthProvider.load().toString();
      refreshWidth(borderWidth);
    }
    if (builder.getRGB() == null) {
      String borderColor=colorProvider.load().toString();
      refreshColor(borderColor);
    }
  }
  checkToggleButtons();
}

Fixed version (ground truth):
public void load(){
  for (int i=0; i < toggleProviders.length; i++) {
    BorderInfomation info=(BorderInfomation)toggleProviders[i].load();
    previewCanvas.setBorderInfomation(info);
    if (!info.getStyle().equals("String_Node_Str")) {
      toggles[i].setSelection(true);
    }
 else {
      toggles[i].setSelection(false);
    }
  }
  previewCanvas.redraw();
  if (restoreInfo == null) {
    if (styleCombo.getSelectedItem() == null) {
      String borderStyle=styleProvider.load().toString();
      refreshStyle(borderStyle);
    }
    if (widthCombo.getSelectedItem() == null) {
      String borderWidth=widthProvider.load().toString();
      refreshWidth(borderWidth);
    }
    if (builder.getRGB() == null) {
      String borderColor=colorProvider.load().toString();
      refreshColor(borderColor);
    }
  }
 else {
    refreshStyle(restoreInfo.getStyle());
    refreshWidth(restoreInfo.getWidth());
    refreshColor(restoreInfo.getColor());
  }
  checkToggleButtons();
}
Program: 76727
Project: 76727
Buggy source:
/** 
 * create block text area by text content
 * @param content the text content
 * @param text the text string
 * @param contentDimension the content dimension
 * @param isFirst if this area is the first area of the content
 * @param isLast if this area is the last area of the content
 * @return
 */
protected IArea createBlockTextArea(String text,ITextContent content,FontInfo fi,Dimension contentDimension){
  AbstractArea textArea=(AbstractArea)AreaFactory.createTextArea(content,text,fi);
  textArea.setWidth(contentDimension.getWidth());
  textArea.setHeight(contentDimension.getHeight());
  return textArea;
}

Fixed version (ground truth):
/** 
 * create block text area by text content
 * @param content the text content
 * @param text the text string
 * @param contentDimension the content dimension
 * @param isFirst if this area is the first area of the content
 * @param isLast if this area is the last area of the content
 * @return
 */
protected IArea createBlockTextArea(String text,ITextContent content,FontInfo fi,Dimension contentDimension){
  AbstractArea textArea=(AbstractArea)AreaFactory.createTextArea(content,text,fi);
  textArea.setWidth(Math.min(context.getMaxWidth(),contentDimension.getWidth()));
  textArea.setHeight(Math.min(context.getMaxHeight(),contentDimension.getHeight()));
  return textArea;
}
Program: 76728
Project: 76728
Buggy source:
protected void init(){
  assert(content instanceof IImageContent);
  image=(IImageContent)content;
  maxWidth=parent.getCurrentMaxContentWidth();
  Dimension contentDimension=getSpecifiedDimension(image);
  root=(ContainerArea)createInlineContainer(image,true,true);
  validateBoxProperty(root.getStyle(),maxWidth,context.getMaxHeight());
  root.setAllocatedWidth(maxWidth);
  int maxContentWidth=root.getContentWidth();
  if (contentDimension.getWidth() > maxContentWidth) {
    contentDimension.setDimension(maxContentWidth,(int)(maxContentWidth / contentDimension.getRatio()));
  }
  ImageArea imageArea=(ImageArea)AreaFactory.createImageArea(image);
  imageArea.setWidth(contentDimension.getWidth());
  imageArea.setHeight(contentDimension.getHeight());
  root.addChild(imageArea);
  imageArea.setPosition(root.getContentX(),root.getContentY());
  root.setContentWidth(contentDimension.getWidth());
  root.setContentHeight(contentDimension.getHeight());
}

Fixed version (ground truth):
protected void init(){
  assert(content instanceof IImageContent);
  image=(IImageContent)content;
  maxWidth=parent.getCurrentMaxContentWidth();
  Dimension contentDimension=getSpecifiedDimension(image);
  root=(ContainerArea)createInlineContainer(image,true,true);
  validateBoxProperty(root.getStyle(),maxWidth,context.getMaxHeight());
  root.setAllocatedWidth(maxWidth);
  int maxContentWidth=root.getContentWidth();
  if (contentDimension.getWidth() > maxContentWidth) {
    contentDimension.setDimension(maxContentWidth,(int)(maxContentWidth / contentDimension.getRatio()));
  }
  ImageArea imageArea=(ImageArea)AreaFactory.createImageArea(image);
  imageArea.setWidth(contentDimension.getWidth());
  imageArea.setHeight(contentDimension.getHeight());
  root.addChild(imageArea);
  imageArea.setPosition(root.getContentX(),root.getContentY());
  root.setContentWidth(contentDimension.getWidth());
  root.setContentHeight(Math.min(context.getMaxHeight(),contentDimension.getHeight()));
}
Program: 76729
Project: 76729
Buggy source:
/** 
 * create inline text area by text content
 * @param content the text content
 * @param text the text string
 * @param contentDimension the content dimension
 * @param isFirst if this area is the first area of the content
 * @param isLast if this area is the last area of the content
 * @return
 */
private IArea createInlineTextArea(String text,ITextContent content,FontInfo fi,Dimension contentDimension){
  ContainerArea con=(ContainerArea)createInlineContainer(content,false,false);
  int textHeight=contentDimension.getHeight();
  int textWidth=contentDimension.getWidth();
  con.setWidth(textWidth);
  con.setHeight(textHeight + topPadding + topBorder+ bottomPadding+ bottomBorder);
  AbstractArea textArea=(AbstractArea)AreaFactory.createTextArea(content,text,fi);
  con.addChild(textArea);
  textArea.setHeight(textHeight);
  textArea.setWidth(textWidth);
  textArea.setPosition(0,topPadding + topBorder);
  return con;
}

Fixed version (ground truth):
/** 
 * create inline text area by text content
 * @param content the text content
 * @param text the text string
 * @param contentDimension the content dimension
 * @param isFirst if this area is the first area of the content
 * @param isLast if this area is the last area of the content
 * @return
 */
private IArea createInlineTextArea(String text,ITextContent content,FontInfo fi,Dimension contentDimension){
  ContainerArea con=(ContainerArea)createInlineContainer(content,false,false);
  int textHeight=contentDimension.getHeight();
  int textWidth=contentDimension.getWidth();
  con.setWidth(Math.min(textWidth,context.getMaxWidth()));
  con.setHeight(Math.min(textHeight + topPadding + topBorder+ bottomPadding+ bottomBorder,context.getMaxHeight()));
  AbstractArea textArea=(AbstractArea)AreaFactory.createTextArea(content,text,fi);
  con.addChild(textArea);
  textArea.setHeight(textHeight);
  textArea.setWidth(textWidth);
  textArea.setPosition(0,topPadding + topBorder);
  return con;
}
Program: 76730
Project: 76730
Buggy source:
/** 
 * @param meta
 * @param projectedColumns
 * @throws DataException
 */
private void addOriginalMetadata(IResultClass meta,List projectedColumns) throws DataException {
  for (int i=1; i <= meta.getFieldCount(); i++) {
    projectedColumns.add(new ResultFieldMetadata(i,meta.getFieldName(i),meta.getFieldName(i),meta.getFieldValueClass(i),meta.getFieldNativeTypeName(i),false));
  }
}

Fixed version (ground truth):
/** 
 * @param meta
 * @param projectedColumns
 * @throws DataException
 */
private void addOriginalMetadata(IResultClass meta,List projectedColumns) throws DataException {
  for (int i=1; i <= meta.getFieldCount(); i++) {
    ResultFieldMetadata rfm=new ResultFieldMetadata(i,meta.getFieldName(i),meta.getFieldName(i),meta.getFieldValueClass(i),meta.getFieldNativeTypeName(i),false);
    rfm.setAlias(meta.getFieldAlias(i));
    projectedColumns.add(rfm);
  }
}
Program: 76731
Project: 76731
Buggy source:
public AutoText(ReportElementHandle handle){
  super(handle);
}

Fixed version (ground truth):
public AutoText(ReportItemHandle handle){
  super(handle);
}
Program: 76732
Project: 76732
Buggy source:
public Group(GroupHandle group){
  super(group);
}

Fixed version (ground truth):
public Group(GroupHandle handle){
  super(handle);
}
Program: 76733
Project: 76733
Buggy source:
public boolean canLeaveThePage(){
  return true;
}

Fixed version (ground truth):
public boolean canLeaveThePage(){
  handleLeaveThePage();
  return true;
}
Program: 76734
Project: 76734
Buggy source:
/** 
 * Search the file on the local disk resources.
 * @param fileDir the file directory
 * @param filePath the file path. May contain the relative directory.
 * @return url of the resource if found, null otherwise.
 */
private URL tryDiskFileSearch(String fileDir,String filePath){
  File f=null;
  String tmpFilePath=toUniversalFileFormat(filePath);
  if (StringUtil.isBlank(fileDir))   f=new File(tmpFilePath);
 else   f=new File(fileDir,tmpFilePath);
  try {
    if (f.exists() && f.isFile())     return f.getCanonicalFile().toURL();
  }
 catch (  IOException e) {
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Search the file on the local disk resources.
 * @param fileDir the file directory
 * @param filePath the file path. May contain the relative directory.
 * @return url of the resource if found, null otherwise.
 */
private URL tryDiskFileSearch(String fileDir,String filePath){
  File f=null;
  String tmpFilePath=ModelUtil.toUniversalFileFormat(filePath);
  if (StringUtil.isBlank(fileDir))   f=new File(tmpFilePath);
 else   f=new File(fileDir,tmpFilePath);
  try {
    if (f.exists() && f.isFile())     return f.getCanonicalFile().toURL();
  }
 catch (  IOException e) {
  }
  return null;
}
Program: 76735
Project: 76735
Buggy source:
/** 
 * Converts a filename to a valid URL string. The filename can include directory information, either relative or absolute directory.
 * @param filePath the file name
 * @return a valid URL String
 */
public static String convertFileNameToURLString(String filePath){
  StringBuffer buffer=new StringBuffer();
  String path=filePath;
  if (File.separatorChar != '/')   path=path.replace(File.separatorChar,'/');
  for (int i=0; i < path.length(); i++) {
    char c=path.charAt(i);
    if (c < 0x1F || c == 0x7f)     buffer.append("String_Node_Str" + Character.toString(c));
 else     if (c == '#')     buffer.append("String_Node_Str");
 else     if (c == '%')     buffer.append("String_Node_Str");
 else     if (c == '<')     buffer.append("String_Node_Str");
 else     if (c == '>')     buffer.append("String_Node_Str");
 else     if (c == '"')     buffer.append("String_Node_Str");
 else     buffer.append(c);
  }
  return buffer.toString();
}

Fixed version (ground truth):
/** 
 * Converts a filename to a valid URL string. The filename can include directory information, either relative or absolute directory.
 * @param filePath the file name
 * @return a valid URL String
 */
public static String convertFileNameToURLString(String filePath){
  StringBuffer buffer=new StringBuffer();
  String path=filePath;
  path=ModelUtil.toUniversalFileFormat(path);
  for (int i=0; i < path.length(); i++) {
    char c=path.charAt(i);
    if (c < 0x1F || c == 0x7f)     buffer.append("String_Node_Str" + Character.toString(c));
 else     if (c == '#')     buffer.append("String_Node_Str");
 else     if (c == '%')     buffer.append("String_Node_Str");
 else     if (c == '<')     buffer.append("String_Node_Str");
 else     if (c == '>')     buffer.append("String_Node_Str");
 else     if (c == '"')     buffer.append("String_Node_Str");
 else     buffer.append(c);
  }
  return buffer.toString();
}
Program: 76742
Project: 76742
Buggy source:
/** 
 * Return URL for test table
 * @return
 */
public static String getURL(){
  String url=System.getProperty("String_Node_Str");
  if (url == null)   url="String_Node_Str" + System.getProperty("String_Node_Str") + File.separator+ "String_Node_Str";
  try {
    new File(System.getProperty("String_Node_Str") + File.separator + "String_Node_Str").createNewFile();
  }
 catch (  Exception e) {
  }
  throw new NullPointerException(url + "String_Node_Str" + System.getProperty("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * Return URL for test table
 * @return
 */
public static String getURL(){
  String url=System.getProperty("String_Node_Str");
  if (url == null)   url="String_Node_Str" + System.getProperty("String_Node_Str") + File.separator+ "String_Node_Str";
  return url;
}
Program: 76745
Project: 76745
Buggy source:
public void setUp() throws Exception {
  super.setUp();
  this.USE_ROW_IN_AGGREGATION=false;
  this.GEN_queryResultID=null;
  this.UPDATE_queryResultID=null;
  this.USE_DATE_IN_COLUMNBINDING=true;
  this.GEN_add_subquery=false;
  this.GEN_add_filter=false;
  this.GEN_add_group=false;
  this.GEN_print=false;
  this.GEN_use_invalid_column=false;
  this.UPDATE_add_filter=-1;
  this.UPDATE_add_sort=false;
  this.UPDATE_add_diff_group=false;
  this.UPDATE_add_same_group=false;
  this.UPDATE_add_subquery=0;
  this.PRE_add_filter=-1;
  this.PRE_add_sort=false;
  this.PRE_execute_query=false;
  this.PRE_print_groupinfo=false;
  this.PRE_use_skipto=false;
  this.PRE_use_skipto_num=-1;
  this.PRE_add_group=-1;
  this.PRE_basedon_genfilter=false;
  this.GEN_filterDefn=new ArrayList();
  this.UPDATE_filterDefn=new ArrayList();
  this.TEST_ISEMPTY=false;
  TimeZone.setDefault(TimeZone.getTimeZone("String_Node_Str"));
}

Fixed version (ground truth):
public void setUp() throws Exception {
  super.setUp();
  this.USE_ROW_IN_AGGREGATION=false;
  this.GEN_queryResultID=null;
  this.UPDATE_queryResultID=null;
  this.USE_DATE_IN_COLUMNBINDING=true;
  this.GEN_add_subquery=false;
  this.GEN_add_filter=false;
  this.GEN_add_group=false;
  this.GEN_print=false;
  this.GEN_use_invalid_column=false;
  this.UPDATE_add_filter=-1;
  this.UPDATE_add_sort=false;
  this.UPDATE_add_diff_group=false;
  this.UPDATE_add_same_group=false;
  this.UPDATE_add_subquery=0;
  this.USE_DATE_IN_SUBQUERY=false;
  this.PRE_add_filter=-1;
  this.PRE_add_sort=false;
  this.PRE_execute_query=false;
  this.PRE_print_groupinfo=false;
  this.PRE_use_skipto=false;
  this.PRE_use_skipto_num=-1;
  this.PRE_add_group=-1;
  this.PRE_basedon_genfilter=false;
  this.GEN_filterDefn=new ArrayList();
  this.UPDATE_filterDefn=new ArrayList();
  this.TEST_ISEMPTY=false;
  TimeZone.setDefault(TimeZone.getTimeZone("String_Node_Str"));
}
Program: 76746
Project: 76746
Buggy source:
/** 
 * @throws BirtException
 */
private void genBasicIV() throws BirtException {
  QueryDefinition qd=newGenIVReportQuery();
  if (!this.usesDetails) {
    qd.setUsesDetails(false);
  }
  IQueryResults qr=myGenDataEngine.prepare(qd).execute(scope);
  GEN_queryResultID=qr.getID();
  IResultIterator ri=qr.getResultIterator();
  while (ri.next()) {
    String abc="String_Node_Str";
    for (int i=0; i < rowExprName.length; i++)     abc+=ri.getValue(this.rowExprName[i]) + "String_Node_Str";
    for (int i=0; i < totalExprName.length; i++)     abc+=ri.getValue(this.totalExprName[i]) + "String_Node_Str";
    if (this.GEN_print == true)     this.testPrintln(abc);
    if (this.GEN_add_subquery == true) {
      IResultIterator subRi=ri.getSecondaryIterator(subQueryName1,scope);
      while (subRi.next()) {
        abc="String_Node_Str";
        for (int i=0; i < subRowExprName1.length; i++) {
          abc+=subRi.getValue(subRowExprName1[i]) + "String_Node_Str";
        }
      }
      subRi.close();
    }
  }
  if (this.GEN_print == true)   this.testPrintln("String_Node_Str");
  ri.close();
  qr.close();
  myGenDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 */
private void genBasicIV() throws BirtException {
  QueryDefinition qd=newGenIVReportQuery();
  if (!this.usesDetails) {
    qd.setUsesDetails(false);
  }
  IQueryResults qr=myGenDataEngine.prepare(qd).execute(scope);
  GEN_queryResultID=qr.getID();
  IResultIterator ri=qr.getResultIterator();
  while (ri.next()) {
    String abc="String_Node_Str";
    for (int i=0; i < rowExprName.length; i++)     abc+=ri.getValue(this.rowExprName[i]) + "String_Node_Str";
    for (int i=0; i < totalExprName.length; i++)     abc+=ri.getValue(this.totalExprName[i]) + "String_Node_Str";
    if (this.GEN_print == true)     this.testPrintln(abc);
    if (this.GEN_add_subquery == true) {
      IResultIterator subRi=ri.getSecondaryIterator(subQueryName1,scope);
      while (subRi.next()) {
        abc="String_Node_Str";
        for (int i=0; i < subRowExprName1.length; i++) {
          abc+=subRi.getValue(subRowExprName1[i]) + "String_Node_Str";
        }
        if (this.USE_DATE_IN_SUBQUERY)         abc+=subRi.getValue("String_Node_Str");
      }
      subRi.close();
    }
  }
  if (this.GEN_print == true)   this.testPrintln("String_Node_Str");
  ri.close();
  qr.close();
  myGenDataEngine.shutdown();
}
Program: 76748
Project: 76748
Buggy source:
protected static Command pasteParameterGroup(String commandType,Object childGroup,ParameterGroupHandle targetGroup){
  CompoundCommand commands=new CompoundCommand();
  ParameterGroupHandle childHandle=null;
  if (childGroup instanceof ParameterGroupHandle) {
    childHandle=(ParameterGroupHandle)childGroup;
  }
 else   if (DEUtil.isParameterGroup(childGroup)) {
    childHandle=(ParameterGroupHandle)((IDesignElement)childGroup).getHandle(SessionHandleAdapter.getInstance().getReportDesignHandle().getModule());
  }
  if (childHandle != null) {
    SlotHandle transferSlot=childHandle.getParameters();
    for (Iterator i=transferSlot.iterator(); i.hasNext(); ) {
      commands.add(getNewCommand(commandType,i.next(),targetGroup,-1));
    }
  }
  return commands;
}

Fixed version (ground truth):
protected static Command pasteParameterGroup(String commandType,Object childGroup,ParameterGroupHandle targetGroup) throws SemanticException {
  CompoundCommand commands=new CompoundCommand();
  ParameterGroupHandle childHandle=null;
  if (childGroup instanceof ParameterGroupHandle) {
    childHandle=(ParameterGroupHandle)childGroup;
  }
 else   if (DEUtil.isParameterGroup(childGroup)) {
    childHandle=(ParameterGroupHandle)((IDesignElement)childGroup).getHandle(SessionHandleAdapter.getInstance().getReportDesignHandle().getModule());
  }
  if (childHandle != null) {
    SlotHandle transferSlot=childHandle.getParameters();
    for (Iterator i=transferSlot.iterator(); i.hasNext(); ) {
      commands.add(getNewCommand(commandType,i.next(),targetGroup,-1));
    }
  }
  if (commandType.equals(TYPE_CUT)) {
    childHandle.drop();
  }
  return commands;
}