nus-yam/ex-repair huggingface dataset:
Program: 89457
Project: 89457
Buggy source:
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isExecutableImpl(org.alfresco.service.cmr.repository.NodeRef,java.util.Map,boolean)
 */
@Override protected boolean isExecutableImpl(NodeRef filePlanComponent,Map<String,Serializable> parameters,boolean throwException){
  if (recordService.isRecord(filePlanComponent) == true) {
    if (recordService.isDeclared(filePlanComponent) == false) {
      List<String> missingProperties=new ArrayList<String>(10);
      if (mandatoryPropertiesSet(filePlanComponent,missingProperties) == true) {
        return true;
      }
 else {
        if (throwException) {
          throw new AlfrescoRuntimeException(buildMissingPropertiesErrorString(missingProperties));
        }
 else {
          return false;
        }
      }
    }
 else {
      return false;
    }
  }
 else {
    if (throwException) {
      throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS,filePlanComponent.toString()));
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase#isExecutableImpl(org.alfresco.service.cmr.repository.NodeRef,java.util.Map,boolean)
 */
@Override protected boolean isExecutableImpl(NodeRef filePlanComponent,Map<String,Serializable> parameters,boolean throwException){
  if (recordService.isRecord(filePlanComponent) == true) {
    if (recordService.isDeclared(filePlanComponent) == false) {
      List<String> missingProperties=new ArrayList<String>(10);
      if (mandatoryPropertiesSet(filePlanComponent,missingProperties) == true) {
        return true;
      }
    }
    return false;
  }
 else {
    if (throwException) {
      throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNDECLARED_ONLY_RECORDS,filePlanComponent.toString()));
    }
 else {
      return false;
    }
  }
}
Program: 89458
Project: 89458
Buggy source:
/** 
 * Log information about missing properties.
 * @param propDef             property definition
 * @param missingProperties   missing properties
 */
private void logMissingProperty(PropertyDefinition propDef,List<String> missingProperties){
  if (logger.isWarnEnabled()) {
    StringBuilder msg=new StringBuilder();
    msg.append("String_Node_Str").append(propDef.getName());
    logger.warn(msg.toString());
  }
  missingProperties.add(propDef.getName().toString());
}

Fixed version (ground truth):
/** 
 * Log information about missing properties.
 * @param propDef               property definition
 * @param missingProperties     missing properties
 */
private void logMissingProperty(PropertyDefinition propDef,List<String> missingProperties){
  if (logger.isWarnEnabled()) {
    StringBuilder msg=new StringBuilder();
    msg.append("String_Node_Str").append(propDef.getName());
    logger.warn(msg.toString());
  }
  missingProperties.add(propDef.getName().toString());
}
Program: 89459
Project: 89459
Buggy source:
/** 
 * Helper method to check whether all the mandatory properties of the node have been set
 * @param nodeRef    node reference
 * @return boolean   true if all mandatory properties are set, false otherwise
 */
