nus-yam/ex-repair huggingface dataset:
Program: 67211
Project: 67211
Buggy source:
/** 
 * Create different dataset provider for common and sharing case.
 * @return
 * @since 2.3
 */
protected AggregateOnBindingsFormHandleProvider createDataSetFormProvider(){
  return new AggregateOnBindingsFormHandleProvider(){
    @Override public boolean isEditable(){
      if (input == null) {
        return super.isEditable();
      }
      final ReportItemHandle rih;
      if (input instanceof List) {
        rih=(ExtendedItemHandle)((List)input).get(0);
      }
 else {
        rih=(ExtendedItemHandle)input;
      }
      if (ChartReportItemUtil.isChildOfMultiViewsHandle(rih)) {
        return false;
      }
      boolean isSharing=false;
      if (ChartItemUtil.getReportItemReference(rih) != null) {
        isSharing=true;
      }
      boolean useCube=(rih.getCube() != null);
      return !isSharing && (!useCube) && !ChartItemUtil.isChartInheritGroups(rih)&& !ChartCubeUtil.isAxisChart(rih)&& !ChartCubeUtil.isPlotChart(rih);
    }
  }
;
}

Fixed version (ground truth):
/** 
 * Create different dataset provider for common and sharing case.
 * @return
 * @since 2.3
 */
protected AggregateOnBindingsFormHandleProvider createDataSetFormProvider(){
  return new AggregateOnBindingsFormHandleProvider(){
    @Override public boolean isEditable(){
      if (input == null) {
        return super.isEditable();
      }
      final ReportItemHandle rih;
      if (input instanceof List) {
        rih=(ExtendedItemHandle)((List)input).get(0);
      }
 else {
        rih=(ExtendedItemHandle)input;
      }
      if (ChartReportItemUtil.isChildOfMultiViewsHandle(rih)) {
        return false;
      }
      boolean isSharing=false;
      if (ChartItemUtil.getReportItemReference(rih) != null) {
        isSharing=true;
      }
      boolean useCube=(rih.getCube() != null);
      return !isSharing && (!useCube) && !ChartItemUtil.isChartInheritGroups(rih)&& !ChartCubeUtil.isAxisChart(rih)&& !ChartCubeUtil.isPlotChart(rih);
    }
    @Override public void generateAllBindingColumns(){
      super.generateAllBindingColumns();
      if (getBindingObject() != null) {
        CubeHandle cube=null;
        if (getBindingObject() instanceof ExtendedItemHandle) {
          cube=((ExtendedItemHandle)getBindingObject()).getCube();
        }
        if (cube != null) {
          try {
            ExtendedItemHandle inputElement=(ExtendedItemHandle)getBindingObject();
            List<ComputedColumn> columnList=new ArrayList<ComputedColumn>();
            inputElement.getColumnBindings().clearValue();
            columnList=ChartXTabUIUtil.generateComputedColumns(inputElement,cube);
            if (columnList.size() > 0) {
              for (Iterator<ComputedColumn> iter=columnList.iterator(); iter.hasNext(); ) {
                DEUtil.addColumn(inputElement,iter.next(),false);
              }
            }
          }
 catch (          SemanticException e) {
          }
        }
      }
    }
  }
;
}
Program: 67212
Project: 67212
Buggy source:
protected void applyCustomSections(){
  ChartBindingGroupDescriptorProvider bindingProvider=new ChartBindingGroupDescriptorProvider();
  bindingProvider.setRefrenceSection(((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)));
  ((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)).setProvider(bindingProvider);
  AggregateOnBindingsFormHandleProvider dataSetFormProvider=createDataSetFormProvider();
  ((SortingFormSection)getSection(PageSectionId.BINDING_DATASET_FORM)).setCustomForm(new AggregateOnBindingsFormDescriptor(true));
  ((SortingFormSection)getSection(PageSectionId.BINDING_DATASET_FORM)).setProvider(dataSetFormProvider);
  if (((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)).getProvider() != null) {
    IDescriptorProvider dataSetProvider=((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)).getProvider();
    if (dataSetProvider instanceof BindingGroupDescriptorProvider)     ((BindingGroupDescriptorProvider)dataSetProvider).setDependedProvider(dataSetFormProvider);
  }
}

Fixed version (ground truth):
protected void applyCustomSections(){
  ChartBindingGroupDescriptorProvider bindingProvider=new ChartBindingGroupDescriptorProvider();
  bindingProvider.setRefrenceSection(((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)));
  ((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)).setProvider(bindingProvider);
  AggregateOnBindingsFormHandleProvider dataSetFormProvider=createDataSetFormProvider();
  ((SortingFormSection)getSection(PageSectionId.BINDING_DATASET_FORM)).setCustomForm(new AggregateOnBindingsFormDescriptor(true){
    @Override public void setInput(    Object object){
      super.setInput(object);
      btnRefresh.setEnabled(true);
    }
  }
);
  ((SortingFormSection)getSection(PageSectionId.BINDING_DATASET_FORM)).setProvider(dataSetFormProvider);
  if (((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)).getProvider() != null) {
    IDescriptorProvider dataSetProvider=((BindingGroupSection)getSection(PageSectionId.BINDING_GROUP)).getProvider();
    if (dataSetProvider instanceof BindingGroupDescriptorProvider)     ((BindingGroupDescriptorProvider)dataSetProvider).setDependedProvider(dataSetFormProvider);
  }
}
Program: 67213
Project: 67213
Buggy source:
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchive(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException("String_Node_Str");
  this.folderName=new File(folderName).getCanonicalPath();
  try {
    this.writer=new FolderArchiveWriter(folderName);
    this.reader=new FolderArchiveReader(folderName);
  }
 catch (  IOException ex) {
    close();
    throw ex;
  }
}

