nus-yam/ex-repair huggingface dataset:
Program: 72960
Project: 72960
Buggy source:
/** 
 * Set cube cursor to a given position. A cube cursor's position is decided by its edge cursors.
 * @param cursor
 * @param position
 * @throws OLAPException 
 * @throws EngineException 
 */
public static void positionCursor(CubeCursor cursor,String position) throws OLAPException, EngineException {
  if (position == null || position.trim().length() == 0)   return;
  if (position.startsWith("String_Node_Str")) {
    position=position.substring(2);
  }
  String[] positions=position.split("String_Node_Str" + POSITION_DELIMITER + "String_Node_Str");
  List edges=getAllEdges(cursor);
  if (positions.length != edges.size())   throw new EngineException("String_Node_Str" + position);
  for (int i=0; i < edges.size(); i++) {
    ((EdgeCursor)edges.get(i)).setPosition(new Long(positions[i]).longValue());
  }
}

Fixed version (ground truth):
/** 
 * Set cube cursor to a given position. A cube cursor's position is decided by its edge cursors.
 * @param cursor
 * @param position
 * @throws OLAPException 
 * @throws EngineException 
 */
public static void positionCursor(CubeCursor cursor,String position) throws OLAPException, EngineException {
  if (position == null || position.trim().length() == 0)   return;
  if (position.startsWith("String_Node_Str")) {
    position=position.substring(2);
  }
  String[] positions=position.split("String_Node_Str" + POSITION_DELIMITER + "String_Node_Str");
  List edges=getAllEdges(cursor);
  for (int i=0; i < edges.size(); i++) {
    ((EdgeCursor)edges.get(i)).setPosition(new Long(positions[i]).longValue());
  }
}
Program: 72961
Project: 72961
Buggy source:
public void visitCascadingParameterGroup(CascadingParameterGroupHandle handle){
  CascadingParameterGroupDefn paramGroup=new CascadingParameterGroupDefn();
  paramGroup.setHandle(handle);
  paramGroup.setParameterType(IParameterDefnBase.CASCADING_PARAMETER_GROUP);
  paramGroup.setName(handle.getName());
  paramGroup.setDisplayName(handle.getDisplayName());
  paramGroup.setDisplayNameKey(handle.getDisplayNameKey());
  paramGroup.setHelpText(handle.getHelpText());
  paramGroup.setHelpTextKey(handle.getHelpTextKey());
  paramGroup.setPromptText(handle.getPromptText());
  DataSetHandle dset=handle.getDataSet();
  if (dset != null) {
    paramGroup.setDataSet(dset.getName());
  }
  SlotHandle parameters=handle.getParameters();
  List properties=handle.getUserProperties();
  for (int i=0; i < properties.size(); i++) {
    UserPropertyDefn p=(UserPropertyDefn)properties.get(i);
    paramGroup.addUserProperty(p.getName(),handle.getProperty(p.getName()));
  }
  int size=parameters.getCount();
  for (int n=0; n < size; n++) {
    apply(parameters.get(n));
    if (currentElement != null) {
      paramGroup.addParameter((IParameterDefnBase)currentElement);
    }
  }
  currentElement=paramGroup;
}

Fixed version (ground truth):
public void visitCascadingParameterGroup(CascadingParameterGroupHandle handle){
  CascadingParameterGroupDefn paramGroup=new CascadingParameterGroupDefn();
  paramGroup.setHandle(handle);
  paramGroup.setParameterType(IParameterDefnBase.CASCADING_PARAMETER_GROUP);
  paramGroup.setName(handle.getName());
  paramGroup.setDisplayName(handle.getDisplayName());
  paramGroup.setDisplayNameKey(handle.getDisplayNameKey());
  paramGroup.setHelpText(handle.getHelpText());
  paramGroup.setHelpTextKey(handle.getHelpTextKey());
  paramGroup.setPromptText(handle.getPromptText());
  paramGroup.setPromptTextKey(handle.getPromptTextKey());
  DataSetHandle dset=handle.getDataSet();
  if (dset != null) {
    paramGroup.setDataSet(dset.getName());
  }
  SlotHandle parameters=handle.getParameters();
  List properties=handle.getUserProperties();
  for (int i=0; i < properties.size(); i++) {
    UserPropertyDefn p=(UserPropertyDefn)properties.get(i);
    paramGroup.addUserProperty(p.getName(),handle.getProperty(p.getName()));
  }
  int size=parameters.getCount();
  for (int n=0; n < size; n++) {
    apply(parameters.get(n));
    if (currentElement != null) {
      paramGroup.addParameter((IParameterDefnBase)currentElement);
    }
  }
  currentElement=paramGroup;
}
Program: 72962
Project: 72962
Buggy source:
/** 
 * Constructs the data request session with the provided session context information.
 * @param context
 * @throws BirtException
 */
public DataRequestSessionImpl(DataSessionContext context) throws BirtException {
  if (context == null)   throw new AdapterException(ResourceConstants.CONEXT_NULL_ERROR);
  dataEngine=(DataEngineImpl)DataEngine.newDataEngine(context.getDataEngineContext());
  modelAdaptor=new ModelAdapter(context);
  sessionContext=context;
  cubeHandleMap=new HashMap();
  dataSetCache=new HashSet();
}

Fixed version (ground truth):
/** 
 * Constructs the data request session with the provided session context information.
 * @param context
 * @throws BirtException
 */
public DataRequestSessionImpl(DataSessionContext context) throws BirtException {
  if (context == null)   throw new AdapterException(ResourceConstants.CONEXT_NULL_ERROR);
  dataEngine=(DataEngineImpl)DataEngine.newDataEngine(context.getDataEngineContext());
  modelAdaptor=new ModelAdapter(context);
  sessionContext=context;
  cubeHandleMap=new HashMap();
  dataSetCache=new HashSet();
  stopSign=new StopSign();
}
Program: 72963
Project: 72963
Buggy source:
/** 
 * create a <code>DataEngine</code> given an execution context
 * @param context the execution context
 * @return a data engine instance
 */
public IDataEngine createDataEngine(ExecutionContext context) throws Exception {
  IDocArchiveReader dataSource=context.getDataSource();
  if (dataSource != null) {
    ReportDocumentWriter writer=context.getReportDocWriter();
    IDocArchiveWriter archiverWriter=null;
    if (writer != null) {
      archiverWriter=writer.getArchive();
    }
    return new DataInteractiveEngine(context,dataSource,archiverWriter);
  }
  ReportDocumentWriter writer=context.getReportDocWriter();
  if (writer != null) {
    return new DataGenerationEngine(context,context.getReportDocWriter().getArchive());
  }
  IReportDocument document=context.getReportDocument();
  if (document != null) {
    return new DataPresentationEngine(context,context.getReportDocument().getArchive());
  }
  return new DteDataEngine(context);
}