private boolean mandatoryPropertiesSet(NodeRef nodeRef,List<String> missingProperties){
  boolean result=true;
  Map<QName,Serializable> nodeRefProps=this.nodeService.getProperties(nodeRef);
  QName nodeRefType=this.nodeService.getType(nodeRef);
  TypeDefinition typeDef=this.dictionaryService.getType(nodeRefType);
  for (  PropertyDefinition propDef : typeDef.getProperties().values()) {
    if (propDef.isMandatory() == true) {
      if (nodeRefProps.get(propDef.getName()) == null) {
        logMissingProperty(propDef,missingProperties);
        result=false;
        break;
      }
    }
  }
  if (result != false) {
    Set<QName> aspects=this.nodeService.getAspects(nodeRef);
    for (    QName aspect : aspects) {
      AspectDefinition aspectDef=this.dictionaryService.getAspect(aspect);
      for (      PropertyDefinition propDef : aspectDef.getProperties().values()) {
        if (propDef.isMandatory() == true) {
          if (nodeRefProps.get(propDef.getName()) == null) {
            logMissingProperty(propDef,missingProperties);
            result=false;
            break;
          }
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Helper method to check whether all the mandatory properties of the node have been set
 * @param nodeRef node reference
 * @return boolean true if all mandatory properties are set, false otherwise
 */
private boolean mandatoryPropertiesSet(NodeRef nodeRef,List<String> missingProperties){
  boolean result=true;
  Map<QName,Serializable> nodeRefProps=this.nodeService.getProperties(nodeRef);
  QName nodeRefType=this.nodeService.getType(nodeRef);
  TypeDefinition typeDef=this.dictionaryService.getType(nodeRefType);
  for (  PropertyDefinition propDef : typeDef.getProperties().values()) {
    if (propDef.isMandatory() == true) {
      if (nodeRefProps.get(propDef.getName()) == null) {
        logMissingProperty(propDef,missingProperties);
        result=false;
        break;
      }
    }
  }
  if (result != false) {
    Set<QName> aspects=this.nodeService.getAspects(nodeRef);
    for (    QName aspect : aspects) {
      AspectDefinition aspectDef=this.dictionaryService.getAspect(aspect);
      for (      PropertyDefinition propDef : aspectDef.getProperties().values()) {
        if (propDef.isMandatory() == true) {
          if (nodeRefProps.get(propDef.getName()) == null) {
            logMissingProperty(propDef,missingProperties);
            result=false;
            break;
          }
        }
      }
    }
  }
  return result;
}
Program: 89460
Project: 89460
Buggy source:
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getLoadedDataSets(org.alfresco.service.cmr.repository.NodeRef)
 */
@Override public Map<String,DataSet> getLoadedDataSets(NodeRef filePlan){
  ParameterCheck.mandatory("String_Node_Str",filePlan);
  Map<String,DataSet> availableDataSets=new HashMap<String,DataSet>(getDataSets());
  Serializable dataSetIds=nodeService.getProperty(filePlan,PROP_LOADED_DATA_SET_IDS);
  if (dataSetIds != null) {
    @SuppressWarnings("String_Node_Str") ArrayList<String> loadedDataSetIds=(ArrayList<String>)dataSetIds;
    for (    Map.Entry<String,DataSet> entry : availableDataSets.entrySet()) {
      String key=entry.getKey();
      if (!loadedDataSetIds.contains(key)) {
        availableDataSets.remove(key);
      }
    }
    return availableDataSets;
  }
  return new HashMap<String,DataSet>();
}

Fixed version (ground truth):
/** 
 * @see org.alfresco.module.org_alfresco_module_rm.dataset.DataSetService#getLoadedDataSets(org.alfresco.service.cmr.repository.NodeRef)
 */
@Override public Map<String,DataSet> getLoadedDataSets(NodeRef filePlan){
  ParameterCheck.mandatory("String_Node_Str",filePlan);
  Map<String,DataSet> availableDataSets=new HashMap<String,DataSet>(getDataSets());
  Serializable dataSetIds=nodeService.getProperty(filePlan,PROP_LOADED_DATA_SET_IDS);
  if (dataSetIds != null) {
    @SuppressWarnings("String_Node_Str") ArrayList<String> loadedDataSetIds=(ArrayList<String>)dataSetIds;
    Iterator<Map.Entry<String,DataSet>> iterator=availableDataSets.entrySet().iterator();
    while (iterator.hasNext()) {
      Entry<String,DataSet> entry=iterator.next();
      String key=entry.getKey();
      if (!loadedDataSetIds.contains(key)) {
        iterator.remove();
      }
    }
    return availableDataSets;
  }
  return new HashMap<String,DataSet>();
}
Program: 89461
Project: 89461
Buggy source:
private static void doCleanSaveSettings(String string) throws Exception, SQLException {
  PreparedStatement pre=SQLUtils.getPreparedSQL("String_Node_Str");
  pre.setString(1,string);
  pre.execute();
}

Fixed version (ground truth):
private static void doCleanSaveSettings(String string) throws Exception {
  PreparedStatement pre=SQLUtils.getPreparedSQL("String_Node_Str");
  pre.setString(1,string);
  pre.execute();
}
Program: 89462
Project: 89462
Buggy source:
private static void doSaveSettings(String string,List<Config> cfg) throws Exception {
  PreparedStatement pre=SQLUtils.getPreparedSQL("String_Node_Str");
  for (  Config c : cfg) {
    for (    ConfigTuple sel : c.getSelected()) {
      pre.setString(1,string);
      String value=sel.getObj().toString();
      if (sel.getObj() instanceof ScriptObjectMirror) {
        ScriptObjectMirror o=(ScriptObjectMirror)sel.getObj();
        value=o.callMember("String_Node_Str").toString();
      }
      pre.setString(2,value);
      pre.setString(3,sel.getDescription());
      pre.execute();
    }
  }
}

Fixed version (ground truth):
private static void doSaveSettings(String wpid,List<Config> cfg) throws Exception {
  PreparedStatement pre=SQLUtils.getPreparedSQL("String_Node_Str");
  for (  Config c : cfg) {
    for (    ConfigTuple sel : c.getSelected()) {
      pre.setString(1,wpid);
      pre.setString(2,c.getBeschreibung());
      pre.setString(3,sel.getDescription());
      pre.execute();
    }
  }
}
Program: 89466
Project: 89466
Buggy source:
public boolean check(){
  return orderinfo.get("String_Node_Str").equals("String_Node_Str") && orderinfo.get("String_Node_Str").equals("String_Node_Str") && orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals(orderinfo.get("String_Node_Str"))&& orderinfo.get("String_Node_Str").equals(orderinfo.get("String_Node_Str"))&& orderinfo.get("String_Node_Str").equals(orderinfo.get("String_Node_Str"))&& !orderinfo.get("String_Node_Str").equals("String_Node_Str")&& (orderinfo.get("String_Node_Str").equals("String_Node_Str") || orderinfo.get("String_Node_Str").equals("String_Node_Str"));
}

Fixed version (ground truth):
public boolean check(){
  System.out.println(orderinfo.entrySet());
  return orderinfo.get("String_Node_Str").equals("String_Node_Str") && orderinfo.get("String_Node_Str").equals("String_Node_Str") && orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals("String_Node_Str")&& orderinfo.get("String_Node_Str").equals(orderinfo.get("String_Node_Str"))&& orderinfo.get("String_Node_Str").equals(orderinfo.get("String_Node_Str"))&& orderinfo.get("String_Node_Str").equals(orderinfo.get("String_Node_Str"))&& !orderinfo.get("String_Node_Str").equals("String_Node_Str")&& (orderinfo.get("String_Node_Str").equals("String_Node_Str") || orderinfo.get("String_Node_Str").equals("String_Node_Str"));
}
Program: 89473
Project: 89473
Buggy source:
private void tohash(HashMap<String,String> infos,HtmlTable tab,boolean b){
  if (!b) {
    for (    HtmlTableRow row : tab.getRows()) {
      List<HtmlTableCell> cells=row.getCells();
      if (cells.size() == 1 && row.asText().toLowerCase().contains("String_Node_Str")) {
        continue;
      }
      if (cells.size() != 2) {
        System.out.println("String_Node_Str" + cells.size() + "String_Node_Str"+ row.asText());
        System.out.println(cells.get(0).toString().toLowerCase());
        continue;
      }
      infos.put(cells.get(0).asText().toLowerCase(),cells.get(1).asText());
    }
    return;
  }
  List<HtmlTableRow> rows=tab.getRows();
  if (rows.size() < 2) {
    System.out.println("String_Node_Str" + rows.toString());
    return;
  }
  List<HtmlTableCell> r1=rows.get(0).getCells();
  for (int zeile=1; zeile < rows.size(); zeile++) {
    List<HtmlTableCell> r2=rows.get(zeile).getCells();
    if (r1.size() != r2.size()) {
      System.out.println("String_Node_Str" + r1.toString());
      continue;
    }
    int missing=0;
    for (int i=0; i < r1.size(); i++) {
      String header=r1.get(i).asText().toLowerCase();
      if ("String_Node_Str".equals(header)) {
        header="String_Node_Str" + missing;
        missing++;
      }
      infos.put(header,r2.get(i).asText());
    }
  }
}

Fixed version (ground truth):
private void tohash(HashMap<String,String> infos,HtmlTable tab,boolean b){
  if (!b) {
    for (    HtmlTableRow row : tab.getRows()) {
      List<HtmlTableCell> cells=row.getCells();
      if (cells.size() == 1 && row.asText().toLowerCase().contains("String_Node_Str")) {
        continue;
      }
      if (cells.size() != 2) {
        Logger.info("String_Node_Str" + cells.size() + "String_Node_Str"+ row.asText());
        continue;
      }
      infos.put(cells.get(0).asText().toLowerCase(),cells.get(1).asText());
    }
    return;
  }
  List<HtmlTableRow> rows=tab.getRows();
  if (rows.size() < 2) {
    System.out.println("String_Node_Str" + rows.toString());
    return;
  }
  List<HtmlTableCell> r1=rows.get(0).getCells();
  for (int zeile=1; zeile < rows.size(); zeile++) {
    List<HtmlTableCell> r2=rows.get(zeile).getCells();
    if (r1.size() != r2.size()) {
      Logger.info("String_Node_Str" + r1.toString());
      continue;
    }
    int missing=0;
    for (int i=0; i < r1.size(); i++) {
      String header=r1.get(i).asText().toLowerCase();
      if ("String_Node_Str".equals(header)) {
        header="String_Node_Str" + missing;
        missing++;
      }
      infos.put(header,r2.get(i).asText());
    }
  }
}
Program: 89475
Project: 89475
Buggy source:
private int ensureFrameMetadata() throws IOException {
  int offsetDiff=networkBufferWriteOffset - networkBufferReadOffset;
  if ((offsetDiff > 10) || (networkBuffer.length - networkBufferWriteOffset > 10)) {
    return 0;
  }
  int bytesRead=0;
switch (offsetDiff) {
case 1:
    System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
  networkBufferWriteOffset=offsetDiff;
case 0:
bytesRead=in.read(networkBuffer,offsetDiff,networkBuffer.length);
if (bytesRead == -1) {
return -1;
}
networkBufferReadOffset=0;
networkBufferWriteOffset+=bytesRead;
break;
default :
int frameMetadataLength=2;
int b1=networkBuffer[networkBufferReadOffset];
int b2=networkBuffer[networkBufferReadOffset + 1] & 0x7F;
try {
OpCode.fromInt(b1 & 0x0F);
}
 catch (Exception ex) {
return -1;
}
if (b2 > 0) {
switch (b2) {
case 126:
frameMetadataLength+=2;
break;
case 127:
frameMetadataLength+=8;
break;
default :
break;
}
int remainingCapacity=networkBuffer.length - networkBufferWriteOffset;
if (remainingCapacity > frameMetadataLength) {
bytesRead=in.read(networkBuffer,networkBufferWriteOffset,remainingCapacity);
if (bytesRead == -1) {
return -1;
}
networkBufferWriteOffset+=bytesRead;
}
 else {
System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
networkBufferReadOffset=0;
networkBufferWriteOffset=offsetDiff;
bytesRead=in.read(networkBuffer,networkBufferWriteOffset,networkBuffer.length);
if (bytesRead == -1) {
return -1;
}
networkBufferWriteOffset+=bytesRead;
}
}
}
return bytesRead;
}

Fixed version (ground truth):
private int ensureFrameMetadata() throws IOException {
  int offsetDiff=networkBufferWriteOffset - networkBufferReadOffset;
  if (offsetDiff > 10) {
    return 0;
  }
  int bytesRead=0;
  int maxMetadata=10;
  int length=maxMetadata - offsetDiff;
  int frameMetadataLength=2;
switch (offsetDiff) {
case 1:
    System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
  networkBufferWriteOffset=offsetDiff;
case 0:
length=frameMetadataLength - offsetDiff;
while (length > 0) {
bytesRead=in.read(networkBuffer,offsetDiff,length);
if (bytesRead == -1) {
  return -1;
}
length-=bytesRead;
networkBufferWriteOffset+=bytesRead;
}
networkBufferReadOffset=0;
default :
int b2=networkBuffer[networkBufferReadOffset + 1] & 0x7F;
if (b2 > 0) {
switch (b2) {
case 126:
frameMetadataLength+=2;
break;
case 127:
frameMetadataLength+=8;
break;
default :
break;
}
if (offsetDiff >= frameMetadataLength) {
return 0;
}
int remainingMetadata=networkBufferReadOffset + frameMetadataLength - networkBufferWriteOffset;
if (networkBuffer.length <= networkBufferWriteOffset + remainingMetadata) {
System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
networkBufferReadOffset=0;
networkBufferWriteOffset=offsetDiff;
}
while (remainingMetadata > 0) {
bytesRead=in.read(networkBuffer,networkBufferWriteOffset,remainingMetadata);
if (bytesRead == -1) {
return -1;
}
remainingMetadata-=bytesRead;
networkBufferWriteOffset+=bytesRead;
}
}
}
return bytesRead;
}
Program: 89476
Project: 89476
Buggy source:
private int ensureFrameMetadata() throws IOException {
  int offsetDiff=networkBufferWriteOffset - networkBufferReadOffset;
  if ((offsetDiff > 10) || (networkBuffer.length - networkBufferWriteOffset > 10)) {
    return 0;
  }
  int bytesRead=0;
switch (offsetDiff) {
case 1:
    System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
  networkBufferWriteOffset=offsetDiff;
case 0:
bytesRead=in.read(networkBuffer,offsetDiff,networkBuffer.length);
if (bytesRead == -1) {
return -1;
}
networkBufferReadOffset=0;
networkBufferWriteOffset+=bytesRead;
break;
default :
int frameMetadataLength=2;
int b1=networkBuffer[networkBufferReadOffset];
int b2=networkBuffer[networkBufferReadOffset + 1] & 0x7F;
try {
OpCode.fromInt(b1 & 0x0F);
}
 catch (Exception ex) {
return -1;
}
if (b2 > 0) {
switch (b2) {
case 126:
frameMetadataLength+=2;
break;
case 127:
frameMetadataLength+=8;
break;
default :
break;
}
int remainingCapacity=networkBuffer.length - networkBufferWriteOffset;
if (remainingCapacity > frameMetadataLength) {
bytesRead=in.read(networkBuffer,networkBufferWriteOffset,remainingCapacity);
if (bytesRead == -1) {
return -1;
}
networkBufferWriteOffset+=bytesRead;
}
 else {
System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
networkBufferReadOffset=0;
networkBufferWriteOffset=offsetDiff;
bytesRead=in.read(networkBuffer,networkBufferWriteOffset,networkBuffer.length);
if (bytesRead == -1) {
return -1;
}
networkBufferWriteOffset+=bytesRead;
}
}
}
return bytesRead;
}

Fixed version (ground truth):
private int ensureFrameMetadata() throws IOException {
  int offsetDiff=networkBufferWriteOffset - networkBufferReadOffset;
  if (offsetDiff > 10) {
    return 0;
  }
  int bytesRead=0;
  int maxMetadata=10;
  int length=maxMetadata - offsetDiff;
  int frameMetadataLength=2;
switch (offsetDiff) {
case 1:
    System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
  networkBufferWriteOffset=offsetDiff;
case 0:
length=frameMetadataLength - offsetDiff;
while (length > 0) {
bytesRead=in.read(networkBuffer,offsetDiff,length);
if (bytesRead == -1) {
  return -1;
}
length-=bytesRead;
networkBufferWriteOffset+=bytesRead;
}
networkBufferReadOffset=0;
default :
int b2=networkBuffer[networkBufferReadOffset + 1] & 0x7F;
if (b2 > 0) {
switch (b2) {
case 126:
frameMetadataLength+=2;
break;
case 127:
frameMetadataLength+=8;
break;
default :
break;
}
if (offsetDiff >= frameMetadataLength) {
return 0;
}
int remainingMetadata=networkBufferReadOffset + frameMetadataLength - networkBufferWriteOffset;
if (networkBuffer.length <= networkBufferWriteOffset + remainingMetadata) {
System.arraycopy(networkBuffer,networkBufferReadOffset,networkBuffer,0,offsetDiff);
networkBufferReadOffset=0;
networkBufferWriteOffset=offsetDiff;
}
while (remainingMetadata > 0) {
bytesRead=in.read(networkBuffer,networkBufferWriteOffset,remainingMetadata);
if (bytesRead == -1) {
return -1;
}
remainingMetadata-=bytesRead;
networkBufferWriteOffset+=bytesRead;
}
}
}
return bytesRead;
}
Program: 89477
Project: 89477
Buggy source:
@Override public int read(char[] cbuf,int offset,int length) throws IOException {
}

Fixed version (ground truth):
@Override public int read(char[] cbuf,int offset,int length) throws IOException {
  if ((offset < 0) || ((offset + length) > cbuf.length) || (length < 0)) {
    int len=offset + length;
    throw new IndexOutOfBoundsException(format(MSG_INDEX_OUT_OF_BOUNDS,offset,len,cbuf.length));
  }
  while (payloadLength == 0) {
    while (payloadOffset == -1) {
      int headerByte=in.read();
      if (headerByte == -1) {
        return -1;
      }
      header[headerOffset++]=(byte)headerByte;
switch (headerOffset) {
case 1:
        int flags=(header[0] & 0xF0) >> 4;
switch (flags) {
case 0:
case 8:
        break;
default :
      connection.doFail(WS_PROTOCOL_ERROR,format(MSG_RESERVED_BITS_SET,flags));
  }
int opcode=header[0] & 0x0F;
switch (opcode) {
case 0x08:
case 0x09:
case 0x0A:
if ((headerByte & 0x80) == 0) {
  connection.doFail(WS_PROTOCOL_ERROR,format(MSG_FRAGMENTED_CONTROL_FRAME,headerByte));
}
break;
case 0x00:
connection.doFail(WS_PROTOCOL_ERROR,format(MSG_FRAGMENTED_FRAME,headerByte));
break;
case 0x01:
break;
default :
connection.doFail(WS_PROTOCOL_ERROR,MSG_NON_TEXT_FRAME);
}
break;
case 2:
boolean masked=(header[1] & 0x80) != 0x00;
if (masked) {
connection.doFail(WS_PROTOCOL_ERROR,MSG_MASKED_FRAME_FROM_SERVER);
}
switch (header[1] & 0x7f) {
case 126:
case 127:
break;
default :
payloadOffset=0;
payloadLength=payloadLength(header);
break;
}
break;
case 4:
switch (header[1] & 0x7f) {
case 126:
payloadOffset=0;
payloadLength=payloadLength(header);
break;
default :
break;
}
break;
case 10:
switch (header[1] & 0x7f) {
case 127:
payloadOffset=0;
payloadLength=payloadLength(header);
break;
default :
break;
}
break;
}
}
filterControlFrames();
if ((header[0] & 0x0F) == 0x08) {
return -1;
}
if (payloadLength == 0) {
payloadOffset=-1;
headerOffset=0;
}
 else {
if (payloadLength > receiveBuffer.length) {
receiveBuffer=new char[(int)payloadLength];
}
charPayloadLength=connection.doTextFrame(receiveBuffer,0,receiveBuffer.length,payloadLength);
}
}
int charsRead=Math.min(length,charPayloadLength - charPayloadOffset);
System.arraycopy(receiveBuffer,charPayloadOffset,cbuf,offset,charsRead);
charPayloadOffset+=charsRead;
if (charPayloadOffset == charPayloadLength) {
headerOffset=0;
payloadOffset=-1;
payloadLength=0;
charPayloadOffset=0;
charPayloadLength=0;
}
return charsRead;
}
Program: 89478
Project: 89478
Buggy source:
/** 
 * Creates a new instance of   {@link ApplicationBasicChallengeHandler} with thespecified  {@link ClassLoader} using the {@link ServiceLoader} API withthe implementation specified under META-INF/services.
 * @param classLoader          ClassLoader to be used to instantiate
 * @return BasicChallengeHandler
 */
public static ApplicationBasicChallengeHandler create(ClassLoader classLoader){
  return create(ApplicationBasicChallengeHandler.class,classLoader);
}

Fixed version (ground truth):
/** 
 * Creates a new instance of   {@link ApplicationBasicChallengeHandler} with thespecified  {@link ClassLoader} using the {@link ServiceLoader} API withthe implementation specified under META-INF/services.
 * @param classLoader          ClassLoader to be used to instantiate
 * @return ApplicationBasicChallengeHandler
 */
public static ApplicationBasicChallengeHandler create(ClassLoader classLoader){
  return create(ApplicationBasicChallengeHandler.class,classLoader);
}
Program: 89479
Project: 89479
Buggy source:
/** 
 * Provide a general (non-realm-specific) login handler to be used in association with this challenge handler. The login handler is used to assist in obtaining credentials to respond to any Basic challenge requests when no realm-specific login handler matches the realm parameter of the request (if any).
 * @param loginHandler a login handler for credentials.
 */
public abstract ApplicationBasicChallengeHandler setLoginHandler(LoginHandler loginHandler);

Fixed version (ground truth):
/** 
 * Provide a general (non-realm-specific) login handler to be used in association with this challenge handler. The login handler is used to assist in obtaining credentials to respond to any Basic challenge requests when no realm-specific login handler matches the realm parameter of the request (if any).
 * @param loginHandler a login handler for credentials.
 * @return ApplicationBasicChallengeHandler
 */
public abstract ApplicationBasicChallengeHandler setLoginHandler(LoginHandler loginHandler);
Program: 89480
Project: 89480
Buggy source:
/** 
 * Creates a new instance of the sub-class of   {@link ChallengeHandler} withspecified  {@link ClassLoader} using the {@link ServiceLoader} API withthe implementation specified under META-INF/services.
 * @param T                    sub-type of ChallengeHandler
 * @param clazz                Class object of the sub-type
 * @param classLoader          ClassLoader to be used to instantiate
 * @return ChallengeHandler
 */
protected static <T extends ChallengeHandler>T create(Class<T> clazz,ClassLoader clazzLoader){
  return load0(clazz,ServiceLoader.load(clazz,clazzLoader));
}

Fixed version (ground truth):
/** 
 * Creates a new instance of the sub-class of   {@link ChallengeHandler} withspecified  {@link ClassLoader} using the {@link ServiceLoader} API withthe implementation specified under META-INF/services.
 * @param < T >                  subclass of ChallengeHandler
 * @param clazz                Class object of the sub-type
 * @param classLoader          ClassLoader to be used to instantiate
 * @return ChallengeHandler
 */
protected static <T extends ChallengeHandler>T create(Class<T> clazz,ClassLoader classLoader){
  return load0(clazz,ServiceLoader.load(clazz,classLoader));
}
Program: 89481
Project: 89481
Buggy source:
/** 
 * Handle the presented challenge by creating a challenge response or returning   {@code null}. This responsibility is usually achieved by using the associated   {@link LoginHandler} to obtain user credentials, and transforming those credentialsinto a  {@link ChallengeResponse}. <p/> When it is not possible to create a   {@link ChallengeResponse}, this method MUST return   {@code null}.
 * @param challengeRequest a challenge object
 * @return a challenge response object or {@code null} if no response is possible.
 */
public abstract ChallengeResponse handle(ChallengeRequest challengeRequest);

Fixed version (ground truth):
/** 
 * Handle the presented challenge by creating a challenge response or returning   {@code null}. This responsibility is usually achieved by using the associated   {@link LoginHandler} to obtain user credentials, and transforming those credentialsinto a  {@link ChallengeResponse}. <p> When it is not possible to create a   {@link ChallengeResponse}, this method MUST return   {@code null}.
 * @param challengeRequest a challenge object
 * @return a challenge response object or {@code null} if no response is possible.
 */
public abstract ChallengeResponse handle(ChallengeRequest challengeRequest);
Program: 89482
Project: 89482
Buggy source:
/** 
 * Return the protected URI the access of which triggered this challenge as a   {@code String}. <p/> For some authentication schemes, the production of a response to the challenge may require access to the location of the URI triggering the challenge.
 * @return the protected URI the access of which triggered this challenge as a {@code String}
 */
public String getLocation(){
  return location;
}

Fixed version (ground truth):
/** 
 * Return the protected URI the access of which triggered this challenge as a   {@code String}. <p> For some authentication schemes, the production of a response to the challenge may require access to the location of the URI triggering the challenge.
 * @return the protected URI the access of which triggered this challenge as a {@code String}
 */
public String getLocation(){
  return location;
}
Program: 89483
Project: 89483
Buggy source:
/** 
 * Clear the credentials of this response. <p/> Calling this method once the credentials have been communicated to the network layer protects credentials in memory.
 */
public void clearCredentials(){
  if (getCredentials() != null) {
    Arrays.fill(getCredentials(),(char)0);
  }
}

Fixed version (ground truth):
/** 
 * Clear the credentials of this response. <p> Calling this method once the credentials have been communicated to the network layer protects credentials in memory.
 */
public void clearCredentials(){
  if (getCredentials() != null) {
    Arrays.fill(getCredentials(),(char)0);
  }
}
Program: 89484
Project: 89484
Buggy source:
/** 
 * If the provided challengeHandler is registered at the provided location, clear that association such that any future challenge requests matching the location will never be handled by the provided challenge handler. <p/> If no such location or challengeHandler registration exists, this method silently succeeds.
 * @param locationDescription the exact location description at which the challenge handler was originally registered
 * @param challengeHandler the challenge handler to de-register.
 * @return a reference to this object for chained call support
 */
public abstract DispatchChallengeHandler unregister(String locationDescription,ChallengeHandler challengeHandler);

Fixed version (ground truth):
/** 
 * If the provided challengeHandler is registered at the provided location, clear that association such that any future challenge requests matching the location will never be handled by the provided challenge handler. <p> If no such location or challengeHandler registration exists, this method silently succeeds.
 * @param locationDescription the exact location description at which the challenge handler was originally registered
 * @param challengeHandler the challenge handler to de-register.
 * @return a reference to this object for chained call support
 */
public abstract DispatchChallengeHandler unregister(String locationDescription,ChallengeHandler challengeHandler);
Program: 89486
Project: 89486
Buggy source:
private static int payloadLength(byte[] header){
  int length=header[1] & 0x7f;
switch (length) {
case 126:
    return (header[2] & 0xff) << 8 | (header[3] & 0xff);
case 127:
  return (header[2] & 0xff) << 56 | (header[3] & 0xff) << 48 | (header[4] & 0xff) << 40 | (header[4] & 0xff) << 32 | (header[6] & 0xff) << 24 | (header[5] & 0xff) << 16 | (header[8] & 0xff) << 8 | (header[9] & 0xff);
default :
return length;
}
}

Fixed version (ground truth):
private static int payloadLength(byte[] header){
  int length=header[1] & 0x7f;
switch (length) {
case 126:
    return (header[2] & 0xff) << 8 | (header[3] & 0xff);
case 127:
  return (header[2] & 0xff) << 56 | (header[3] & 0xff) << 48 | (header[4] & 0xff) << 40 | (header[5] & 0xff) << 32 | (header[6] & 0xff) << 24 | (header[7] & 0xff) << 16 | (header[8] & 0xff) << 8 | (header[9] & 0xff);
default :
return length;
}
}
Program: 89487
Project: 89487
Buggy source:
@Override public void write(byte[] b,int off,int len) throws IOException {
  out.write(0x82);
switch (highestOneBit(len)) {
case 0x0000:
case 0x0001:
case 0x0002:
case 0x0004:
case 0x0008:
case 0x0010:
case 0x0020:
    out.write(0x80 | len);
  break;
case 0x0040:
switch (len) {
case 126:
  out.write(0x80 | 126);
out.write(0x00);
out.write(126);
break;
case 127:
out.write(0x80 | 126);
out.write(0x00);
out.write(127);
break;
default :
out.write(0x80 | len);
break;
}
break;
case 0x0080:
case 0x0100:
case 0x0200:
case 0x0400:
case 0x0800:
case 0x1000:
case 0x2000:
case 0x4000:
case 0x8000:
out.write(0x80 | 126);
out.write((len >> 8) & 0xff);
out.write((len >> 0) & 0xff);
break;
default :
out.write(0x80 | 127);
out.write((len >> 24) & 0xff);
out.write((len >> 16) & 0xff);
out.write((len >> 8) & 0xff);
out.write((len >> 0) & 0xff);
break;
}
byte[] mask=new byte[4];
random.nextBytes(mask);
out.write(mask);
byte[] masked=new byte[len];
for (int i=0; i < len; i++) {
int ioff=off + i;
masked[i]=(byte)(b[ioff] ^ mask[i % mask.length]);
}
out.write(masked);
}

Fixed version (ground truth):
@Override public void write(byte[] b,int off,int len) throws IOException {
  out.write(0x82);
switch (highestOneBit(len)) {
case 0x0000:
case 0x0001:
case 0x0002:
case 0x0004:
case 0x0008:
case 0x0010:
case 0x0020:
    out.write(0x80 | len);
  break;
case 0x0040:
switch (len) {
case 126:
  out.write(0x80 | 126);
out.write(0x00);
out.write(126);
break;
case 127:
out.write(0x80 | 126);
out.write(0x00);
out.write(127);
break;
default :
out.write(0x80 | len);
break;
}
break;
case 0x0080:
case 0x0100:
case 0x0200:
case 0x0400:
case 0x0800:
case 0x1000:
case 0x2000:
case 0x4000:
case 0x8000:
out.write(0x80 | 126);
out.write((len >> 8) & 0xff);
out.write((len >> 0) & 0xff);
break;
default :
out.write(0x80 | 127);
long length=len;
out.write((int)((length >> 56) & 0xff));
out.write((int)((length >> 48) & 0xff));
out.write((int)((length >> 40) & 0xff));
out.write((int)((length >> 32) & 0xff));
out.write((int)((length >> 24) & 0xff));
out.write((int)((length >> 16) & 0xff));
out.write((int)((length >> 8) & 0xff));
out.write((int)((length >> 0) & 0xff));
break;
}
byte[] mask=new byte[4];
random.nextBytes(mask);
out.write(mask);
byte[] masked=new byte[len];
for (int i=0; i < len; i++) {
int ioff=off + i;
masked[i]=(byte)(b[ioff] ^ mask[i % mask.length]);
}
out.write(masked);
}
Program: 89488
Project: 89488
Buggy source:
public WsURLConnectionHelper(){
  Map<String,String> supportedProtocols=new HashMap<String,String>();
  supportedProtocols.put("String_Node_Str","String_Node_Str");
  supportedProtocols.put("String_Node_Str","String_Node_Str");
  supportedProtocols.put("String_Node_Str","String_Node_Str");
  this.supportedProtocols=unmodifiableMap(supportedProtocols);
  this.extensionFactory=WebSocketExtensionFactory.newInstance();
  this.random=new SecureRandom();
}

Fixed version (ground truth):
public WsURLConnectionHelper(){
  Map<String,String> supportedProtocols=new HashMap<String,String>();
  supportedProtocols.put("String_Node_Str","String_Node_Str");
  this.supportedProtocols=unmodifiableMap(supportedProtocols);
  this.extensionFactory=WebSocketExtensionFactory.newInstance();
  this.random=new SecureRandom();
}
Program: 89489
Project: 89489
Buggy source:
@Test @Specification({"String_Node_Str","String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength127() throws Exception {
  k3po.join();
}

Fixed version (ground truth):
@Test @Specification({"String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength127() throws Exception {
  URLConnectionHelper helper=URLConnectionHelper.newInstance();
  URI location=URI.create("String_Node_Str");
  WsURLConnection connection=(WsURLConnection)helper.openConnection(location);
  OutputStream out=connection.getOutputStream();
  InputStream in=connection.getInputStream();
  byte[] writeBytes=new byte[127];
  random.nextBytes(writeBytes);
  out.write(writeBytes);
  byte[] readBytes=new byte[127];
  in.read(readBytes);
  k3po.join();
  assertArrayEquals(writeBytes,readBytes);
  connection.close();
}
Program: 89490
Project: 89490
Buggy source:
@Test @Specification({"String_Node_Str","String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength128() throws Exception {
  k3po.join();
}

Fixed version (ground truth):
@Test @Specification({"String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength128() throws Exception {
  URLConnectionHelper helper=URLConnectionHelper.newInstance();
  URI location=URI.create("String_Node_Str");
  WsURLConnection connection=(WsURLConnection)helper.openConnection(location);
  OutputStream out=connection.getOutputStream();
  InputStream in=connection.getInputStream();
  byte[] writeBytes=new byte[128];
  random.nextBytes(writeBytes);
  out.write(writeBytes);
  byte[] readBytes=new byte[128];
  in.read(readBytes);
  k3po.join();
  assertArrayEquals(writeBytes,readBytes);
  connection.close();
}
Program: 89491
Project: 89491
Buggy source:
@Test @Specification({"String_Node_Str","String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength126() throws Exception {
  k3po.join();
}

Fixed version (ground truth):
@Test @Specification({"String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength126() throws Exception {
  URLConnectionHelper helper=URLConnectionHelper.newInstance();
  URI location=URI.create("String_Node_Str");
  WsURLConnection connection=(WsURLConnection)helper.openConnection(location);
  OutputStream out=connection.getOutputStream();
  InputStream in=connection.getInputStream();
  byte[] writeBytes=new byte[126];
  random.nextBytes(writeBytes);
  out.write(writeBytes);
  byte[] readBytes=new byte[126];
  in.read(readBytes);
  k3po.join();
  assertArrayEquals(writeBytes,readBytes);
  connection.close();
}
Program: 89492
Project: 89492
Buggy source:
@Test @Specification({"String_Node_Str","String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength0() throws Exception {
  k3po.join();
}

Fixed version (ground truth):
@Test @Specification({"String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength0() throws Exception {
  URLConnectionHelper helper=URLConnectionHelper.newInstance();
  URI location=URI.create("String_Node_Str");
  WsURLConnection connection=(WsURLConnection)helper.openConnection(location);
  OutputStream out=connection.getOutputStream();
  InputStream in=connection.getInputStream();
  byte[] writeBytes=new byte[0];
  random.nextBytes(writeBytes);
  out.write(writeBytes);
  byte[] readBytes=new byte[0];
  in.read(readBytes);
  k3po.join();
  assertArrayEquals(writeBytes,readBytes);
  connection.close();
}
Program: 89493
Project: 89493
Buggy source:
@Test @Specification({"String_Node_Str","String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength65536() throws Exception {
  k3po.join();
}

Fixed version (ground truth):
@Test @Specification({"String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength65536() throws Exception {
  URLConnectionHelper helper=URLConnectionHelper.newInstance();
  URI location=URI.create("String_Node_Str");
  WsURLConnection connection=(WsURLConnection)helper.openConnection(location);
  OutputStream out=connection.getOutputStream();
  InputStream in=connection.getInputStream();
  byte[] writeBytes=new byte[65536];
  random.nextBytes(writeBytes);
  out.write(writeBytes);
  byte[] readBytes=new byte[65536];
  in.read(readBytes);
  k3po.join();
  assertArrayEquals(writeBytes,readBytes);
  connection.close();
}
Program: 89494
Project: 89494
Buggy source:
@Test @Specification({"String_Node_Str","String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength65535() throws Exception {
  k3po.join();
}

Fixed version (ground truth):
@Test @Specification({"String_Node_Str"}) public void shouldEchoBinaryFrameWithPayloadLength65535() throws Exception {
  URLConnectionHelper helper=URLConnectionHelper.newInstance();
  URI location=URI.create("String_Node_Str");
  WsURLConnection connection=(WsURLConnection)helper.openConnection(location);
  OutputStream out=connection.getOutputStream();
  InputStream in=connection.getInputStream();
  byte[] writeBytes=new byte[65535];
  random.nextBytes(writeBytes);
  out.write(writeBytes);
  byte[] readBytes=new byte[65535];
  in.read(readBytes);
  k3po.join();
  assertArrayEquals(writeBytes,readBytes);
  connection.close();
}
Program: 89496
Project: 89496
Buggy source:
protected Set<Long> cacheData(Set<Long> jobIDs){
  cacheCalled++;
  cacheParameter=jobIDs;
switch (mode) {
case SILENT:
    return null;
case WAITING:
  try {
    long before=System.currentTimeMillis();
synchronized (this) {
      o.notifyAll();
      o.wait(TIMEOUT);
      o.notifyAll();
    }
    woken|=System.currentTimeMillis() - before < TIMEOUT;
  }
 catch (  InterruptedException e) {
    return null;
  }
return null;
case REPLYING:
try {
File temp=getCacheFile(jobIDs);
temp.deleteOnExit();
FileOutputStream fos=new FileOutputStream(temp);
for (Long job : jobIDs) {
  fos.write(job.intValue());
}
fos.close();
return jobIDs;
}
 catch (IOException e) {
System.out.println("String_Node_Str" + e);
e.printStackTrace();
return null;
}
case REPLYING_DIR:
try {
File tempDir=getCacheFile(jobIDs);
tempDir.deleteOnExit();
tempDir.mkdir();
OutputStream fos=new FileOutputStream(new File(tempDir,"String_Node_Str"));
fos.close();
return jobIDs;
}
 catch (IOException e) {
System.out.println("String_Node_Str" + e);
e.printStackTrace();
return null;
}
case FAILING:
throw new IOFailure("String_Node_Str");
default :
return null;
}
}

Fixed version (ground truth):
protected Set<Long> cacheData(Set<Long> jobIDs){
  cacheCalled++;
  cacheParameter=jobIDs;
switch (mode) {
case SILENT:
    return null;
case WAITING:
  try {
    long before=System.currentTimeMillis();
synchronized (o) {
      o.notifyAll();
      o.wait(TIMEOUT);
      o.notifyAll();
    }
    woken|=System.currentTimeMillis() - before < TIMEOUT;
  }
 catch (  InterruptedException e) {
    return null;
  }
return null;
case REPLYING:
try {
File temp=getCacheFile(jobIDs);
temp.deleteOnExit();
FileOutputStream fos=new FileOutputStream(temp);
for (Long job : jobIDs) {
  fos.write(job.intValue());
}
fos.close();
return jobIDs;
}
 catch (IOException e) {
System.out.println("String_Node_Str" + e);
e.printStackTrace();
return null;
}
case REPLYING_DIR:
try {
File tempDir=getCacheFile(jobIDs);
tempDir.deleteOnExit();
tempDir.mkdir();
OutputStream fos=new FileOutputStream(new File(tempDir,"String_Node_Str"));
fos.close();
return jobIDs;
}
 catch (IOException e) {
System.out.println("String_Node_Str" + e);
e.printStackTrace();
return null;
}
case FAILING:
throw new IOFailure("String_Node_Str");
default :
return null;
}
}
Program: 89497
Project: 89497
Buggy source:
public void setUp(){
  cacheCalled=0;
  mode=Mode.SILENT;
  cacheParameter=null;
  o=new Object();
  woken=false;
}

Fixed version (ground truth):
public void setUp(){
  cacheCalled=0;
  mode=Mode.SILENT;
  cacheParameter=null;
  woken=false;
}
Program: 89498
Project: 89498
Buggy source:
/** 
 * Looks for a log statement like "Created 212 jobs for harvest hgj8hy".
 * @return
 */
static boolean isFinished(String harvestName,TestEnvironmentController testEnvironmentController){
  try {
    String output=testEnvironmentController.runCommand(TestEnvironment.JOB_ADMIN_SERVER,"String_Node_Str" + testEnvironmentController.ENV.getTESTX() + "String_Node_Str",new int[]{0,1});
    final String harvestNamePattern="String_Node_Str" + harvestName + "String_Node_Str";
    Pattern finished=Pattern.compile(harvestNamePattern,Pattern.DOTALL);
    log.info("String_Node_Str" + harvestNamePattern + "String_Node_Str"+ output+ "String_Node_Str");
    final Matcher matcher=finished.matcher(output);
    if (matcher.matches()) {
      return true;
    }
 else {
      return false;
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
/** 
 * Looks for a log statement like "Created 212 jobs for harvest hgj8hy".
 * @return
 */
static boolean isFinished(String harvestName,TestEnvironmentController testEnvironmentController){
  try {
    String output=testEnvironmentController.runCommand(TestEnvironment.JOB_ADMIN_SERVER,"String_Node_Str" + testEnvironmentController.ENV.getTESTX() + "String_Node_Str",new int[]{0,1});
    final String harvestNamePattern="String_Node_Str" + harvestName + "String_Node_Str";
    Pattern finished=Pattern.compile(harvestNamePattern,Pattern.DOTALL);
    log.debug("String_Node_Str" + harvestNamePattern + "String_Node_Str"+ output+ "String_Node_Str");
    final Matcher matcher=finished.matcher(output);
    if (matcher.matches()) {
      return true;
    }
 else {
      return false;
    }
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 89499
Project: 89499
Buggy source:
public static void waitForJobGeneration(String harvestName,TestEnvironmentController testEnvironmentController){
  boolean keepWaiting=true;
  int secondsWaitingForJob=0;
  int maxSecondsToWaitForAllHarvests=360;
  while (keepWaiting) {
    System.err.print("String_Node_Str");
    try {
      Thread.sleep(10000);
      secondsWaitingForJob=secondsWaitingForJob + 10;
    }
 catch (    InterruptedException e) {
    }
    if (secondsWaitingForJob > maxSecondsToWaitForAllHarvests) {
      throw new RuntimeException("String_Node_Str" + harvestName + "String_Node_Str"+ maxSecondsToWaitForAllHarvests+ "String_Node_Str"+ "String_Node_Str");
    }
    keepWaiting=isFinished(harvestName,testEnvironmentController);
  }
}

Fixed version (ground truth):
public static void waitForJobGeneration(String harvestName,TestEnvironmentController testEnvironmentController){
  boolean keepWaiting=true;
  int secondsWaitingForJob=0;
  int maxSecondsToWaitForAllHarvests=360;
  while (keepWaiting) {
    System.err.print("String_Node_Str");
    try {
      Thread.sleep(10000);
      secondsWaitingForJob=secondsWaitingForJob + 10;
    }
 catch (    InterruptedException e) {
    }
    if (secondsWaitingForJob > maxSecondsToWaitForAllHarvests) {
      throw new RuntimeException("String_Node_Str" + harvestName + "String_Node_Str"+ maxSecondsToWaitForAllHarvests+ "String_Node_Str"+ "String_Node_Str");
    }
    keepWaiting=!isFinished(harvestName,testEnvironmentController);
  }
}
Program: 89500
Project: 89500
Buggy source:
public void killScheduling(){
  log.debug("String_Node_Str" + "String_Node_Str",id,harvestDefinition.getName(),harvestDefinitionsBeingScheduled);
  harvestDefinitionsBeingScheduled.remove(id);
  schedulingStartedMap.remove(id);
  threadMap.remove(id);
}

Fixed version (ground truth):
public void killScheduling(){
  harvestDefinitionsBeingScheduled.remove(id);
  schedulingStartedMap.remove(id);
  threadMap.remove(id);
  log.debug("String_Node_Str" + "String_Node_Str",id,harvestDefinition.getName(),harvestDefinitionsBeingScheduled);
}
Program: 89501
Project: 89501
Buggy source:
public synchronized void init(){
  try {
    if (bActive && !bInitialized) {
      if (job == null) {
        job=Heritrix3JobMonitorThread.jobDAO.read(jobId);
      }
      if (h3wrapper == null) {
        StartedJobInfo startedInfo=Heritrix3JobMonitorThread.runningJobsInfoDAO.getMostRecentByJobId(jobId);
        if (startedInfo != null) {
          hostUrl=startedInfo.getHostUrl();
          if (hostUrl != null && hostUrl.length() > 0) {
            h3wrapper=Heritrix3WrapperManager.getHeritrix3Wrapper(hostUrl,environment.h3AdminName,environment.h3AdminPassword);
          }
        }
      }
      if (jobname == null && h3wrapper != null) {
        jobname=Heritrix3WrapperManager.getJobname(h3wrapper,jobId);
      }
      if ((jobResult == null || jobResult.job == null) && jobname != null) {
        jobResult=h3wrapper.job(jobname);
      }
      if (jobResult != null && jobResult.job != null) {
        crawlLogFilePath=jobResult.job.crawlLogFilePath;
      }
      if (crawlLogFilePath != null) {
        logRaf=new RandomAccessFile(logFile,"String_Node_Str");
        idxRaf=new RandomAccessFile(idxFile,"String_Node_Str");
        idxRaf.writeLong(0);
        bInitialized=true;
      }
    }
  }
 catch (  Throwable t) {
  }
}

Fixed version (ground truth):
public synchronized void init(){
  try {
    if (bActive && !bInitialized) {
      if (job == null) {
        job=Heritrix3JobMonitorThread.jobDAO.read(jobId);
      }
      if (h3wrapper == null) {
        StartedJobInfo startedInfo=Heritrix3JobMonitorThread.runningJobsInfoDAO.getMostRecentByJobId(jobId);
        if (startedInfo != null) {
          hostUrl=startedInfo.getHostUrl();
          if (hostUrl != null && hostUrl.length() > 0) {
            h3wrapper=Heritrix3WrapperManager.getHeritrix3Wrapper(hostUrl,environment.h3AdminName,environment.h3AdminPassword);
          }
        }
      }
      if (jobname == null && h3wrapper != null) {
        jobname=Heritrix3WrapperManager.getJobname(h3wrapper,jobId);
      }
      if ((jobResult == null || jobResult.job == null) && jobname != null) {
        jobResult=h3wrapper.job(jobname);
      }
      if (jobResult != null && jobResult.job != null) {
        crawlLogFilePath=jobResult.job.crawlLogFilePath;
      }
      if (crawlLogFilePath != null) {
        logRaf=new RandomAccessFile(logFile,"String_Node_Str");
        idxRaf=new RandomAccessFile(idxFile,"String_Node_Str");
        if (idxRaf.length() == 0) {
          idxRaf.writeLong(0);
        }
 else {
          idxRaf.seek(idxRaf.length() - 8);
          lastIndexed=idxRaf.readLong();
          totalCachedLines=(idxRaf.length() / 8) - 1;
        }
        idxRaf.seek(idxRaf.length());
        logRaf.seek(logRaf.length());
        bInitialized=true;
      }
    }
  }
 catch (  Throwable t) {
  }
}