Fixed version (ground truth):
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchive(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException(Messages.getString(ResourceConstants.FOLDER_NAME_IS_NULL));
  this.folderName=new File(folderName).getCanonicalPath();
  try {
    this.writer=new FolderArchiveWriter(folderName);
    this.reader=new FolderArchiveReader(folderName);
  }
 catch (  IOException ex) {
    close();
    throw ex;
  }
}
Program: 67214
Project: 67214
Buggy source:
/** 
 * @param folderName -the absolute name of the folder archive
 */
public FolderArchiveReader(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0) {
    throw new IOException("String_Node_Str");
  }
  File fd=new File(folderName);
  if (!fd.isDirectory()) {
    throw new IOException("String_Node_Str");
  }
  this.folderName=fd.getCanonicalPath();
}

Fixed version (ground truth):
/** 
 * @param folderName -the absolute name of the folder archive
 */
public FolderArchiveReader(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0) {
    throw new IllegalArgumentException(folderName);
  }
  File fd=new File(folderName);
  if (!fd.exists() || !fd.isDirectory()) {
    throw new FileNotFoundException(Messages.getFormattedString(ResourceConstants.INVALID_ARCHIVE_NAME,folderName));
  }
  this.folderName=fd.getCanonicalPath();
}
Program: 67215
Project: 67215
Buggy source:
public RAInputStream getStream(String relativePath) throws IOException {
  String path=ArchiveUtil.generateFullPath(folderName,relativePath);
  File file=new File(path);
  if (file.exists()) {
    return new RAFolderInputStream(inputStreams,file);
  }
  throw new IOException(relativePath + "String_Node_Str");
}

Fixed version (ground truth):
public RAInputStream getStream(String relativePath) throws IOException {
  String path=ArchiveUtil.generateFullPath(folderName,relativePath);
  File file=new File(path);
  if (file.exists()) {
    return new RAFolderInputStream(inputStreams,file);
  }
  throw new FileNotFoundException(relativePath);
}
Program: 67216
Project: 67216
Buggy source:
public RAInputStream getInputStream(String relativePath) throws IOException {
  String path=ArchiveUtil.generateFullPath(folderName,relativePath);
  File file=new File(path);
  if (file.exists()) {
    RAFolderInputStream in=new RAFolderInputStream(inputStreams,file);
    return in;
  }
  throw new IOException(relativePath + "String_Node_Str");
}

Fixed version (ground truth):
public RAInputStream getInputStream(String relativePath) throws IOException {
  String path=ArchiveUtil.generateFullPath(folderName,relativePath);
  File file=new File(path);
  if (file.exists()) {
    RAFolderInputStream in=new RAFolderInputStream(inputStreams,file);
    return in;
  }
  throw new FileNotFoundException(relativePath);
}
Program: 67217
Project: 67217
Buggy source:
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchiveWriter(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException("String_Node_Str");
  File fd=new File(folderName);
  if (!fd.exists()) {
    fd.mkdirs();
  }
  this.folderName=fd.getCanonicalPath();
}

Fixed version (ground truth):
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchiveWriter(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException(Messages.getString(ResourceConstants.FOLDER_NAME_IS_NULL));
  File fd=new File(folderName);
  if (!fd.exists()) {
    fd.mkdirs();
  }
  this.folderName=fd.getCanonicalPath();
}
Program: 67218
Project: 67218
Buggy source:
/** 
 * Move the file pointer to the new location in the stream
 * @param localPos - the new local postion in the stream. The localPos starts from 0.  
 */
public void seek(long localPos) throws IOException {
  if (localPosToGlobalPos(localPos) >= endPos)   throw new IOException("String_Node_Str");
  if (localPos < cur - bufLen || localPos > cur) {
    cur=localPos;
    bufCur=0;
    bufLen=0;
  }
 else {
    bufCur=bufLen - (int)(cur - localPos);
  }
}

Fixed version (ground truth):
/** 
 * Move the file pointer to the new location in the stream
 * @param localPos - the new local postion in the stream. The localPos starts from 0.  
 */
public void seek(long localPos) throws IOException {
  if (localPosToGlobalPos(localPos) >= endPos)   throw new IOException(Messages.getString(ResourceConstants.OUT_OF_RANGE));
  if (localPos < cur - bufLen || localPos > cur) {
    cur=localPos;
    bufCur=0;
    bufLen=0;
  }
 else {
    bufCur=bufLen - (int)(cur - localPos);
  }
}
Program: 67219
Project: 67219
Buggy source:
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException("String_Node_Str" + localPos);
  }
  if (localPos >= entry.getLength()) {
    throw new EOFException("String_Node_Str");
  }
  if (localPos < offset || localPos > offset + buffer_size) {
    offset=localPos;
    buffer_size=0;
    buffer_offset=0;
    return;
  }
  buffer_offset=(int)(localPos - offset);
}