Fixed version (ground truth):
/** 
 * create a <code>DataEngine</code> given an execution context
 * @param context the execution context
 * @return a data engine instance
 */
public IDataEngine createDataEngine(ExecutionContext context) throws Exception {
  IDocArchiveReader dataSource=context.getDataSource();
  if (dataSource != null) {
    ReportDocumentWriter writer=context.getReportDocWriter();
    IDocArchiveWriter archiverWriter=null;
    if (writer != null) {
      archiverWriter=writer.getArchive();
    }
    return new DataInteractiveEngine(context,dataSource,archiverWriter);
  }
  ReportDocumentWriter writer=context.getReportDocWriter();
  if (writer != null) {
    return new DataGenerationEngine(context,context.getReportDocWriter().getArchive());
  }
  IReportDocument document=context.getReportDocument();
  if (document != null) {
    if (context.getEngineTask().getTaskType() == EngineTask.TASK_DATAEXTRACTION) {
      return new DataInteractiveEngine(context,context.getReportDocument().getArchive(),null);
    }
    return new DataPresentationEngine(context,context.getReportDocument().getArchive());
  }
  return new DteDataEngine(context);
}
Program: 72964
Project: 72964
Buggy source:
public DataInteractiveEngine(ExecutionContext context,IDocArchiveReader reader,IDocArchiveWriter writer) throws Exception {
  super(context);
  DataSessionContext dteSessionContext;
  if (writer == null) {
    dteSessionContext=new DataSessionContext(DataSessionContext.MODE_PRESENTATION,null,context.getSharedScope());
    dteSessionContext.setDocumentReader(reader);
  }
 else {
    dteSessionContext=new DataSessionContext(DataSessionContext.MODE_UPDATE,null,context.getSharedScope());
    dteSessionContext.setDocumentReader(reader);
    dteSessionContext.setDocumentWriter(writer);
  }
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
  if (writer != null && dos == null) {
    dos=new DataOutputStream(writer.createRandomAccessStream(ReportDocumentConstants.DATA_SNAP_META_STREAM));
    DteMetaInfoIOUtil.startMetaInfo(dos);
  }
}

Fixed version (ground truth):
public DataInteractiveEngine(ExecutionContext context,IDocArchiveReader reader,IDocArchiveWriter writer) throws Exception {
  super(context);
  DataSessionContext dteSessionContext=new DataSessionContext(DataSessionContext.MODE_UPDATE,null,context.getSharedScope());
  dteSessionContext.setDocumentReader(reader);
  dteSessionContext.setDocumentWriter(writer);
  DataEngineContext dteEngineContext=dteSessionContext.getDataEngineContext();
  dteEngineContext.setLocale(context.getLocale());
  String tempDir=getTempDir(context);
  if (tempDir != null) {
    dteEngineContext.setTmpdir(tempDir);
  }
  dteSession=DataRequestSession.newSession(dteSessionContext);
  loadDteMetaInfo(reader);
  if (writer != null && dos == null) {
    dos=new DataOutputStream(writer.createRandomAccessStream(ReportDocumentConstants.DATA_SNAP_META_STREAM));
    DteMetaInfoIOUtil.startMetaInfo(dos);
  }
}
Program: 72965
Project: 72965
Buggy source:
/** 
 * Test add a filter in presentation mode.
 * @throws Exception
 */
public void testBasic6() throws Exception {
  this.GEN_print=true;
  this.GEN_add_filter=false;
  this.genBasicIV();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_PRESENTATION,fileName,fileName);
  deContext2.setTmpdir(this.getTempDir());
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_filter=0;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.checkOutputFile();
}

Fixed version (ground truth):
/** 
 * Test add a filter in presentation mode.
 * @throws Exception
 */
public void testBasic6() throws Exception {
  this.GEN_print=true;
  this.GEN_add_filter=false;
  this.genBasicIV();
  this.closeArchiveWriter();
  DataEngineContext deContext2=newContext(DataEngineContext.MODE_UPDATE,fileName,fileName);
  deContext2.setTmpdir(this.getTempDir());
  myPreDataEngine=DataEngine.newDataEngine(deContext2);
  this.UPDATE_add_filter=0;
  this.updatePreBasicIV();
  this.closeArchiveReader();
  this.checkOutputFile();
}
Program: 72966
Project: 72966
Buggy source:
/** 
 * Outputs an hyperlink action.
 * @param action the hyperlink action.
 */
protected void outputAction(IHyperlinkAction action,String url){
  writer.openTag(HTMLTags.TAG_A);
  writer.attribute(HTMLTags.ATTR_HREF,url);
  writer.attribute(HTMLTags.ATTR_TARGET,action.getTargetWindow());
}

Fixed version (ground truth):
/** 
 * Outputs an hyperlink action.
 * @param action the hyperlink action.
 */
protected void outputAction(IHyperlinkAction action,String url){
  writer.openTag(HTMLTags.TAG_A);
  writer.attribute(HTMLTags.ATTR_HREF,url);
  writer.attribute(HTMLTags.ATTR_TARGET,action.getTargetWindow());
  writer.attribute(HTMLTags.ATTR_TITLE,action.getTooltip());
}
Program: 72968
Project: 72968
Buggy source:
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_TYPE:
    type=IOUtil.readInt(in);
  if (type == ACTION_DRILLTHROUGH) {
    drillThrough=new DrillThroughAction();
  }
break;
case FIELD_BOOKMARK:
String bk=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setBookmark(bk);
}
 else {
bookmark=bk;
}
break;
case FIELD_HYPERLINK:
hyperlink=IOUtil.readString(in);
break;
case FIELD_REPORTNAME:
String name=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setReportName(name);
}
break;
case FIELD_PARAMETERBINDINGS:
Map bindings=IOUtil.readMap(in,loader);
if (isDrillThrough()) {
drillThrough.setParameterBindings(bindings);
}
break;
case FIELD_SEARCHCRITERIA:
Map search=IOUtil.readMap(in,loader);
if (isDrillThrough()) {
drillThrough.setSearchCriteria(search);
}
break;
case FIELD_TARGET:
String tgt=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setTargetWindow(tgt);
}
 else {
target=tgt;
}
break;
case FIELD_FORMAT:
String fmt=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setFormat(fmt);
}
break;
case FIELD_ISBOOKMARK:
boolean isBk=IOUtil.readBool(in);
if (isDrillThrough()) {
drillThrough.setBookmarkType(isBk);
}
break;
case FIELD_TARGETFILETYPE:
String tgtType=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setTargetFileType(tgtType);
}
break;
}
}