Fixed version (ground truth):
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_SEEK_OFFSET,new Object[]{localPos}));
  }
  if (localPos >= entry.getLength()) {
    throw new EOFException(Messages.getString(ResourceConstants.EXCEED_FILE_LENGTH));
  }
  if (localPos < offset || localPos > offset + buffer_size) {
    offset=localPos;
    buffer_size=0;
    buffer_offset=0;
    return;
  }
  buffer_offset=(int)(localPos - offset);
}
Program: 67220
Project: 67220
Buggy source:
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException("String_Node_Str" + localPos);
  }
  if (localPos > entry.getLength()) {
    entry.setLength(localPos);
  }
  if (offset + buffer_offset != localPos) {
    flushBuffer();
    offset=localPos;
  }
}

Fixed version (ground truth):
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_SEEK_OFFSET,new Object[]{localPos}));
  }
  if (localPos > entry.getLength()) {
    entry.setLength(localPos);
  }
  if (offset + buffer_offset != localPos) {
    flushBuffer();
    offset=localPos;
  }
}
Program: 67221
Project: 67221
Buggy source:
private Block loadBlock(int blockId) throws IOException {
  if (cachedBlockId == blockId) {
    return cachedBlock;
  }
  if (cachedBlock != null) {
    af.unloadBlock(cachedBlock);
    cachedBlock=null;
  }
  cachedBlockId=blockId;
  int fileBlockId=index.getBlock(blockId);
  if (fileBlockId != -1) {
    cachedBlock=af.loadBlock(fileBlockId);
    return cachedBlock;
  }
  throw new IOException("String_Node_Str" + blockId);
}

Fixed version (ground truth):
private Block loadBlock(int blockId) throws IOException {
  if (cachedBlockId == blockId) {
    return cachedBlock;
  }
  if (cachedBlock != null) {
    af.unloadBlock(cachedBlock);
    cachedBlock=null;
  }
  cachedBlockId=blockId;
  int fileBlockId=index.getBlock(blockId);
  if (fileBlockId != -1) {
    cachedBlock=af.loadBlock(fileBlockId);
    return cachedBlock;
  }
  throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_INDEX,new Object[]{blockId}));
}
Program: 67222
Project: 67222
Buggy source:
synchronized public boolean removeEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.removeEntry(name);
  }
 else {
    throw new IOException("String_Node_Str" + name + "String_Node_Str"+ systemId);
  }
}

Fixed version (ground truth):
synchronized public boolean removeEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.removeEntry(name);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67223
Project: 67223
Buggy source:
/** 
 * save the file. If the file is transient file, after saving, it will be converts to normal file.
 * @throws IOException
 */
public void save() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.save();
  }
 else {
    throw new IOException("String_Node_Str" + systemId);
  }
}

Fixed version (ground truth):
/** 
 * save the file. If the file is transient file, after saving, it will be converts to normal file.
 * @throws IOException
 */
public void save() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.save();
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67224
Project: 67224
Buggy source:
public ArchiveFile(String systemId,String fileName,String mode) throws IOException {
  if (fileName == null || fileName.length() == 0)   throw new IOException("String_Node_Str");
  File fd=new File(fileName);
  fileName=fd.getCanonicalPath();
  this.archiveName=fileName;
  this.systemId=systemId;
  if ("String_Node_Str".equals(mode)) {
    openArchiveForReading();
  }
 else   if ("String_Node_Str".equals(mode)) {
    openArchiveForAppending();
  }
 else {
    ArchiveFileV3 f3=new ArchiveFileV3(fileName,mode);
    f3.setSystemId(systemId);
    this.af=f3;
  }
}

Fixed version (ground truth):
public ArchiveFile(String systemId,String fileName,String mode) throws IOException {
  if (fileName == null || fileName.length() == 0)   throw new IOException(Messages.getString(ResourceConstants.FILE_NAME_IS_NULL));
  File fd=new File(fileName);
  fileName=fd.getCanonicalPath();
  this.archiveName=fileName;
  this.systemId=systemId;
  if ("String_Node_Str".equals(mode)) {
    openArchiveForReading();
  }
 else   if ("String_Node_Str".equals(mode)) {
    openArchiveForAppending();
  }
 else {
    ArchiveFileV3 f3=new ArchiveFileV3(fileName,mode);
    f3.setSystemId(systemId);
    this.af=f3;
  }
}
Program: 67225
Project: 67225
Buggy source:
synchronized public void flush() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.flush();
  }
 else {
    throw new IOException("String_Node_Str" + systemId);
  }
}

Fixed version (ground truth):
synchronized public void flush() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.flush();
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67226
Project: 67226
Buggy source:
synchronized public void refresh() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.refresh();
  }
 else {
    throw new IOException("String_Node_Str" + systemId);
  }
}

Fixed version (ground truth):
synchronized public void refresh() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.refresh();
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67227
Project: 67227
Buggy source:
synchronized public ArchiveEntry openEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.openEntry(name);
  }
 else {
    throw new IOException("String_Node_Str" + name + "String_Node_Str"+ systemId);
  }
}

Fixed version (ground truth):
synchronized public ArchiveEntry openEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.openEntry(name);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67228
Project: 67228
Buggy source:
synchronized public ArchiveEntry createEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.createEntry(name);
  }
 else {
    throw new IOException("String_Node_Str" + name + "String_Node_Str"+ systemId);
  }
}

Fixed version (ground truth):
synchronized public ArchiveEntry createEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.createEntry(name);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67229
Project: 67229
Buggy source:
public void unlockEntry(Object locker) throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.unlockEntry(locker);
  }
 else {
    throw new IOException("String_Node_Str" + systemId);
  }
}

Fixed version (ground truth):
public void unlockEntry(Object locker) throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.unlockEntry(locker);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67230
Project: 67230
Buggy source:
public synchronized boolean removeEntry(String name) throws IOException {
  throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
public synchronized boolean removeEntry(String name) throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67231
Project: 67231
Buggy source:
public synchronized void save() throws IOException {
  throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
public synchronized void save() throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67232
Project: 67232
Buggy source:
public void flush() throws IOException {
  throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
public void flush() throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67233
Project: 67233
Buggy source:
public synchronized ArchiveEntry createEntry(String name) throws IOException {
  throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
public synchronized ArchiveEntry createEntry(String name) throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67234
Project: 67234
Buggy source:
public void unlockEntry(Object locker) throws IOException {
  if (!(locker instanceof ArchiveEntryV1)) {
    throw new IOException("String_Node_Str" + locker);
  }
}

Fixed version (ground truth):
public void unlockEntry(Object locker) throws IOException {
  if (!(locker instanceof ArchiveEntryV1)) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_LOCK_TYPE,new Object[]{locker}));
  }
}
Program: 67235
Project: 67235
Buggy source:
synchronized void write(long pos,byte[] b,int off,int len) throws IOException {
  throw new IOException("String_Node_Str");
}

Fixed version (ground truth):
synchronized void write(long pos,byte[] b,int off,int len) throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67238
Project: 67238
Buggy source:
private Combo createExpressionValue(Composite parent){
  Combo expressionValue=new Combo(parent,SWT.None);
  expressionValue.addListener(SWT.Verify,expValueVerifyListener);
  expressionValue.addListener(SWT.Selection,expValueSelectionListener);
  Listener listener=new Listener(){
    public void handleEvent(    Event event){
      updateButtons();
    }
  }
;
  expressionValue.addListener(SWT.Modify,listener);
  ExpressionButtonUtil.createExpressionButton(parent,expressionValue,expressionProvider,designHandle,listener);
  return expressionValue;
}

Fixed version (ground truth):
private Combo createExpressionValue(Composite parent){
  Combo expressionValue=new Combo(parent,SWT.None);
  expressionValue.addListener(SWT.Verify,expValueVerifyListener);
  expressionValue.addListener(SWT.Selection,expValueSelectionListener);
  Listener listener=new Listener(){
    public void handleEvent(    Event event){
      updateButtons();
    }
  }
;
  expressionValue.addListener(SWT.Modify,listener);
  IExpressionButton ceb=ChartExpressionButtonUtil.createExpressionButton(parent,expressionValue,(ExtendedItemHandle)designHandle,expressionProvider);
  ceb.addListener(listener);
  return expressionValue;
}
Program: 67239
Project: 67239
Buggy source:
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchive(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException(Messages.getString(ResourceConstants.FOLDER_NAME_IS_NULL));
  this.folderName=new File(folderName).getCanonicalPath();
  try {
    this.writer=new FolderArchiveWriter(folderName);
    this.reader=new FolderArchiveReader(folderName);
  }
 catch (  IOException ex) {
    close();
    throw ex;
  }
}

Fixed version (ground truth):
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchive(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException(CoreMessages.getString(ResourceConstants.FOLDER_NAME_IS_NULL));
  this.folderName=new File(folderName).getCanonicalPath();
  try {
    this.writer=new FolderArchiveWriter(folderName);
    this.reader=new FolderArchiveReader(folderName);
  }
 catch (  IOException ex) {
    close();
    throw ex;
  }
}
Program: 67240
Project: 67240
Buggy source:
/** 
 * @param folderName -the absolute name of the folder archive
 */
public FolderArchiveReader(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0) {
    throw new IllegalArgumentException(folderName);
  }
  File fd=new File(folderName);
  if (!fd.exists() || !fd.isDirectory()) {
    throw new FileNotFoundException(Messages.getFormattedString(ResourceConstants.INVALID_ARCHIVE_NAME,folderName));
  }
  this.folderName=fd.getCanonicalPath();
}

Fixed version (ground truth):
/** 
 * @param folderName -the absolute name of the folder archive
 */
public FolderArchiveReader(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0) {
    throw new IllegalArgumentException(folderName);
  }
  File fd=new File(folderName);
  if (!fd.exists() || !fd.isDirectory()) {
    throw new FileNotFoundException(CoreMessages.getFormattedString(ResourceConstants.INVALID_ARCHIVE_NAME,folderName));
  }
  this.folderName=fd.getCanonicalPath();
}
Program: 67241
Project: 67241
Buggy source:
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchiveWriter(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException(Messages.getString(ResourceConstants.FOLDER_NAME_IS_NULL));
  File fd=new File(folderName);
  if (!fd.exists()) {
    fd.mkdirs();
  }
  this.folderName=fd.getCanonicalPath();
}

Fixed version (ground truth):
/** 
 * @param absolute fileName the archive file name
 */
public FolderArchiveWriter(String folderName) throws IOException {
  if (folderName == null || folderName.length() == 0)   throw new IOException(CoreMessages.getString(ResourceConstants.FOLDER_NAME_IS_NULL));
  File fd=new File(folderName);
  if (!fd.exists()) {
    fd.mkdirs();
  }
  this.folderName=fd.getCanonicalPath();
}
Program: 67242
Project: 67242
Buggy source:
/** 
 * Move the file pointer to the new location in the stream
 * @param localPos - the new local postion in the stream. The localPos starts from 0.  
 */