Fixed version (ground truth):
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_TYPE:
    type=IOUtil.readInt(in);
  if (type == ACTION_DRILLTHROUGH) {
    drillThrough=new DrillThroughAction();
  }
break;
case FIELD_BOOKMARK:
String bk=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setBookmark(bk);
}
 else {
bookmark=bk;
}
break;
case FIELD_HYPERLINK:
hyperlink=IOUtil.readString(in);
break;
case FIELD_REPORTNAME:
String name=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setReportName(name);
}
break;
case FIELD_PARAMETERBINDINGS:
Map bindings=IOUtil.readMap(in,loader);
if (isDrillThrough()) {
drillThrough.setParameterBindings(bindings);
}
break;
case FIELD_SEARCHCRITERIA:
Map search=IOUtil.readMap(in,loader);
if (isDrillThrough()) {
drillThrough.setSearchCriteria(search);
}
break;
case FIELD_TARGET:
String tgt=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setTargetWindow(tgt);
}
 else {
target=tgt;
}
break;
case FIELD_FORMAT:
String fmt=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setFormat(fmt);
}
break;
case FIELD_ISBOOKMARK:
boolean isBk=IOUtil.readBool(in);
if (isDrillThrough()) {
drillThrough.setBookmarkType(isBk);
}
break;
case FIELD_TARGETFILETYPE:
String tgtType=IOUtil.readString(in);
if (isDrillThrough()) {
drillThrough.setTargetFileType(tgtType);
}
break;
case FIELD_TOOLTIP:
tooltip=IOUtil.readString(in);
break;
}
}
Program: 72969
Project: 72969
Buggy source:
protected void writeFields(DataOutputStream out) throws IOException {
  super.writeFields(out);
  if (columns != null) {
    IOUtil.writeShort(out,FIELD_COLUMNS);
    Column column;
    IOUtil.writeInt(out,columns.size());
    for (int i=0; i < columns.size(); i++) {
      column=(Column)columns.get(i);
      column.writeObject(out);
    }
  }
  if (caption != null) {
    IOUtil.writeShort(out,FIELD_CAPTION);
    IOUtil.writeString(out,caption);
  }
  if (captionKey != null) {
    IOUtil.writeShort(out,FIELD_CAPTIONKEY);
    IOUtil.writeString(out,captionKey);
  }
  if (headerRepeat != null) {
    IOUtil.writeShort(out,FIELD_HEADERREPEAT);
    IOUtil.writeBool(out,headerRepeat.booleanValue());
  }
}

Fixed version (ground truth):
protected void writeFields(DataOutputStream out) throws IOException {
  super.writeFields(out);
  if (columns != null) {
    IOUtil.writeShort(out,FIELD_COLUMNS);
    Column column;
    IOUtil.writeInt(out,columns.size());
    for (int i=0; i < columns.size(); i++) {
      column=(Column)columns.get(i);
      column.writeObject(out);
    }
  }
  if (caption != null) {
    IOUtil.writeShort(out,FIELD_CAPTION);
    IOUtil.writeString(out,caption);
  }
  if (captionKey != null) {
    IOUtil.writeShort(out,FIELD_CAPTIONKEY);
    IOUtil.writeString(out,captionKey);
  }
  if (headerRepeat != null) {
    IOUtil.writeShort(out,FIELD_HEADERREPEAT);
    IOUtil.writeBool(out,headerRepeat.booleanValue());
  }
  if (summary != null) {
    IOUtil.writeShort(out,FIELD_SUMMARY);
    IOUtil.writeString(out,summary);
  }
}
Program: 72970
Project: 72970
Buggy source:
public String getCaptionKey(){
  if (captionKey == null) {
    if (generateBy instanceof TableItemDesign)     return ((TableItemDesign)generateBy).getCaptionKey();
  }
  return captionKey;
}

Fixed version (ground truth):
public String getCaptionKey(){
  if (captionKey == null) {
    if (generateBy instanceof TableItemDesign) {
      return ((TableItemDesign)generateBy).getCaptionKey();
    }
 else     if (generateBy instanceof GridItemDesign) {
      return ((GridItemDesign)generateBy).getCaptionKey();
    }
  }
  return captionKey;
}
Program: 72971
Project: 72971
Buggy source:
/** 
 * @return Returns the caption.
 */
public String getCaption(){
  if (caption == null) {
    if (generateBy instanceof TableItemDesign) {
      return ((TableItemDesign)generateBy).getCaption();
    }
  }
  return caption;
}

Fixed version (ground truth):
/** 
 * @return Returns the caption.
 */
public String getCaption(){
  if (caption == null) {
    if (generateBy instanceof TableItemDesign) {
      return ((TableItemDesign)generateBy).getCaption();
    }
 else     if (generateBy instanceof GridItemDesign) {
      return ((GridItemDesign)generateBy).getCaption();
    }
  }
  return caption;
}
Program: 72972
Project: 72972
Buggy source:
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_COLUMNS:
    int columnsSize=IOUtil.readInt(in);
  for (int i=0; i < columnsSize; i++) {
    Column column=new Column(report);
    column.readObject(in,loader);
    addColumn(column);
  }
break;
case FIELD_CAPTION:
caption=IOUtil.readString(in);
break;
case FIELD_CAPTIONKEY:
captionKey=IOUtil.readString(in);
break;
case FIELD_HEADERREPEAT:
headerRepeat=Boolean.valueOf(IOUtil.readBool(in));
break;
default :
super.readField(version,filedId,in,loader);
}
}

Fixed version (ground truth):
protected void readField(int version,int filedId,DataInputStream in,ClassLoader loader) throws IOException {
switch (filedId) {
case FIELD_COLUMNS:
    int columnsSize=IOUtil.readInt(in);
  for (int i=0; i < columnsSize; i++) {
    Column column=new Column(report);
    column.readObject(in,loader);
    addColumn(column);
  }
break;
case FIELD_CAPTION:
caption=IOUtil.readString(in);
break;
case FIELD_CAPTIONKEY:
captionKey=IOUtil.readString(in);
break;
case FIELD_SUMMARY:
summary=IOUtil.readString(in);
break;
case FIELD_HEADERREPEAT:
headerRepeat=Boolean.valueOf(IOUtil.readBool(in));
break;
default :
super.readField(version,filedId,in,loader);
}
}
Program: 72974
Project: 72974
Buggy source:
private void initHostChart(){
  if (ChartXTabUtil.isAxisChart(handle)) {
    hostChartHandle=(ExtendedItemHandle)handle.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
    if (hostChartHandle == null || hostChartHandle == handle) {
      return;
    }
    cm=ChartReportItemUtil.getChartFromHandle(hostChartHandle);
    if (cm instanceof ChartWithAxes) {
      int axisType=((ChartWithAxes)cm).isTransposed() ? ICrosstabConstants.ROW_AXIS_TYPE : ICrosstabConstants.COLUMN_AXIS_TYPE;
      hostChartHandle.addListener(ChartXTabUtil.createSyncChartListener(hostChartHandle,(ExtendedItemHandle)handle,axisType));
      handle.addListener(ChartXTabUtil.createSyncChartListener((ExtendedItemHandle)handle,hostChartHandle,axisType));
      hostChartHandle.getContainer().addListener(ChartXTabUtil.createDeleteChartListener(hostChartHandle,handle));
    }
  }
}