public void seek(long localPos) throws IOException {
  if (localPosToGlobalPos(localPos) >= endPos)   throw new IOException(Messages.getString(ResourceConstants.OUT_OF_RANGE));
  if (localPos < cur - bufLen || localPos > cur) {
    cur=localPos;
    bufCur=0;
    bufLen=0;
  }
 else {
    bufCur=bufLen - (int)(cur - localPos);
  }
}

Fixed version (ground truth):
/** 
 * Move the file pointer to the new location in the stream
 * @param localPos - the new local postion in the stream. The localPos starts from 0.  
 */
public void seek(long localPos) throws IOException {
  if (localPosToGlobalPos(localPos) >= endPos)   throw new IOException(CoreMessages.getString(ResourceConstants.OUT_OF_RANGE));
  if (localPos < cur - bufLen || localPos > cur) {
    cur=localPos;
    bufCur=0;
    bufLen=0;
  }
 else {
    bufCur=bufLen - (int)(cur - localPos);
  }
}
Program: 67243
Project: 67243
Buggy source:
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_SEEK_OFFSET,new Object[]{localPos}));
  }
  if (localPos >= entry.getLength()) {
    throw new EOFException(Messages.getString(ResourceConstants.EXCEED_FILE_LENGTH));
  }
  if (localPos < offset || localPos > offset + buffer_size) {
    offset=localPos;
    buffer_size=0;
    buffer_offset=0;
    return;
  }
  buffer_offset=(int)(localPos - offset);
}

Fixed version (ground truth):
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.INVALID_SEEK_OFFSET,new Object[]{localPos}));
  }
  if (localPos >= entry.getLength()) {
    throw new EOFException(CoreMessages.getString(ResourceConstants.EXCEED_FILE_LENGTH));
  }
  if (localPos < offset || localPos > offset + buffer_size) {
    offset=localPos;
    buffer_size=0;
    buffer_offset=0;
    return;
  }
  buffer_offset=(int)(localPos - offset);
}
Program: 67244
Project: 67244
Buggy source:
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_SEEK_OFFSET,new Object[]{localPos}));
  }
  if (localPos > entry.getLength()) {
    entry.setLength(localPos);
  }
  if (offset + buffer_offset != localPos) {
    flushBuffer();
    offset=localPos;
  }
}

Fixed version (ground truth):
public void seek(long localPos) throws IOException {
  if (localPos < 0) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.INVALID_SEEK_OFFSET,new Object[]{localPos}));
  }
  if (localPos > entry.getLength()) {
    entry.setLength(localPos);
  }
  if (offset + buffer_offset != localPos) {
    flushBuffer();
    offset=localPos;
  }
}
Program: 67245
Project: 67245
Buggy source:
private Block loadBlock(int blockId) throws IOException {
  if (cachedBlockId == blockId) {
    return cachedBlock;
  }
  if (cachedBlock != null) {
    af.unloadBlock(cachedBlock);
    cachedBlock=null;
  }
  cachedBlockId=blockId;
  int fileBlockId=index.getBlock(blockId);
  if (fileBlockId != -1) {
    cachedBlock=af.loadBlock(fileBlockId);
    return cachedBlock;
  }
  throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_INDEX,new Object[]{blockId}));
}

Fixed version (ground truth):
private Block loadBlock(int blockId) throws IOException {
  if (cachedBlockId == blockId) {
    return cachedBlock;
  }
  if (cachedBlock != null) {
    af.unloadBlock(cachedBlock);
    cachedBlock=null;
  }
  cachedBlockId=blockId;
  int fileBlockId=index.getBlock(blockId);
  if (fileBlockId != -1) {
    cachedBlock=af.loadBlock(fileBlockId);
    return cachedBlock;
  }
  throw new IOException(CoreMessages.getFormattedString(ResourceConstants.INVALID_INDEX,new Object[]{blockId}));
}
Program: 67246
Project: 67246
Buggy source:
synchronized public boolean removeEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.removeEntry(name);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
synchronized public boolean removeEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.removeEntry(name);
  }
 else {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67247
Project: 67247
Buggy source:
/** 
 * save the file. If the file is transient file, after saving, it will be converts to normal file.
 * @throws IOException
 */
public void save() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.save();
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
/** 
 * save the file. If the file is transient file, after saving, it will be converts to normal file.
 * @throws IOException
 */
public void save() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.save();
  }
 else {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67248
Project: 67248
Buggy source:
public ArchiveFile(String systemId,String fileName,String mode) throws IOException {
  if (fileName == null || fileName.length() == 0)   throw new IOException(Messages.getString(ResourceConstants.FILE_NAME_IS_NULL));
  File fd=new File(fileName);
  fileName=fd.getCanonicalPath();
  this.archiveName=fileName;
  this.systemId=systemId;
  if ("String_Node_Str".equals(mode)) {
    openArchiveForReading();
  }
 else   if ("String_Node_Str".equals(mode)) {
    openArchiveForAppending();
  }
 else {
    ArchiveFileV3 f3=new ArchiveFileV3(fileName,mode);
    f3.setSystemId(systemId);
    this.af=f3;
  }
}

Fixed version (ground truth):
public ArchiveFile(String systemId,String fileName,String mode) throws IOException {
  if (fileName == null || fileName.length() == 0)   throw new IOException(CoreMessages.getString(ResourceConstants.FILE_NAME_IS_NULL));
  File fd=new File(fileName);
  fileName=fd.getCanonicalPath();
  this.archiveName=fileName;
  this.systemId=systemId;
  if ("String_Node_Str".equals(mode)) {
    openArchiveForReading();
  }
 else   if ("String_Node_Str".equals(mode)) {
    openArchiveForAppending();
  }
 else {
    ArchiveFileV3 f3=new ArchiveFileV3(fileName,mode);
    f3.setSystemId(systemId);
    this.af=f3;
  }
}
Program: 67249
Project: 67249
Buggy source:
synchronized public void flush() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.flush();
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
synchronized public void flush() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.flush();
  }
 else {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67250
Project: 67250
Buggy source:
synchronized public void refresh() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.refresh();
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
synchronized public void refresh() throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.refresh();
  }
 else {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67251
Project: 67251
Buggy source:
synchronized public ArchiveEntry openEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.openEntry(name);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
synchronized public ArchiveEntry openEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.openEntry(name);
  }
 else {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67252
Project: 67252
Buggy source:
synchronized public ArchiveEntry createEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.createEntry(name);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
synchronized public ArchiveEntry createEntry(String name) throws IOException {
  if (isArchiveFileAvailable(af)) {
    return af.createEntry(name);
  }
 else {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67253
Project: 67253
Buggy source:
public void unlockEntry(Object locker) throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.unlockEntry(locker);
  }
 else {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
public void unlockEntry(Object locker) throws IOException {
  if (isArchiveFileAvailable(af)) {
    af.unlockEntry(locker);
  }
 else {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67254
Project: 67254
Buggy source:
public synchronized boolean removeEntry(String name) throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}

Fixed version (ground truth):
public synchronized boolean removeEntry(String name) throws IOException {
  throw new IOException(CoreMessages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67255
Project: 67255
Buggy source:
public synchronized void save() throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}

Fixed version (ground truth):
public synchronized void save() throws IOException {
  throw new IOException(CoreMessages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67256
Project: 67256
Buggy source:
public void flush() throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}

Fixed version (ground truth):
public void flush() throws IOException {
  throw new IOException(CoreMessages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67257
Project: 67257
Buggy source:
public synchronized ArchiveEntry createEntry(String name) throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}

Fixed version (ground truth):
public synchronized ArchiveEntry createEntry(String name) throws IOException {
  throw new IOException(CoreMessages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67258
Project: 67258
Buggy source:
public void unlockEntry(Object locker) throws IOException {
  if (!(locker instanceof ArchiveEntryV1)) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_LOCK_TYPE,new Object[]{locker}));
  }
}

Fixed version (ground truth):
public void unlockEntry(Object locker) throws IOException {
  if (!(locker instanceof ArchiveEntryV1)) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.INVALID_LOCK_TYPE,new Object[]{locker}));
  }
}
Program: 67259
Project: 67259
Buggy source:
synchronized void write(long pos,byte[] b,int off,int len) throws IOException {
  throw new IOException(Messages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}

Fixed version (ground truth):
synchronized void write(long pos,byte[] b,int off,int len) throws IOException {
  throw new IOException(CoreMessages.getString(ResourceConstants.READ_ONLY_ARCHIVE));
}
Program: 67260
Project: 67260
Buggy source:
/** 
 * create the archive file.
 * @param fileName file name.
 * @param mode open mode.
 * @throws IOException
 */
public ArchiveFileV2(String systemId,String dependId,String fileName,RandomAccessFile rf,String mode) throws IOException {
  if (fileName == null || fileName.length() == 0)   throw new IOException(Messages.getString(ResourceConstants.FILE_NAME_IS_NULL));
  File fd=new File(fileName);
  fileName=fd.getCanonicalPath();
  this.archiveName=fileName;
  this.rf=rf;
  this.systemId=systemId;
  this.dependId=dependId;
  this.caches=new FileCacheManager();
  caches.setCacheListener(new ArchiveFileV2CacheListener());
  caches.setSystemCacheManager(ArchiveFile.systemCacheManager);
  setupArchiveMode(mode);
  if (isWritable && !isAppend) {
    createDocument();
  }
 else   if (isWritable && isAppend) {
    if (!(new File(fileName)).exists()) {
      createDocument();
    }
 else {
      openDocument();
    }
  }
 else {
    openDocument();
  }
  isClosed=false;
}

Fixed version (ground truth):
/** 
 * create the archive file.
 * @param fileName file name.
 * @param mode open mode.
 * @throws IOException
 */
public ArchiveFileV2(String systemId,String dependId,String fileName,RandomAccessFile rf,String mode) throws IOException {
  if (fileName == null || fileName.length() == 0)   throw new IOException(CoreMessages.getString(ResourceConstants.FILE_NAME_IS_NULL));
  File fd=new File(fileName);
  fileName=fd.getCanonicalPath();
  this.archiveName=fileName;
  this.rf=rf;
  this.systemId=systemId;
  this.dependId=dependId;
  this.caches=new FileCacheManager();
  caches.setCacheListener(new ArchiveFileV2CacheListener());
  caches.setSystemCacheManager(ArchiveFile.systemCacheManager);
  setupArchiveMode(mode);
  if (isWritable && !isAppend) {
    createDocument();
  }
 else   if (isWritable && isAppend) {
    if (!(new File(fileName)).exists()) {
      createDocument();
    }
 else {
      openDocument();
    }
  }
 else {
    openDocument();
  }
  isClosed=false;
}
Program: 67261
Project: 67261
Buggy source:
private void assertWritable() throws IOException {
  assertOpen();
  if (!isWritable) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.ARCHIVE_OPEN_FOR_WRITE,new Object[]{systemId}));
  }
}

Fixed version (ground truth):
private void assertWritable() throws IOException {
  assertOpen();
  if (!isWritable) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.ARCHIVE_OPEN_FOR_WRITE,new Object[]{systemId}));
  }
}
Program: 67262
Project: 67262
Buggy source:
private void assertOpen() throws IOException {
  if (isClosed) {
    throw new IOException(Messages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}

Fixed version (ground truth):
private void assertOpen() throws IOException {
  if (isClosed) {
    throw new IOException(CoreMessages.getString(ResourceConstants.FILE_HAS_BEEN_CLOSED));
  }
}
Program: 67263
Project: 67263
Buggy source:
synchronized public void unlockEntry(Object locker) throws IOException {
  assertOpen();
  if (!(locker instanceof NameEntry)) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.INVALID_LOCK_TYPE,new Object[]{locker}));
  }
}