Fixed version (ground truth):
private void initHostChart(){
  if (ChartXTabUtil.isAxisChart(handle)) {
    hostChartHandle=(ExtendedItemHandle)handle.getElementProperty(ChartReportItemUtil.PROPERTY_HOST_CHART);
    if (hostChartHandle == null || hostChartHandle == handle) {
      return;
    }
    cm=ChartReportItemUtil.getChartFromHandle(hostChartHandle);
    if (cm instanceof ChartWithAxes) {
      hostChartHandle.getContainer().addListener(ChartXTabUtil.createDeleteChartListener(hostChartHandle,handle));
    }
  }
}
Program: 72975
Project: 72975
Buggy source:
public static String createTempRootDir(String tempDir){
  String rootDirStr=null;
  File tempDtEDir=null;
  tempDtEDir=new File(tempDir,"String_Node_Str" + System.currentTimeMillis() + cacheCounter1);
  cacheCounter1.add(1);
  int x=0;
  while (tempDtEDir.exists()) {
    x++;
    tempDtEDir=new File(tempDir,"String_Node_Str" + System.currentTimeMillis() + cacheCounter1+ "String_Node_Str"+ x);
  }
  tempDtEDir.mkdirs();
  tempDtEDir.deleteOnExit();
  rootDirStr=getCanonicalPath(tempDtEDir);
  return rootDirStr;
}

Fixed version (ground truth):
public static String createTempRootDir(String tempDir){
  String rootDirStr=null;
  File tempDtEDir=null;
  tempDtEDir=new File(tempDir,"String_Node_Str" + System.currentTimeMillis() + cacheCounter1.intValue());
  cacheCounter1.add(1);
  int x=0;
  while (tempDtEDir.exists()) {
    x++;
    tempDtEDir=new File(tempDir,"String_Node_Str" + System.currentTimeMillis() + cacheCounter1.intValue()+ "String_Node_Str"+ x);
  }
  tempDtEDir.mkdirs();
  tempDtEDir.deleteOnExit();
  rootDirStr=getCanonicalPath(tempDtEDir);
  return rootDirStr;
}
Program: 72976
Project: 72976
Buggy source:
public Control createDialogArea(Composite parent){
  Control dialogArea=super.createDialogArea(parent);
  getSQLBuilder().addContentChangeListener(this);
  return dialogArea;
}

Fixed version (ground truth):
public Control createDialogArea(Composite parent){
  Control dialogArea=m_dialog.createDialogArea(parent);
  m_dialog.getSQLBuilder().addContentChangeListener(this);
  return dialogArea;
}
Program: 72977
Project: 72977
Buggy source:
public CustomSQLBuilderDialog(Shell parentShell){
  super(parentShell);
}

Fixed version (ground truth):
public CustomSQLBuilderDialog(Shell parentShell){
  m_dialog=new SQLBuilderDialogWrapper(parentShell);
}
Program: 72978
Project: 72978
Buggy source:
/** 
 * Marks the dialog to have a changed state.
 * @param dirty
 */
public void setDirty(boolean dirty){
  getSQLBuilder().setDirty(dirty);
}

Fixed version (ground truth):
/** 
 * Marks the dialog to have a changed state.
 * @param dirty
 */