Fixed version (ground truth):
synchronized public void unlockEntry(Object locker) throws IOException {
  assertOpen();
  if (!(locker instanceof NameEntry)) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.INVALID_LOCK_TYPE,new Object[]{locker}));
  }
}
Program: 67264
Project: 67264
Buggy source:
static ArchiveHeader read(RandomAccessFile rf) throws IOException {
  ArchiveHeader header=new ArchiveHeader();
  byte[] b=new byte[HEADER_LENGTH];
  rf.seek(0);
  rf.read(b);
  DataInputStream in=new DataInputStream(new ByteArrayInputStream(b));
  long magicTag=in.readLong();
  if (magicTag != DOCUMENT_TAG) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.NOT_COMPOUND_FILE,new Object[]{magicTag}));
  }
  long version=in.readLong();
  if (version != DOCUMENT_VERSION_0 && version != DOCUMENT_VERSION_1) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.UNSUPPORTED_ARCHIVE_VERSION,new Object[]{version}));
  }
  header.fileStatus=in.readInt();
  header.blockSize=in.readInt();
  if (header.blockSize == 0) {
    header.blockSize=DEFAULT_BLOCK_SIZE;
  }
  if (version == DOCUMENT_VERSION_1) {
    header.systemId=IOUtil.readString(in);
    header.dependId=IOUtil.readString(in);
  }
  return header;
}

Fixed version (ground truth):
static ArchiveHeader read(RandomAccessFile rf) throws IOException {
  ArchiveHeader header=new ArchiveHeader();
  byte[] b=new byte[HEADER_LENGTH];
  rf.seek(0);
  rf.read(b);
  DataInputStream in=new DataInputStream(new ByteArrayInputStream(b));
  long magicTag=in.readLong();
  if (magicTag != DOCUMENT_TAG) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.NOT_COMPOUND_FILE,new Object[]{magicTag}));
  }
  long version=in.readLong();
  if (version != DOCUMENT_VERSION_0 && version != DOCUMENT_VERSION_1) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.UNSUPPORTED_ARCHIVE_VERSION,new Object[]{version}));
  }
  header.fileStatus=in.readInt();
  header.blockSize=in.readInt();
  if (header.blockSize == 0) {
    header.blockSize=DEFAULT_BLOCK_SIZE;
  }
  if (version == DOCUMENT_VERSION_1) {
    header.systemId=IOUtil.readString(in);
    header.dependId=IOUtil.readString(in);
  }
  return header;
}
Program: 67265
Project: 67265
Buggy source:
/** 
 * Write header information to disk
 * @throws IOException
 */
void flush(ArchiveFileV2 af) throws IOException {
  ByteArrayOutputStream buffer=new ByteArrayOutputStream();
  DataOutputStream out=new DataOutputStream(buffer);
  out.writeLong(DOCUMENT_TAG);
  out.writeLong(DOCUMENT_VERSION_1);
  out.writeInt(fileStatus);
  out.writeInt(blockSize);
  IOUtil.writeString(out,af.systemId);
  IOUtil.writeString(out,af.dependId);
  byte[] b=buffer.toByteArray();
  if (b.length > DEFAULT_BLOCK_SIZE) {
    throw new IOException(Messages.getFormattedString(ResourceConstants.EXCEED_MAX_BLOCK_SIZE,new Object[]{DEFAULT_BLOCK_SIZE}));
  }
  af.write(0,0,b,0,b.length);
}

Fixed version (ground truth):
/** 
 * Write header information to disk
 * @throws IOException
 */
void flush(ArchiveFileV2 af) throws IOException {
  ByteArrayOutputStream buffer=new ByteArrayOutputStream();
  DataOutputStream out=new DataOutputStream(buffer);
  out.writeLong(DOCUMENT_TAG);
  out.writeLong(DOCUMENT_VERSION_1);
  out.writeInt(fileStatus);
  out.writeInt(blockSize);
  IOUtil.writeString(out,af.systemId);
  IOUtil.writeString(out,af.dependId);
  byte[] b=buffer.toByteArray();
  if (b.length > DEFAULT_BLOCK_SIZE) {
    throw new IOException(CoreMessages.getFormattedString(ResourceConstants.EXCEED_MAX_BLOCK_SIZE,new Object[]{DEFAULT_BLOCK_SIZE}));
  }
  af.write(0,0,b,0,b.length);
}
Program: 67266
Project: 67266
Buggy source:
public ArchiveReader(String archiveName) throws IOException {
  if (archiveName == null || archiveName.length() == 0) {
    throw new IllegalArgumentException(archiveName);
  }
  File fd=new File(archiveName);
  if (!fd.isFile() || !fd.exists()) {
    throw new FileNotFoundException(Messages.getFormattedString(ResourceConstants.INVALID_ARCHIVE_NAME,archiveName));
  }
  archiveName=fd.getCanonicalPath();
  shareArchive=false;
  archive=new ArchiveFile(archiveName,"String_Node_Str");
}

Fixed version (ground truth):
public ArchiveReader(String archiveName) throws IOException {
  if (archiveName == null || archiveName.length() == 0) {
    throw new IllegalArgumentException(archiveName);
  }
  File fd=new File(archiveName);
  if (!fd.isFile() || !fd.exists()) {
    throw new FileNotFoundException(CoreMessages.getFormattedString(ResourceConstants.INVALID_ARCHIVE_NAME,archiveName));
  }
  archiveName=fd.getCanonicalPath();
  shareArchive=false;
  archive=new ArchiveFile(archiveName,"String_Node_Str");
}
Program: 67267
Project: 67267
Buggy source:
/** 
 * layout a word, add the word to the line buffer.
 * @param word the word
 */
private void addWordIntoTextArea(TextArea textArea,Word word){
  int textLength=word.getLength();
  int wordWidth=getWordWidth(fontInfo,word);
  wordWidth+=textStyle.getLetterSpacing() * textLength;
  if (textArea.hasSpace(wordWidth)) {
    addWord(textArea,textLength,wordWidth);
    wordVestige=null;
    if (remainWords.hasWord()) {
      if (textArea.hasSpace(textStyle.getWordSpacing())) {
        textArea.addWordSpacing(textStyle.getWordSpacing());
      }
 else {
        textArea.setLineBreak(true);
        hasLineBreak=true;
        lineBreakCollapse=LINE_BREAK_COLLAPSE_STANDING_BY;
      }
    }
  }
 else {
    if (isNewLine && textArea.isEmpty()) {
      if (context.isEnableHyphenation()) {
        doHyphenation(word.getValue(),textArea);
      }
 else {
        addWord(textArea,textLength,wordWidth);
      }
    }
 else {
      wordVestige=null;
      remainWord=word;
    }
    textArea.setLineBreak(true);
    hasLineBreak=true;
    lineBreakCollapse=LINE_BREAK_COLLAPSE_STANDING_BY;
  }
}

Fixed version (ground truth):
/** 
 * layout a word, add the word to the line buffer.
 * @param word the word
 */
private void addWordIntoTextArea(TextArea textArea,Word word){
  int textLength=word.getLength();
  int wordWidth=getWordWidth(fontInfo,word);
  wordWidth+=textStyle.getLetterSpacing() * textLength;
  if (textArea.hasSpace(wordWidth)) {
    addWord(textArea,textLength,wordWidth);
    wordVestige=null;
    if (remainWords.hasWord()) {
      if (textArea.hasSpace(textStyle.getWordSpacing())) {
        textArea.addWordSpacing(textStyle.getWordSpacing());
      }
 else {
        textArea.setLineBreak(true);
        hasLineBreak=true;
        lineBreakCollapse=LINE_BREAK_COLLAPSE_STANDING_BY;
      }
    }
  }
 else {
    if (!textWrapping && insertFirstExceedWord) {
      addWord(textArea,textLength,wordWidth);
      wordVestige=null;
      insertFirstExceedWord=false;
    }
    if (isNewLine && textArea.isEmpty()) {
      if (context.isEnableHyphenation()) {
        doHyphenation(word.getValue(),textArea);
      }
 else {
        addWord(textArea,textLength,wordWidth);
      }
    }
 else {
      wordVestige=null;
      remainWord=word;
    }
    textArea.setLineBreak(true);
    hasLineBreak=true;
    lineBreakCollapse=LINE_BREAK_COLLAPSE_STANDING_BY;
  }
}
Program: 67268
Project: 67268
Buggy source:
public void setNewLineStatus(boolean status){
  isNewLine=status;
}

Fixed version (ground truth):
public void setNewLineStatus(boolean status){
  isNewLine=status;
  if (isNewLine && !textWrapping) {
    insertFirstExceedWord=true;
  }
}
Program: 67269
Project: 67269
Buggy source:
protected void addNewDefn(ColumnDefn defn) throws SemanticException {
  String name=defn.getColumnName();
  if (rsColumnMap != null) {
    if (rsColumnMap.get(name) != null) {
      name=getUniqueColumnName();
      defn.setColumnName(name);
    }
    ResultSetColumnHandle rsHandle;
    if (rsColumns != null && columnHints != null) {
      rsColumns.addItem(defn.getResultSetColumn());
      columnHints.addItem(defn.getColumnHint());
      rsColumnMap.put(name,defn.getResultSetColumn());
      columnHintMap.put(name,defn.getColumnHint());
    }
  }
}

Fixed version (ground truth):
protected ColumnHintHandle addNewDefn(ColumnDefn defn) throws SemanticException {
  ColumnHintHandle column=null;
  String name=defn.getColumnName();
  if (rsColumnMap != null) {
    if (rsColumnMap.get(name) != null) {
      name=getUniqueColumnName();
      defn.setColumnName(name);
    }
    ResultSetColumnHandle rsHandle;
    if (rsColumns != null && columnHints != null) {
      rsColumns.addItem(defn.getResultSetColumn());
      column=(ColumnHintHandle)columnHints.addItem(defn.getColumnHint());
      rsColumnMap.put(name,defn.getResultSetColumn());
      columnHintMap.put(name,defn.getColumnHint());
    }
  }
  return column;
}