public void setDirty(boolean dirty){
  m_dialog.getSQLBuilder().setDirty(dirty);
}
Program: 72979
Project: 72979
Buggy source:
public boolean setInput(ISQLBuilderEditorInput editorInput){
  try {
    return super.setInput(editorInput);
  }
 catch (  RuntimeException ex) {
    ex.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
/** 
 * This method add the visibility of SQLBuilderDialog.setInput();
 */
public boolean setInput(ISQLBuilderEditorInput editorInput){
  return super.setInput(editorInput);
}
Program: 72980
Project: 72980
Buggy source:
public boolean isDirty(){
  return getSQLBuilder().isDirty();
}

Fixed version (ground truth):
public boolean isDirty(){
  return m_dialog.getSQLBuilder().isDirty();
}
Program: 72981
Project: 72981
Buggy source:
QueryStatement getSQLQueryStatement(){
  return getSQLBuilder().getDomainModel().getSQLStatement();
}

Fixed version (ground truth):
QueryStatement getSQLQueryStatement(){
  return m_dialog.getSQLBuilder().getDomainModel().getSQLStatement();
}
Program: 72982
Project: 72982
Buggy source:
private void updateDirtyStatus(){
  Shell dialogShell=getShell();
  if (dialogShell == null || dialogShell.getText() == null)   return;
  if (isDirty()) {
    if (!dialogShell.getText().startsWith(DIRTY_STATUS_MARK)) {
      dialogShell.setText(DIRTY_STATUS_MARK + getShell().getText());
    }
  }
 else   if (dialogShell.getText().startsWith(DIRTY_STATUS_MARK)) {
    dialogShell.setText(dialogShell.getText().substring(1));
  }
}

Fixed version (ground truth):
private void updateDirtyStatus(){
  Shell dialogShell=m_dialog.getShell();
  if (dialogShell == null || dialogShell.getText() == null)   return;
  if (isDirty()) {
    if (!dialogShell.getText().startsWith(DIRTY_STATUS_MARK)) {
      dialogShell.setText(DIRTY_STATUS_MARK + dialogShell.getText());
    }
  }
 else   if (dialogShell.getText().startsWith(DIRTY_STATUS_MARK)) {
    dialogShell.setText(dialogShell.getText().substring(1));
  }
}
Program: 72983
Project: 72983
Buggy source:
public boolean close(){
  getSQLBuilder().removeContentChangeListener(this);
  return super.close();
}

Fixed version (ground truth):
public boolean close(){
  m_dialog.getSQLBuilder().removeContentChangeListener(this);
  return m_dialog.close();
}
Program: 72984
Project: 72984
Buggy source:
private String getSQLBuilderState(String sqbInputName){
  SQLBuilder sqlBuilder=getSQLBuilder();
  if (sqlBuilder == null)   return null;
  SQLBuilderStorageEditorInput storageEditorInput=new SQLBuilderStorageEditorInput(sqbInputName,sqlBuilder.getSQL());
  storageEditorInput.setConnectionInfo(sqlBuilder.getConnectionInfo());
  storageEditorInput.setOmitSchemaInfo(sqlBuilder.getOmitSchemaInfo());
  storageEditorInput.setInputUsageOptions(sqlBuilder.getEditorInputUsageOptions());
  storageEditorInput.setWindowStateInfo(sqlBuilder.getWindowStateInfo());
  XMLMemento memento=SQLBuilderEditorInputUtil.saveSQLBuilderStorageEditorInput(storageEditorInput);
  String sqbState=SQLBuilderEditorInputUtil.writeXMLMementoToString(memento);
  return sqbState;
}

Fixed version (ground truth):
private String getSQLBuilderState(String sqbInputName){
  SQLBuilder sqlBuilder=m_dialog.getSQLBuilder();
  if (sqlBuilder == null)   return null;
  SQLBuilderStorageEditorInput storageEditorInput=new SQLBuilderStorageEditorInput(sqbInputName,sqlBuilder.getSQL());
  storageEditorInput.setConnectionInfo(sqlBuilder.getConnectionInfo());
  storageEditorInput.setOmitSchemaInfo(sqlBuilder.getOmitSchemaInfo());
  storageEditorInput.setInputUsageOptions(sqlBuilder.getEditorInputUsageOptions());
  storageEditorInput.setWindowStateInfo(sqlBuilder.getWindowStateInfo());
  XMLMemento memento=SQLBuilderEditorInputUtil.saveSQLBuilderStorageEditorInput(storageEditorInput);
  String sqbState=SQLBuilderEditorInputUtil.writeXMLMementoToString(memento);
  return sqbState;
}
Program: 72985
Project: 72985
Buggy source:
private IWindowStateInfo createDefaultWindowState(){
  IControlStateInfo outlineControlState=new ControlStateInfo(IControlStateInfo.OUTLINE_CONTROL);
  outlineControlState.setIsVisible(false);
  IWindowStateInfo windowState=new WindowStateInfo();
  windowState.put(outlineControlState.getControlType(),outlineControlState);
  return windowState;
}

Fixed version (ground truth):
private IWindowStateInfo createDefaultWindowState(){
  IControlStateInfo outlineControlState=new ControlStateInfo(IControlStateInfo.OUTLINE_CONTROL);
  outlineControlState.setIsVisible(false);
  IWindowStateInfo windowState=new WindowStateInfo();
  windowState.put(outlineControlState.getControlType(),outlineControlState);
  windowState.setHeight(SQBCONTROL_HEIGHT);
  return windowState;
}
Program: 72986
Project: 72986
Buggy source:
/** 
 * Format and raise an user message if the specified status is not OK.
 * @param connectStatus
 */
void done(IStatus connectStatus){
  if (connectStatus != null && connectStatus.isOK())   return;
  if (connectStatus == null) {
    ExceptionHandler.showException(m_parentShell,Messages.sqbWizPage_cannotOpenConnectionTitle,Messages.sqbWizPage_cannotOpenConnectionMsg,null);
  }
  String errorMessage=Messages.sqbWizPage_cannotOpenConnectionMsg + NEWLINE_CHAR + Messages.sqbWizPage_dbErrorMsg;
  errorMessage+=connectStatus.getMessage();
  String detailMessages=EMPTY_STR;
  IStatus[] childrenStatus=connectStatus.getChildren();
  Throwable ex=connectStatus.getException();
  for (int i=0; i < childrenStatus.length; i++) {
    if (detailMessages.length() > 0)     detailMessages+=NEWLINE_CHAR;
    detailMessages+=childrenStatus[i].getMessage();
    if (ex == null)     ex=childrenStatus[i].getException();
  }
  ExceptionHandler.showException(m_parentShell,Messages.sqbWizPage_cannotOpenConnectionTitle,errorMessage,ex);
}

Fixed version (ground truth):
/** 
 * Format and raise an user message if the specified status is not OK.
 * @param connectStatus
 */
void done(IStatus connectStatus){
  if (connectStatus != null && connectStatus.isOK())   return;
  if (connectStatus == null) {
    ExceptionHandler.showException(m_parentShell,Messages.sqbWizPage_cannotOpenConnectionTitle,Messages.sqbWizPage_cannotOpenConnectionMsg,null);
  }
  String errorMessage=Messages.sqbWizPage_cannotOpenConnectionMsg + NEWLINE_CHAR + Messages.sqbWizPage_dbErrorMsg;
  errorMessage+=connectStatus.getMessage();
  IStatus[] childrenStatus=connectStatus.getChildren();
  Throwable ex=connectStatus.getException();
  for (int i=0; i < childrenStatus.length; i++) {
    if (ex == null)     ex=childrenStatus[i].getException();
  }
  ExceptionHandler.showException(m_parentShell,Messages.sqbWizPage_cannotOpenConnectionTitle,errorMessage,ex);
}
Program: 72987
Project: 72987
Buggy source:
private void outputSfnts(PrintStream out){
  out.println("String_Node_Str");
  String[] tablesDesired={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  String[] bigTablesDesired={"String_Node_Str","String_Node_Str"};
  List tablesToAdd=new ArrayList();
  addExistedTables(tablesToAdd,tablesDesired);
  addExistedTables(tablesToAdd,bigTablesDesired);
  Util.putInt16(directoryRawData,4,tablesToAdd.size() + 1);
  out.print("String_Node_Str");
  out.println(Util.toHexString(directoryRawData));
  int offset=12 + (tablesToAdd.size() + 1) * 16;
  StringBuffer tableContent=new StringBuffer();
  for (int i=0; i < tablesToAdd.size(); i++) {
    String name=(String)tablesToAdd.get(i);
    if (isBigTable(name,bigTablesDesired)) {
      offset=addBigTable(out,offset,name,tableContent);
    }
 else {
      offset=addTable(out,offset,name,tableContent);
    }
  }
  outputGdirTable(out);
  out.print("String_Node_Str");
  out.println(tableContent.toString());
  out.println("String_Node_Str");
}

Fixed version (ground truth):
private void outputSfnts(PrintStream out){
  out.println("String_Node_Str");
  String[] tablesDesired={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  List tablesToAdd=new ArrayList();
  addTables(tablesToAdd,tablesDesired);
  Util.putInt16(directoryRawData,4,tablesToAdd.size() + 1);
  out.print("String_Node_Str");
  out.println(Util.toHexString(directoryRawData));
  int offset=12 + (tablesToAdd.size() + 1) * 16;
  StringBuffer tableContent=new StringBuffer();
  for (int i=0; i < tablesToAdd.size(); i++) {
    String name=(String)tablesToAdd.get(i);
    offset=addTable(out,offset,name,tableContent);
  }
  outputGdirTable(out);
  out.print("String_Node_Str");
  out.println(tableContent.toString());
  out.println("String_Node_Str");
}
Program: 72988
Project: 72988
Buggy source:
private int addTable(PrintStream out,int offset,String name,StringBuffer tableContent){
  int result=0;
  try {
    int[] tableLocation=getTableLocation(name);
    if (tableLocation != null) {
      byte[] tableMetadata=(byte[])metadataTables.get(name);
      Util.putInt32(tableMetadata,8,offset);
      result=offset + getEvenLength(tableLocation[1]);
      out.println(Util.toHexString(tableMetadata));
      byte[] data=readTable(name);
      tableContent.append("String_Node_Str" + toPSDataString(Util.toHexString(data)));
    }
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,"String_Node_Str" + name);
  }
  return result;
}

Fixed version (ground truth):
private int addTable(PrintStream out,int offset,String name,StringBuffer tableContent){
  int result=0;
  try {
    int[] tableLocation=getTableLocation(name);
    if (tableLocation != null) {
      byte[] tableMetadata=(byte[])metadataTables.get(name);
      Util.putInt32(tableMetadata,8,offset);
      out.println(Util.toHexString(tableMetadata));
      result=offset + getEvenLength(tableLocation[1]);
      List<byte[]> datas=readTable(name);
      for (      byte[] data : datas) {
        tableContent.append("String_Node_Str" + toPSDataString(Util.toHexString(data)));
      }
    }
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,"String_Node_Str" + name);
  }
  return result;
}
Program: 72989
Project: 72989
Buggy source:
private byte[] readTable(String name) throws DocumentException, IOException {
  int[] tableLocation;
  tableLocation=getTableLocation(name);
  if (tableLocation == null) {
    return null;
  }
  rf.seek(tableLocation[0]);
  byte[] data=readDataWithPadding(tableLocation[1]);
  return data;
}

Fixed version (ground truth):
private List<byte[]> readTable(String name) throws DocumentException, IOException {
  ArrayList<byte[]> result=new ArrayList<byte[]>();
  int[] tableLocation;
  tableLocation=getTableLocation(name);
  if (tableLocation == null) {
    return null;
  }
  int maxString=MAX_STRING_LENGTH;
  int length=tableLocation[1];
  rf.seek(tableLocation[0]);
  while (length > maxString) {
    length-=maxString;
    result.add(readDataWithPadding(maxString));
  }
  result.add(readDataWithPadding(length));
  return result;
}
Program: 72991
Project: 72991
Buggy source:
/** 
 * Closes the document.
 */
public void end(){
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println(("String_Node_Str" + (pageWidth * 8) + "String_Node_Str"+ (pageHeight * 8)+ "String_Node_Str"));
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"+ (i + 1)+ "String_Node_Str"));
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"));
    if (fileNamesLists.containsKey(new Integer(i + 1))) {
      List filenames=(List)fileNamesLists.get(new Integer(i + 1));
      for (Iterator ite=filenames.iterator(); ite.hasNext(); ) {
        println(("String_Node_Str" + (String)ite.next() + "String_Node_Str"));
      }
    }
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  writer.close();
  writer=null;
}

Fixed version (ground truth):
/** 
 * Closes the document.
 */
public void end(){
  int slidesizex=(int)(Math.ceil(pageWidth * 8));
  int slidesizey=(int)(Math.ceil(pageHeight * 8));
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println(("String_Node_Str" + slidesizex + "String_Node_Str"+ slidesizey+ "String_Node_Str"));
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"+ (i + 1)+ "String_Node_Str"));
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  for (int i=0; i < currentPageNum; i++) {
    println(("String_Node_Str" + (i + 1) + "String_Node_Str"));
    if (fileNamesLists.containsKey(new Integer(i + 1))) {
      List filenames=(List)fileNamesLists.get(new Integer(i + 1));
      for (Iterator ite=filenames.iterator(); ite.hasNext(); ) {
        println(("String_Node_Str" + (String)ite.next() + "String_Node_Str"));
      }
    }
  }
  println("String_Node_Str");
  println("String_Node_Str");
  println("String_Node_Str");
  writer.close();
  writer=null;
}
Program: 72992
Project: 72992
Buggy source:
public void buildMenu(IMenuManager menu,List selectedList){
  if (selectedList != null && selectedList.size() == 1 && selectedList.get(0) instanceof ExtendedItemHandle) {
    ExtendedItemHandle handle=(ExtendedItemHandle)selectedList.get(0);
    if (handle.getExtensionName().equals("String_Node_Str")) {
      Separator separator=new Separator("String_Node_Str");
      if (menu.getItems().length > 0) {
        menu.insertBefore(menu.getItems()[0].getId(),separator);
      }
 else {
        menu.add(separator);
      }
      menu.appendToGroup(separator.getId(),new OpenTaskSelectTypeAction(handle));
      menu.appendToGroup(separator.getId(),new OpenTaskSelectDataAction(handle));
      menu.appendToGroup(separator.getId(),new OpenTaskFormatChartAction(handle));
    }
  }
}

Fixed version (ground truth):
public void buildMenu(IMenuManager menu,List selectedList){
  if (selectedList != null && selectedList.size() == 1 && ChartReportItemUtil.isChartHandle(selectedList.get(0))) {
    ExtendedItemHandle handle=(ExtendedItemHandle)selectedList.get(0);
    Separator separator=new Separator("String_Node_Str");
    if (menu.getItems().length > 0) {
      menu.insertBefore(menu.getItems()[0].getId(),separator);
    }
 else {
      menu.add(separator);
    }
    menu.appendToGroup(separator.getId(),new OpenChartTaskAction(handle,"String_Node_Str",Messages.getString("String_Node_Str"),true));
    menu.appendToGroup(separator.getId(),new OpenChartTaskAction(handle,"String_Node_Str",Messages.getString("String_Node_Str"),false));
    menu.appendToGroup(separator.getId(),new OpenChartTaskAction(handle,"String_Node_Str",Messages.getString("String_Node_Str"),false));
    if (ChartXTabUtil.isPlotChart(handle) || ChartXTabUtil.isAxisChart(handle)) {
      menu.appendToGroup(separator.getId(),new FlipAxisAction(handle));
    }
  }
}
Program: 72995
Project: 72995
Buggy source:
/** 
 * Updates Axis chart in Xtab by replacing date item with axis chart.
 * @param cell
 * @param bTransposed
 * @param hostChartHandle
 * @throws BirtException
 */
public static void updateAxisChart(AggregationCellHandle cell,boolean bTransposed,ExtendedItemHandle hostChartHandle) throws BirtException {
  int axisType=bTransposed ? ICrosstabConstants.ROW_AXIS_TYPE : ICrosstabConstants.COLUMN_AXIS_TYPE;
  if (cell.getCrosstab().getGrandTotal(axisType) != null) {
    AggregationCellHandle grandTotalAggCell;
    if (bTransposed) {
      grandTotalAggCell=((MeasureViewHandle)cell.getContainer()).getAggregationCell(null,null,cell.getDimensionName(ICrosstabConstants.COLUMN_AXIS_TYPE),cell.getLevelName(ICrosstabConstants.COLUMN_AXIS_TYPE));
    }
 else {
      grandTotalAggCell=((MeasureViewHandle)cell.getContainer()).getAggregationCell(cell.getDimensionName(ICrosstabConstants.ROW_AXIS_TYPE),cell.getLevelName(ICrosstabConstants.ROW_AXIS_TYPE),null,null);
    }
    Object content=ChartXTabUtil.getFirstContent(grandTotalAggCell);
    if (content instanceof DataItemHandle) {
      ExtendedItemHandle axisChartHandle=createChartHandle(cell.getModelHandle(),ChartReportItemConstants.TYPE_AXIS_CHART,hostChartHandle);
      grandTotalAggCell.addContent(axisChartHandle,0);
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates Axis chart in Xtab by replacing date item with axis chart.
 * @param cell
 * @param bTransposed
 * @param hostChartHandle
 * @throws BirtException
 */
public static void updateAxisChart(AggregationCellHandle cell,boolean bTransposed,ExtendedItemHandle hostChartHandle) throws BirtException {
  if (getGrandTotalCell(cell,bTransposed) != null) {
    AggregationCellHandle grandTotalAggCell=getGrandTotalAggregationCell(cell,bTransposed);
    Object content=ChartXTabUtil.getFirstContent(grandTotalAggCell);
    if (content instanceof DataItemHandle) {
      ExtendedItemHandle axisChartHandle=createChartHandle(cell.getModelHandle(),ChartReportItemConstants.TYPE_AXIS_CHART,hostChartHandle);
      grandTotalAggCell.addContent(axisChartHandle,0);
    }
  }
}
Program: 72996
Project: 72996
Buggy source:
/** 
 * Updates XTab for Axis chart sync
 * @param cell
 * @param hostChartHandle
 * @param cmOld
 * @param cmNew
 * @throws BirtException
 */
public static void updateXTabForAxis(AggregationCellHandle cell,ExtendedItemHandle hostChartHandle,Chart cmOld,Chart cmNew) throws BirtException {
  if (cmOld instanceof ChartWithoutAxes) {
    if (cmNew instanceof ChartWithAxes) {
      addAxisChartInXTab(cell,((ChartWithAxes)cmNew).isTransposed(),hostChartHandle);
    }
  }
 else   if (cmOld instanceof ChartWithAxes) {
    if (cmNew instanceof ChartWithoutAxes) {
      removeAxisChartInXTab(cell,cmOld);
    }
 else {
      boolean bTransOld=((ChartWithAxes)cmOld).isTransposed();
      boolean bTransNew=((ChartWithAxes)cmNew).isTransposed();
      if (bTransOld != bTransNew) {
        ChartXTabUtil.updateXTabDirection(cell.getCrosstab(),bTransNew);
        int measureCount=cell.getCrosstab().getMeasureCount();
        for (int i=0; i < measureCount - 1; i++) {
          ExtendedItemHandle chartInOtherMeasure=findChartInOtherMeasures(cell);
          if (chartInOtherMeasure != null) {
            if (isAxisChart(chartInOtherMeasure)) {
              chartInOtherMeasure=findReferenceChart(chartInOtherMeasure);
            }
            updateChartModelWhenTransposing((ChartWithAxes)cmNew,(ChartWithAxes)getChartFromHandle(chartInOtherMeasure));
            addAxisChartInXTab(getXtabContainerCell(chartInOtherMeasure),bTransNew,chartInOtherMeasure);
          }
        }
        removeAxisChartInXTab(cell,cmOld);
        addAxisChartInXTab(cell,bTransNew,hostChartHandle);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Updates XTab for Axis chart sync
 * @param cell
 * @param hostChartHandle
 * @param bTransOld
 * @param cmNew
 * @throws BirtException
 */
public static void updateXTabForAxis(AggregationCellHandle cell,ExtendedItemHandle hostChartHandle,boolean bTransOld,Chart cmNew) throws BirtException {
  boolean bTransNew=((ChartWithAxes)cmNew).isTransposed();
  if (bTransOld != bTransNew) {
    ChartXTabUtil.updateXTabDirection(cell.getCrosstab(),bTransNew);
    int measureCount=cell.getCrosstab().getMeasureCount();
    for (int i=0; i < measureCount - 1; i++) {
      ExtendedItemHandle chartInOtherMeasure=findChartInOtherMeasures(cell);
      if (chartInOtherMeasure != null) {
        if (isAxisChart(chartInOtherMeasure)) {
          chartInOtherMeasure=findReferenceChart(chartInOtherMeasure);
        }
        updateChartModelWhenTransposing((ChartWithAxes)cmNew,(ChartWithAxes)getChartFromHandle(chartInOtherMeasure));
        AggregationCellHandle cellAgg=getXtabContainerCell(chartInOtherMeasure);
        removeAxisChartInXTab(cellAgg,bTransOld);
        addAxisChartInXTab(cellAgg,bTransNew,chartInOtherMeasure);
      }
    }
    removeAxisChartInXTab(cell,bTransOld);
    addAxisChartInXTab(cell,bTransNew,hostChartHandle);
  }
}
Program: 72998
Project: 72998
Buggy source:
/** 
 * Removes Axis chart in Xtab.
 * @param cell
 * @param cmOld
 * @throws BirtException
 */
public static void removeAxisChartInXTab(AggregationCellHandle cell,Chart cmOld) throws BirtException {
  CrosstabReportItemHandle xtab=cell.getCrosstab();
  if (cmOld instanceof ChartWithAxes) {
    if (((ChartWithAxes)cmOld).isTransposed()) {
      cell.setSpanOverOnRow(null);
      CrosstabCellHandle grandTotalCell=xtab.getGrandTotal(ICrosstabConstants.ROW_AXIS_TYPE);
      if (grandTotalCell != null && grandTotalCell.getContents().size() == 0) {
        xtab.removeGrandTotal(ICrosstabConstants.ROW_AXIS_TYPE);
      }
    }
 else {
      cell.setSpanOverOnColumn(null);
      CrosstabCellHandle grandTotalCell=xtab.getGrandTotal(ICrosstabConstants.COLUMN_AXIS_TYPE);
      if (grandTotalCell != null && grandTotalCell.getContents().size() == 0) {
        xtab.removeGrandTotal(ICrosstabConstants.COLUMN_AXIS_TYPE);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Removes Axis chart in Xtab.
 * @param cell
 * @param bTransposed
 * @throws BirtException
 */
public static void removeAxisChartInXTab(AggregationCellHandle cell,boolean bTransposed) throws BirtException {
  cell.setSpanOverOnRow(null);
  cell.setSpanOverOnColumn(null);
  AggregationCellHandle grandTotalAggCell=getGrandTotalAggregationCell(cell,bTransposed);
  if (grandTotalAggCell != null && grandTotalAggCell.getContents().size() > 0) {
    Object content=getFirstContent(grandTotalAggCell);
    if (isAxisChart((DesignElementHandle)content)) {
      ((DesignElementHandle)content).dropAndClear();
    }
    if (grandTotalAggCell.getContents().size() == 0) {
      cell.getCrosstab().removeGrandTotal(getXTabAxisType(bTransposed));
    }
  }
}
Program: 73000
Project: 73000
Buggy source:
/** 
 * Updates XTab for Axis chart sync
 * @param cell
 * @param hostChartHandle
 * @param bTransOld
 * @param cmNew
 * @throws BirtException
 */
public static void updateXTabForAxis(AggregationCellHandle cell,ExtendedItemHandle hostChartHandle,boolean bTransOld,Chart cmNew) throws BirtException {
  boolean bTransNew=((ChartWithAxes)cmNew).isTransposed();
  if (bTransOld != bTransNew) {
    ChartXTabUtil.updateXTabDirection(cell.getCrosstab(),bTransNew);
    int measureCount=cell.getCrosstab().getMeasureCount();
    for (int i=0; i < measureCount - 1; i++) {
      ExtendedItemHandle chartInOtherMeasure=findChartInOtherMeasures(cell);
      if (chartInOtherMeasure != null) {
        if (isAxisChart(chartInOtherMeasure)) {
          chartInOtherMeasure=findReferenceChart(chartInOtherMeasure);
        }
        updateChartModelWhenTransposing((ChartWithAxes)cmNew,(ChartWithAxes)getChartFromHandle(chartInOtherMeasure));
        AggregationCellHandle cellAgg=getXtabContainerCell(chartInOtherMeasure);
        removeAxisChartInXTab(cellAgg,bTransOld);
        addAxisChartInXTab(cellAgg,bTransNew,chartInOtherMeasure);
      }
    }
    removeAxisChartInXTab(cell,bTransOld);
    addAxisChartInXTab(cell,bTransNew,hostChartHandle);
  }
}

Fixed version (ground truth):
/** 
 * Updates XTab for Axis chart sync
 * @param cell
 * @param hostChartHandle
 * @param bTransOld
 * @param cmNew
 * @throws BirtException
 */
public static void updateXTabForAxis(AggregationCellHandle cell,ExtendedItemHandle hostChartHandle,boolean bTransOld,Chart cmNew) throws BirtException {
  boolean bTransNew=((ChartWithAxes)cmNew).isTransposed();
  if (bTransOld != bTransNew) {
    ChartXTabUtil.updateXTabDirection(cell.getCrosstab(),bTransNew);
    int measureCount=cell.getCrosstab().getMeasureCount();
    for (int i=0; i < measureCount - 1; i++) {
      ExtendedItemHandle chartInOtherMeasure=findChartInOtherMeasures(cell);
      if (chartInOtherMeasure != null) {
        if (isAxisChart(chartInOtherMeasure)) {
          chartInOtherMeasure=findReferenceChart(chartInOtherMeasure);
        }
        updateChartModelWhenTransposing(chartInOtherMeasure,(ChartWithAxes)cmNew);
        AggregationCellHandle cellAgg=getXtabContainerCell(chartInOtherMeasure);
        removeAxisChartInXTab(cellAgg,bTransOld);
        addAxisChartInXTab(cellAgg,bTransNew,chartInOtherMeasure);
      }
    }
    removeAxisChartInXTab(cell,bTransOld);
    addAxisChartInXTab(cell,bTransNew,hostChartHandle);
  }
}
Program: 73001
Project: 73001
Buggy source:
private static void updateChartModelWhenTransposing(ChartWithAxes cmFrom,ChartWithAxes cmTo){
  cmTo.setTransposed(cmFrom.isTransposed());
  Query queryFrom=(Query)((SeriesDefinition)((Axis)cmFrom.getAxes().get(0)).getSeriesDefinitions().get(0)).getDesignTimeSeries().getDataDefinition().get(0);
  Query queryTo=(Query)((SeriesDefinition)((Axis)cmTo.getAxes().get(0)).getSeriesDefinitions().get(0)).getDesignTimeSeries().getDataDefinition().get(0);
  queryTo.setDefinition(queryFrom.getDefinition());
}

Fixed version (ground truth):
private static void updateChartModelWhenTransposing(ExtendedItemHandle eih,ChartWithAxes cmFrom) throws ExtendedElementException {
  ChartReportItemImpl reportItem=(ChartReportItemImpl)eih.getReportItem();
  ChartWithAxes cmOld=(ChartWithAxes)reportItem.getProperty(ChartReportItemConstants.PROPERTY_CHART);
  ChartWithAxes cmNew=(ChartWithAxes)EcoreUtil.copy(cmOld);
  cmNew.setTransposed(cmFrom.isTransposed());
  Query queryFrom=(Query)((SeriesDefinition)((Axis)cmFrom.getAxes().get(0)).getSeriesDefinitions().get(0)).getDesignTimeSeries().getDataDefinition().get(0);
  Query queryTo=(Query)((SeriesDefinition)((Axis)cmNew.getAxes().get(0)).getSeriesDefinitions().get(0)).getDesignTimeSeries().getDataDefinition().get(0);
  queryTo.setDefinition(queryFrom.getDefinition());
  reportItem.executeSetModelCommand(eih,cmOld,cmNew);
}