nus-yam/ex-repair huggingface dataset:
Program: 7391
Project: 7391
Buggy source:
@Override protected void startUp() throws Exception {
  Preconditions.checkNotNull(handlerDiscoverable,"String_Node_Str");
  resourceCoordinatorClient.startAndWait();
  handlerSubscription=resourceCoordinatorClient.subscribe(handlerDiscoverable.getName(),new StreamsLeaderHandler());
  leaderElection=new LeaderElection(zkClient,"String_Node_Str" + STREAMS_COORDINATOR,new ElectionHandler(){
    @Override public void leader(){
      LOG.info("String_Node_Str");
      resourceCoordinator=new ResourceCoordinator(zkClient,discoveryServiceClient,new BalancedAssignmentStrategy());
      resourceCoordinator.startAndWait();
      try {
        ResourceRequirement.Builder builder=ResourceRequirement.builder(Constants.Service.STREAMS);
        for (        StreamSpecification spec : streamMetaStore.listStreams()) {
          LOG.debug("String_Node_Str",spec.getName());
          builder.addPartition(new ResourceRequirement.Partition(spec.getName(),1));
        }
        resourceCoordinatorClient.submitRequirement(builder.build()).get();
      }
 catch (      Throwable e) {
        LOG.error("String_Node_Str",e);
        Throwables.propagate(e);
      }
    }
    @Override public void follower(){
      LOG.info("String_Node_Str");
      if (resourceCoordinator != null) {
        resourceCoordinator.stopAndWait();
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void startUp() throws Exception {
  Preconditions.checkNotNull(handlerDiscoverable,"String_Node_Str");
  resourceCoordinatorClient.startAndWait();
  handlerSubscription=resourceCoordinatorClient.subscribe(handlerDiscoverable.getName(),new StreamsLeaderHandler());
  leaderElection=new LeaderElection(zkClient,"String_Node_Str" + STREAMS_COORDINATOR,new ElectionHandler(){
    @Override public void leader(){
      LOG.info("String_Node_Str");
      resourceCoordinator=new ResourceCoordinator(zkClient,discoveryServiceClient,new BalancedAssignmentStrategy());
      resourceCoordinator.startAndWait();
      resourceCoordinatorClient.modifyRequirement(Constants.Service.STREAMS,new ResourceModifier(){
        @Nullable @Override public ResourceRequirement apply(        @Nullable ResourceRequirement existingRequirement){
          try {
            ResourceRequirement.Builder builder=ResourceRequirement.builder(Constants.Service.STREAMS);
            for (            StreamSpecification spec : streamMetaStore.listStreams()) {
              LOG.debug("String_Node_Str",spec.getName());
              builder.addPartition(new ResourceRequirement.Partition(spec.getName(),1));
            }
            return builder.build();
          }
 catch (          Throwable e) {
            LOG.error("String_Node_Str",e);
            Throwables.propagate(e);
            return null;
          }
        }
      }
);
    }
    @Override public void follower(){
      LOG.info("String_Node_Str");
      if (resourceCoordinator != null) {
        resourceCoordinator.stopAndWait();
      }
    }
  }
);
}
Program: 7392
Project: 7392
Buggy source:
/** 
 * @param resourceAcceptor Filter for accepting resources
 * @param parentClassLoader Parent classloader
 */
FilterClassLoader(Predicate<String> resourceAcceptor,ClassLoader parentClassLoader){
  super(parentClassLoader);
  this.resourceAcceptor=resourceAcceptor;
  this.bootstrapClassLoader=new URLClassLoader(new URL[0],null);
}

Fixed version (ground truth):
/** 
 * @param resourceAcceptor Filter for accepting resources
 * @param parentClassLoader Parent classloader
 */
FilterClassLoader(Predicate<String> resourceAcceptor,Predicate<String> packageAcceptor,ClassLoader parentClassLoader){
  super(parentClassLoader);
  this.resourceAcceptor=resourceAcceptor;
  this.packageAcceptor=packageAcceptor;
  this.bootstrapClassLoader=new URLClassLoader(new URL[0],null);
}
Program: 7393
Project: 7393
Buggy source:
/** 
 * Constructs an instance that load classes from the given directory for the given program type. <p/> The URLs for class loading are: <p/> <pre> [dir] [dir]/*.jar [dir]/lib/*.jar </pre>
 */
public static ProgramClassLoader create(File unpackedJarDir,ClassLoader parentClassLoader,@Nullable ProgramType programType) throws IOException {
  Predicate<String> predicate=Predicates.in(ProgramResources.getVisibleResources(programType));
  ClassLoader filteredParent=new FilterClassLoader(predicate,parentClassLoader);
  return new ProgramClassLoader(unpackedJarDir,filteredParent);
}

Fixed version (ground truth):
/** 
 * Constructs an instance that load classes from the given directory for the given program type. <p/> The URLs for class loading are: <p/> <pre> [dir] [dir]/*.jar [dir]/lib/*.jar </pre>
 */
public static ProgramClassLoader create(File unpackedJarDir,ClassLoader parentClassLoader,@Nullable ProgramType programType) throws IOException {
  Set<String> visibleResources=ProgramResources.getVisibleResources(programType);
  ImmutableSet.Builder<String> visiblePackages=ImmutableSet.builder();
  for (  String resource : visibleResources) {
    if (resource.endsWith("String_Node_Str")) {
      int idx=resource.lastIndexOf('/');
      if (idx > 0) {
        visiblePackages.add(resource.substring(0,idx));
      }
    }
  }
  ClassLoader filteredParent=new FilterClassLoader(Predicates.in(visibleResources),Predicates.in(visiblePackages.build()),parentClassLoader);
  return new ProgramClassLoader(unpackedJarDir,filteredParent);
}
Program: 7394
Project: 7394
Buggy source:
/** 
 * Returns a Set of resources name that are visible through the cdap-api module as well as Hadoop classes. This includes all classes+resources in cdap-api plus all classes+resources that cdap-api depends on (for example, sl4j, guava, gson, etc).
 */
private static Set<String> createBaseResources() throws IOException {
  ClassLoader classLoader=ProgramResources.class.getClassLoader();
  Set<ClassPath.ClassInfo> apiResources=getResources(getClassPath(classLoader,Application.class),CDAP_API_PACKAGES,Sets.<ClassPath.ClassInfo>newHashSet());
  Set<String> result=findClassDependencies(classLoader,Iterables.transform(apiResources,CLASS_INFO_TO_CLASS_NAME),Sets.<String>newHashSet());
  getResources(getClassPath(classLoader,Path.class),JAVAX_WS_RS_PACKAGES,CLASS_INFO_TO_RESOURCE_NAME,result);
  return ImmutableSet.copyOf(getResources(ClassPath.from(classLoader,JAR_ONLY_URI),HADOOP_PACKAGES,CLASS_INFO_TO_RESOURCE_NAME,result));
}

Fixed version (ground truth):
/** 
 * Returns a Set of resources name that are visible through the cdap-api module as well as Hadoop classes. This includes all classes+resources in cdap-api plus all classes+resources that cdap-api depends on (for example, sl4j, guava, gson, etc).
 */
private static Set<String> createBaseResources() throws IOException {
  ClassLoader classLoader=ProgramResources.class.getClassLoader();
  Set<ClassPath.ClassInfo> apiResources=getResources(getClassPath(classLoader,Application.class),CDAP_API_PACKAGES,Sets.<ClassPath.ClassInfo>newHashSet());
  Set<String> result=findClassDependencies(classLoader,Iterables.transform(apiResources,CLASS_INFO_TO_CLASS_NAME),Sets.<String>newHashSet());
  getResources(getClassPath(classLoader,Path.class),JAVAX_WS_RS_PACKAGES,CLASS_INFO_TO_RESOURCE_NAME,result);
  getResources(ClassPath.from(classLoader,JAR_ONLY_URI),HADOOP_PACKAGES,CLASS_INFO_TO_RESOURCE_NAME,result);
  return ImmutableSet.copyOf(Sets.filter(result,new Predicate<String>(){
    @Override public boolean apply(    String input){
      return !input.startsWith(HBASE_PACKAGE_PREFIX);
    }
  }
));
}
Program: 7395
Project: 7395
Buggy source:
@Override public String apply(ClassPath.ClassInfo input){
  return input.getResourceName();
}

Fixed version (ground truth):
@Override public boolean apply(String input){
  return !input.startsWith(HBASE_PACKAGE_PREFIX);
}
Program: 7396
Project: 7396
Buggy source:
@Test public void testMetricsContexts() throws Exception {
  metricsResponseCheck("String_Node_Str",2,ImmutableList.<String>of("String_Node_Str","String_Node_Str"));
  metricsResponseCheck("String_Node_Str",1,ImmutableList.<String>of("String_Node_Str"));
  metricsResponseCheck("String_Node_Str",3,ImmutableList.<String>of("String_Node_Str","String_Node_Str","String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testMetricsContexts() throws Exception {
  metricsResponseCheck("String_Node_Str",2,ImmutableList.<String>of("String_Node_Str","String_Node_Str"));
  metricsResponseCheck("String_Node_Str",1,ImmutableList.<String>of("String_Node_Str"));
  metricsResponseCheck("String_Node_Str",3,ImmutableList.<String>of("String_Node_Str","String_Node_Str","String_Node_Str"));
  metricsResponseCheck("String_Node_Str",2,ImmutableList.<String>of("String_Node_Str","String_Node_Str"));
  metricsResponseCheck("String_Node_Str",0,ImmutableList.<String>of());
}
Program: 7397
Project: 7397
Buggy source:
private List<String> getUniqueContextAndMetrics(byte[] startRow,byte[] endRow,FuzzyRowFilter filter,boolean isContextQuery,String contextPrefix,int targetOffset,int length) throws OperationException {
  List<String> metricsScanResults=Lists.newArrayList();
  Row rowResult;
  int contextOffset=entityCodec.getEncodedSize(MetricsEntityType.CONTEXT);
  do {
    ScannerFields fields=new ScannerFields(startRow,endRow,null,filter);
    Scanner scanner=null;
    try {
      scanner=timeSeriesTable.scan(fields.startRow,fields.endRow,fields.columns,fields.filter);
    }
 catch (    Exception e) {
      throw new OperationException(StatusCode.INTERNAL_ERROR,e.getMessage(),e);
    }
    rowResult=scanner.next();
    if (rowResult != null) {
      byte[] rowKey=rowResult.getRow();
      String contextStr=entityCodec.decode(MetricsEntityType.CONTEXT,rowKey,0);
      if (contextPrefix != null && !contextStr.startsWith(contextPrefix)) {
        scanner.close();
        break;
      }
      if (isContextQuery) {
        metricsScanResults.add(contextStr);
      }
 else {
        metricsScanResults.add(entityCodec.decode(MetricsEntityType.METRIC,rowKey,contextOffset));
      }
      startRow=getNextRow(rowKey,targetOffset,length);
      if (startRow == null) {
        scanner.close();
        break;
      }
    }
    scanner.close();
  }
 while (rowResult != null);
  return metricsScanResults;
}

Fixed version (ground truth):
private List<String> getUniqueContextAndMetrics(byte[] startRow,byte[] endRow,FuzzyRowFilter filter,boolean isContextQuery,String contextPrefix,int targetOffset,int length) throws OperationException {
  List<String> metricsScanResults=Lists.newArrayList();
  Row rowResult;
  int contextOffset=entityCodec.getEncodedSize(MetricsEntityType.CONTEXT);
  if (isContextQuery && contextPrefix != null) {
    contextPrefix+="String_Node_Str";
  }
  do {
    ScannerFields fields=new ScannerFields(startRow,endRow,null,filter);
    Scanner scanner=null;
    try {
      scanner=timeSeriesTable.scan(fields.startRow,fields.endRow,fields.columns,fields.filter);
    }
 catch (    Exception e) {
      throw new OperationException(StatusCode.INTERNAL_ERROR,e.getMessage(),e);
    }
    rowResult=scanner.next();
    if (rowResult != null) {
      byte[] rowKey=rowResult.getRow();
      String contextStr=entityCodec.decode(MetricsEntityType.CONTEXT,rowKey,0);
      if (contextPrefix != null && !contextStr.startsWith(contextPrefix)) {
        scanner.close();
        break;
      }
      if (isContextQuery) {
        metricsScanResults.add(contextStr);
      }
 else {
        metricsScanResults.add(entityCodec.decode(MetricsEntityType.METRIC,rowKey,contextOffset));
      }
      startRow=getNextRow(rowKey,targetOffset,length);
      if (startRow == null) {
        scanner.close();
        break;
      }
    }
    scanner.close();
  }
 while (rowResult != null);
  return metricsScanResults;
}
Program: 7398
Project: 7398
Buggy source:
/** 
 * Returns all the unique metrics in the given context
 */
@GET @Path("String_Node_Str") public void listContextMetrics(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String scope,@PathParam("String_Node_Str") final String context) throws IOException {
  try {
    MetricsScope metricsScope=MetricsScope.valueOf(scope.toUpperCase());
    if (metricsScope == null) {
      responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + MetricsScope.SYSTEM + "String_Node_Str"+ MetricsScope.USER+ "String_Node_Str");
      return;
    }
    responder.sendJson(HttpResponseStatus.OK,getAvailableMetricNames(metricsScope,context));
  }
 catch (  OperationException e) {
    LOG.warn("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Returns all the unique metrics in the given context
 */
@GET @Path("String_Node_Str") public void listContextMetrics(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String scope,@PathParam("String_Node_Str") final String context) throws IOException {
  try {
    MetricsScope metricsScope=MetricsScope.valueOf(scope.toUpperCase());
    responder.sendJson(HttpResponseStatus.OK,getAvailableMetricNames(metricsScope,context));
  }
 catch (  IllegalArgumentException exception) {
    responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + MetricsScope.SYSTEM + "String_Node_Str"+ MetricsScope.USER);
  }
catch (  OperationException e) {
    LOG.warn("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}
Program: 7399
Project: 7399
Buggy source:
/** 
 * Returns all the unique elements available in the context after the given context prefix
 */
@GET @Path("String_Node_Str") public void listContextsByPrefix(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String scope,@PathParam("String_Node_Str") final String context,@QueryParam("String_Node_Str") String search) throws IOException {
  try {
    if (search == null) {
      responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + "String_Node_Str");
      return;
    }
    MetricsScope metricsScope=MetricsScope.valueOf(scope.toUpperCase());
    if (metricsScope == null) {
      responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + MetricsScope.SYSTEM + "String_Node_Str"+ MetricsScope.USER+ "String_Node_Str");
      return;
    }
    responder.sendJson(HttpResponseStatus.OK,getNextContext(metricsScope,context));
  }
 catch (  OperationException e) {
    LOG.warn("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Returns all the unique elements available in the context after the given context prefix
 */
@GET @Path("String_Node_Str") public void listContextsByPrefix(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String scope,@PathParam("String_Node_Str") final String context,@QueryParam("String_Node_Str") String search) throws IOException {
  try {
    if (search == null || !search.equals("String_Node_Str")) {
      responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
    MetricsScope metricsScope=MetricsScope.valueOf(scope.toUpperCase());
    responder.sendJson(HttpResponseStatus.OK,getNextContext(metricsScope,context));
  }
 catch (  IllegalArgumentException exception) {
    responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + MetricsScope.SYSTEM + "String_Node_Str"+ MetricsScope.USER);
  }
catch (  OperationException e) {
    LOG.warn("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}
Program: 7400
Project: 7400
Buggy source:
private Set<String> getNextContext(MetricsScope scope,String contextPrefix) throws OperationException {
  SortedSet<String> nextLevelContexts=Sets.newTreeSet();
  TimeSeriesTable table=timeSeriesTables.get().get(scope);
  MetricsScanQuery query=new MetricsScanQueryBuilder().setContext(contextPrefix).allowEmptyMetric().build(-1,-1);
  List<String> results=table.getNextLevelContexts(query);
  for (  String nextContext : results) {
    if (contextPrefix == null) {
      int index=nextContext.indexOf("String_Node_Str");
      if (index == -1) {
        nextLevelContexts.add(nextContext);
      }
 else {
        nextLevelContexts.add(nextContext.substring(0,index));
      }
    }
 else {
      String context=nextContext.substring(contextPrefix.length() + 1);
      if (context.indexOf("String_Node_Str") != -1) {
        nextLevelContexts.add(context.substring(0,context.indexOf("String_Node_Str")));
      }
    }
  }
  return nextLevelContexts;
}

Fixed version (ground truth):
private String getNextContext(String context){
  int index=context.indexOf("String_Node_Str");
  if (index == -1) {
    return context;
  }
 else {
    return context.substring(0,context.indexOf("String_Node_Str"));
  }
}
Program: 7401
Project: 7401
Buggy source:
/** 
 * Returns all the unique elements available in the first context
 */
@GET @Path("String_Node_Str") public void listFirstContexts(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String scope,@QueryParam("String_Node_Str") String search) throws IOException {
  try {
    if (search == null) {
      responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + "String_Node_Str");
      return;
    }
    MetricsScope metricsScope=MetricsScope.valueOf(scope.toUpperCase());
    if (metricsScope == null) {
      responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + MetricsScope.SYSTEM + "String_Node_Str"+ MetricsScope.USER+ "String_Node_Str");
      return;
    }
    responder.sendJson(HttpResponseStatus.OK,getNextContext(metricsScope,null));
  }
 catch (  OperationException e) {
    LOG.warn("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Returns all the unique elements available in the first context
 */
@GET @Path("String_Node_Str") public void listFirstContexts(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") final String scope,@QueryParam("String_Node_Str") String search) throws IOException {
  try {
    if (search == null || !search.equals("String_Node_Str")) {
      responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
      return;
    }
    MetricsScope metricsScope=MetricsScope.valueOf(scope.toUpperCase());
    responder.sendJson(HttpResponseStatus.OK,getNextContext(metricsScope,null));
  }
 catch (  IllegalArgumentException exception) {
    responder.sendJson(HttpResponseStatus.BAD_REQUEST,"String_Node_Str" + MetricsScope.SYSTEM + "String_Node_Str"+ MetricsScope.USER);
  }
catch (  OperationException e) {
    LOG.warn("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}
Program: 7402
Project: 7402
Buggy source:
@BeforeClass public static void setup() throws InterruptedException {
  setupMetrics();
}

Fixed version (ground truth):
@BeforeClass public static void setup() throws Exception {
  setupMetrics();
}
Program: 7404
Project: 7404
Buggy source:
private byte[] getNextRow(byte[] rowKey,int offset,int length){
  byte[] stopKey=Bytes.stopKeyForPrefix(Arrays.copyOfRange(rowKey,offset,offset + length));
  if (stopKey == null) {
    return null;
  }
  byte[] nextRow=new byte[rowKey.length];
  copyByteArray(rowKey,nextRow,0,0,offset);
  copyByteArray(stopKey,nextRow,0,offset,stopKey.length);
  copyByteArray(rowKey,nextRow,offset + stopKey.length,offset + stopKey.length,rowKey.length - (offset + stopKey.length));
  return nextRow;
}

Fixed version (ground truth):
private byte[] getNextRow(byte[] rowKey,int offset,int length){
  byte[] stopKey=Bytes.stopKeyForPrefix(Arrays.copyOfRange(rowKey,offset,offset + length));
  if (stopKey == null) {
    return null;
  }
  byte[] nextRow=new byte[rowKey.length];
  System.arraycopy(rowKey,0,nextRow,0,offset);
  System.arraycopy(stopKey,0,nextRow,offset,stopKey.length);
  Arrays.fill(nextRow,offset + stopKey.length,rowKey.length,(byte)0);
  return nextRow;
}
Program: 7405
Project: 7405
Buggy source:
/** 
 * The rowkey consists of the following params in that order, while padding parameter is used to apply padding during individual parameter encoding.
 * @param contextPrefix Context the metric belongs to.
 * @param metricPrefix  metric string
 * @param tagPrefix metric tag.
 * @param timeBase timeBase.
 * @param runId runId if the metric belongs to a program.
 * @param padding Padding byte to apply for padding.
 * @return byte[] representing the rowkey that may have padding for each part.
 */
public byte[] paddedEncode(String contextPrefix,String metricPrefix,String tagPrefix,int timeBase,String runId,int padding){
  int idSize=entityTable.getIdSize();
  int totalDepth=getDepth(MetricsEntityType.CONTEXT) + getDepth(MetricsEntityType.METRIC) + getDepth(MetricsEntityType.TAG)+ getDepth(MetricsEntityType.RUN);
  int sizeOfTimeBase=4;
  byte[] result=new byte[idSize * totalDepth + sizeOfTimeBase];
  int offset=0;
  paddedEncode(MetricsEntityType.CONTEXT,contextPrefix,padding,result,offset);
  offset+=idSize * getDepth(MetricsEntityType.METRIC);
  paddedEncode(MetricsEntityType.METRIC,metricPrefix,padding,result,offset);
  offset+=idSize * getDepth(MetricsEntityType.METRIC);
  paddedEncode(MetricsEntityType.TAG,tagPrefix,padding,result,offset);
  offset+=idSize * getDepth(MetricsEntityType.TAG);
  System.arraycopy(Bytes.toBytes(timeBase),0,result,offset,sizeOfTimeBase);
  offset+=sizeOfTimeBase;
  paddedEncode(MetricsEntityType.RUN,runId,padding,result,offset);
  return result;
}

Fixed version (ground truth):
/** 
 * The rowkey consists of the following params in that order, while padding parameter is used to apply padding during individual parameter encoding.
 * @param contextPrefix Context the metric belongs to.
 * @param metricPrefix  metric string
 * @param tagPrefix metric tag.
 * @param timeBase timeBase.
 * @param runId runId if the metric belongs to a program.
 * @param padding Padding byte to apply for padding.
 * @return byte[] representing the rowkey that may have padding for each part.
 */
public byte[] paddedEncode(String contextPrefix,String metricPrefix,String tagPrefix,int timeBase,String runId,int padding){
  int idSize=entityTable.getIdSize();
  int totalDepth=getDepth(MetricsEntityType.CONTEXT) + getDepth(MetricsEntityType.METRIC) + getDepth(MetricsEntityType.TAG)+ getDepth(MetricsEntityType.RUN);
  int sizeOfTimeBase=4;
  byte[] result=new byte[idSize * totalDepth + sizeOfTimeBase];
  int offset=0;
  paddedEncode(MetricsEntityType.CONTEXT,contextPrefix,padding,result,offset);
  offset+=idSize * getDepth(MetricsEntityType.CONTEXT);
  paddedEncode(MetricsEntityType.METRIC,metricPrefix,padding,result,offset);
  offset+=idSize * getDepth(MetricsEntityType.METRIC);
  paddedEncode(MetricsEntityType.TAG,tagPrefix,padding,result,offset);
  offset+=idSize * getDepth(MetricsEntityType.TAG);
  System.arraycopy(Bytes.toBytes(timeBase),0,result,offset,sizeOfTimeBase);
  offset+=sizeOfTimeBase;
  paddedEncode(MetricsEntityType.RUN,runId,padding,result,offset);
  return result;
}
Program: 7406
Project: 7406
Buggy source:
private byte[] getNextRow(byte[] rowKey,int offset,int length){
  byte[] stopKey=Bytes.stopKeyForPrefix(Arrays.copyOfRange(rowKey,offset,offset + length));
  if (stopKey == null) {
    return null;
  }
  return Bytes.concat(Bytes.head(rowKey,offset),stopKey,Bytes.tail(rowKey,rowKey.length - (offset + length)));
}

Fixed version (ground truth):
private byte[] getNextRow(byte[] rowKey,int offset,int length){
  byte[] stopKey=Bytes.stopKeyForPrefix(Arrays.copyOfRange(rowKey,offset,offset + length));
  if (stopKey == null) {
    return null;
  }
  byte[] nextRow=new byte[rowKey.length];
  copyByteArray(rowKey,nextRow,0,0,offset);
  copyByteArray(stopKey,nextRow,0,offset,stopKey.length);
  copyByteArray(rowKey,nextRow,offset + stopKey.length,offset + stopKey.length,rowKey.length - (offset + stopKey.length));
  return nextRow;
}
Program: 7407
Project: 7407
Buggy source:
private ScannerFields getScannerFields(MetricsScanQuery query,boolean shouldMatchAllTags){
  int startTimeBase=getTimeBase(query.getStartTime());
  int endTimeBase=getTimeBase(query.getEndTime());
  byte[][] columns=null;
  if ((startTimeBase == endTimeBase) && (startTimeBase != -1)) {
    int startCol=(int)(query.getStartTime() - startTimeBase) / resolution;
    int endCol=(int)(query.getEndTime() - endTimeBase) / resolution;
    columns=new byte[endCol - startCol + 1][];
    for (int i=0; i < columns.length; i++) {
      columns[i]=Bytes.toBytes((short)(startCol + i));
    }
  }
  String tagPrefix=query.getTagPrefix();
  if (!shouldMatchAllTags && tagPrefix == null) {
    tagPrefix=MetricsConstants.EMPTY_TAG;
  }
  byte[] startRow=entityCodec.paddedEncode(query.getContextPrefix(),query.getMetricPrefix(),tagPrefix,startTimeBase,query.getRunId(),0);
  byte[] endRow=entityCodec.paddedEncode(query.getContextPrefix(),query.getMetricPrefix(),tagPrefix,endTimeBase + 1,query.getRunId(),0xff);
  FuzzyRowFilter filter=getFilter(query,startTimeBase,endTimeBase,shouldMatchAllTags);
  return new ScannerFields(startRow,endRow,columns,filter);
}

Fixed version (ground truth):
private ScannerFields getScannerFields(MetricsScanQuery query,boolean shouldMatchAllTags){
  int startTimeBase=getTimeBase(query.getStartTime());
  int endTimeBase=getTimeBase(query.getEndTime());
  byte[][] columns=null;
  if (startTimeBase == endTimeBase) {
    int startCol=(int)(query.getStartTime() - startTimeBase) / resolution;
    int endCol=(int)(query.getEndTime() - endTimeBase) / resolution;
    columns=new byte[endCol - startCol + 1][];
    for (int i=0; i < columns.length; i++) {
      columns[i]=Bytes.toBytes((short)(startCol + i));
    }
  }
  String tagPrefix=query.getTagPrefix();
  if (!shouldMatchAllTags && tagPrefix == null) {
    tagPrefix=MetricsConstants.EMPTY_TAG;
  }
  byte[] startRow=entityCodec.paddedEncode(query.getContextPrefix(),query.getMetricPrefix(),tagPrefix,startTimeBase,query.getRunId(),0);
  byte[] endRow=entityCodec.paddedEncode(query.getContextPrefix(),query.getMetricPrefix(),tagPrefix,endTimeBase + 1,query.getRunId(),0xff);
  FuzzyRowFilter filter=getFilter(query,startTimeBase,endTimeBase,shouldMatchAllTags);
  return new ScannerFields(startRow,endRow,columns,filter);
}
Program: 7408
Project: 7408
Buggy source:
@Override public ClassLoader create(DatasetModuleMeta moduleMeta,ClassLoader parentClassLoader) throws IOException {
  if (moduleMeta.getJarLocation() == null) {
    return parentClassLoader;
  }
  Location jarLocation=locationFactory.create(moduleMeta.getJarLocation());
  File tmpJar=File.createTempFile(jarLocation.getName(),null);
  try {
    MessageDigest messageDigest=MESSAGE_DIGEST.get();
    DigestOutputStream digestOutput=new DigestOutputStream(new FileOutputStream(tmpJar),messageDigest);
    try {
      ByteStreams.copy(Locations.newInputSupplier(jarLocation),digestOutput);
    }
  finally {
      digestOutput.close();
    }
    String dirName=String.format("String_Node_Str",moduleMeta.getName(),HashCodes.fromBytes(messageDigest.digest()));
    File expandDir=new File(tmpJar.getParent(),dirName);
    if (!expandDir.isDirectory()) {
      File tempDir=Files.createTempDir();
      try {
        BundleJarUtil.unpackProgramJar(Files.newInputStreamSupplier(tmpJar),tempDir);
        if (!tempDir.renameTo(expandDir) && !expandDir.isDirectory()) {
          throw new IOException("String_Node_Str" + tempDir + "String_Node_Str"+ expandDir);
        }
      }
  finally {
        try {
          if (tempDir.exists()) {
            DirUtils.deleteDirectoryContents(tempDir);
          }
        }
 catch (        IOException e) {
          LOG.warn("String_Node_Str",tempDir,e);
        }
      }
    }
    return new DirectoryClassLoader(expandDir,parentClassLoader,"String_Node_Str");
  }
  finally {
    tmpJar.delete();
  }
}

Fixed version (ground truth):
@Override public ClassLoader create(DatasetModuleMeta moduleMeta,ClassLoader parentClassLoader) throws IOException {
  if (moduleMeta.getJarLocation() == null) {
    return parentClassLoader;
  }
  Location jarLocation=locationFactory.create(moduleMeta.getJarLocation());
  File tmpJar=File.createTempFile(jarLocation.getName(),null);
  try {
    MessageDigest messageDigest=MESSAGE_DIGEST.get();
    DigestOutputStream digestOutput=new DigestOutputStream(new FileOutputStream(tmpJar),messageDigest);
    try {
      ByteStreams.copy(Locations.newInputSupplier(jarLocation),digestOutput);
    }
  finally {
      digestOutput.close();
    }
    String dirName=String.format("String_Node_Str",moduleMeta.getName(),Bytes.toStringBinary(messageDigest.digest()));
    File expandDir=new File(tmpJar.getParent(),dirName);
    if (!expandDir.isDirectory()) {
      File tempDir=Files.createTempDir();
      try {
        BundleJarUtil.unpackProgramJar(Files.newInputStreamSupplier(tmpJar),tempDir);
        if (!tempDir.renameTo(expandDir) && !expandDir.isDirectory()) {
          throw new IOException("String_Node_Str" + tempDir + "String_Node_Str"+ expandDir);
        }
      }
  finally {
        try {
          if (tempDir.exists()) {
            DirUtils.deleteDirectoryContents(tempDir);
          }
        }
 catch (        IOException e) {
          LOG.warn("String_Node_Str",tempDir,e);
        }
      }
    }
    return new DirectoryClassLoader(expandDir,parentClassLoader,"String_Node_Str");
  }
  finally {
    tmpJar.delete();
  }
}
Program: 7409
Project: 7409
Buggy source:
/** 
 * Updates the request URI to its v3 URI before forwarding (or even when delegating the handler method to a method in a v3 handler)
 * @param request the original {@link HttpRequest}
 */
private void rewriteRequest(HttpRequest request){
  String originalUri=request.getUri();
  request.setUri(originalUri.replaceFirst("String_Node_Str","String_Node_Str" + Constants.DEFAULT_NAMESPACE));
}

Fixed version (ground truth):
/** 
 * Updates the request URI to its v3 URI before delegating the call to the corresponding v3 handler.
 * @param request the original {@link HttpRequest}
 */
private void rewriteRequest(HttpRequest request){
  String originalUri=request.getUri();
  request.setUri(originalUri.replaceFirst("String_Node_Str","String_Node_Str" + Constants.DEFAULT_NAMESPACE));
}
Program: 7411
Project: 7411
Buggy source:
protected static String getVersionedAPIPath(String nonVersionedApiPath,@Nullable String version,@Nullable String namespace){
  StringBuilder versionedApiBuilder=new StringBuilder("String_Node_Str");
  if (version == null) {
    version=Constants.Gateway.API_VERSION_2_TOKEN;
    Preconditions.checkArgument(namespace == null,String.format("String_Node_Str" + "String_Node_Str",Constants.DEFAULT_NAMESPACE));
  }
  if (Constants.Gateway.API_VERSION_2_TOKEN.equals(version)) {
    versionedApiBuilder.append(version).append("String_Node_Str");
  }
 else   if (Constants.Gateway.API_VERSION_3_TOKEN.equals(version)) {
    Preconditions.checkArgument(namespace != null,"String_Node_Str");
    versionedApiBuilder.append(version).append("String_Node_Str").append(namespace).append("String_Node_Str");
  }
  versionedApiBuilder.append(nonVersionedApiPath);
  return versionedApiBuilder.toString();
}

Fixed version (ground truth):
protected static String getVersionedAPIPath(String nonVersionedApiPath,@Nullable String version,@Nullable String namespace){
  StringBuilder versionedApiBuilder=new StringBuilder("String_Node_Str");
  if (version == null) {
    version=Constants.Gateway.API_VERSION_2_TOKEN;
  }
  if (Constants.Gateway.API_VERSION_2_TOKEN.equals(version)) {
    Preconditions.checkArgument(namespace == null,String.format("String_Node_Str" + "String_Node_Str",Constants.DEFAULT_NAMESPACE));
    versionedApiBuilder.append(version).append("String_Node_Str");
  }
 else   if (Constants.Gateway.API_VERSION_3_TOKEN.equals(version)) {
    Preconditions.checkArgument(namespace != null,"String_Node_Str");
    versionedApiBuilder.append(version).append("String_Node_Str").append(namespace).append("String_Node_Str");
  }
 else {
    throw new IllegalArgumentException(String.format("String_Node_Str",version));
  }
  versionedApiBuilder.append(nonVersionedApiPath);
  return versionedApiBuilder.toString();
}
Program: 7412
Project: 7412
Buggy source:
/** 
 * Tests deploying an application in a non-existing non-default namespace.
 */
@Test public void testDeployNonExistingNamespace() throws Exception {
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,"String_Node_Str");
  Assert.assertEquals(404,response.getStatusLine().getStatusCode());
}

Fixed version (ground truth):
/** 
 * Tests deploying an application in a non-existing non-default namespace.
 */
@Test public void testDeployNonExistingNamespace() throws Exception {
  HttpResponse response=deploy(WordCountApp.class,Constants.Gateway.API_VERSION_3_TOKEN,"String_Node_Str");
  Assert.assertEquals(404,response.getStatusLine().getStatusCode());
  Assert.assertEquals("String_Node_Str",readResponse(response));
}
Program: 7413
Project: 7413
Buggy source:
/** 
 * Execute a set of operations on datasets via a   {@link co.cask.cdap.api.TxRunnable} that are committed as a single transaction.
 * @param runnable The runnable to be executed in the transaction
 */
void execute(TxRunnable runnable);

Fixed version (ground truth):
/** 
 * Execute a set of operations on datasets via a   {@link TxRunnable} that are committed as a single transaction.
 * @param runnable The runnable to be executed in the transaction
 */
void execute(TxRunnable runnable);
Program: 7415
Project: 7415
Buggy source:
@Override public boolean nextKeyValue() throws IOException, InterruptedException {
  StreamEvent streamEvent;
  do {
    if (reader.getPosition() >= inputSplit.getStart() + inputSplit.getLength()) {
      return false;
    }
    events.clear();
    if (reader.read(events,1,0,TimeUnit.SECONDS) <= 0) {
      return false;
    }
    streamEvent=events.get(0);
  }
 while (streamEvent.getTimestamp() < inputSplit.getStartTime());
  if (streamEvent.getTimestamp() >= inputSplit.getEndTime()) {
    return false;
  }
  currentEntry=decoder.decode(streamEvent,currentEntry);
  return true;
}

Fixed version (ground truth):
@Override public boolean nextKeyValue() throws IOException, InterruptedException {
  StreamEvent streamEvent;
  do {
    if (reader.getPosition() - inputSplit.getStart() >= inputSplit.getLength()) {
      return false;
    }
    events.clear();
    if (reader.read(events,1,0,TimeUnit.SECONDS) <= 0) {
      return false;
    }
    streamEvent=events.get(0);
  }
 while (streamEvent.getTimestamp() < inputSplit.getStartTime());
  if (streamEvent.getTimestamp() >= inputSplit.getEndTime()) {
    return false;
  }
  currentEntry=decoder.decode(streamEvent,currentEntry);
  return true;
}
Program: 7417
Project: 7417
Buggy source:
@Override public void stop(){
  getContext().execute(new TxRunnable(){
    @Override public void run(    DatasetContext context) throws Exception {
      KeyValueTable table=context.getDataset(DATASET_NAME);
      table.write(DATASET_TEST_KEY_STOP,DATASET_TEST_VALUE_STOP);
    }
  }
);
  workerStopped=true;
}

Fixed version (ground truth):
@Override public void stop(){
  getContext().execute(new TxRunnable(){
    @Override public void run(    DatasetContext context) throws Exception {
      KeyValueTable table=context.getDataset(DATASET_NAME);
      table.write(DATASET_TEST_KEY_STOP,valueToWriteOnStop);
    }
  }
);
  workerStopped=true;
}
Program: 7418
Project: 7418
Buggy source:
@Override public void run(DatasetContext context) throws Exception {
  KeyValueTable table=context.getDataset(DATASET_NAME);
  if (datasetHashCode == System.identityHashCode(table)) {
    table.write(DATASET_TEST_KEY,DATASET_TEST_VALUE);
  }
}

Fixed version (ground truth):
@Override public void run(DatasetContext context) throws Exception {
  KeyValueTable table=context.getDataset(DATASET_NAME);
  if (datasetHashCode == System.identityHashCode(table)) {
    table.write(DATASET_TEST_KEY,valueToWriteOnRun);
  }
}
Program: 7419
Project: 7419
Buggy source:
@Override public void initialize(ServiceWorkerContext context) throws Exception {
  super.initialize(context);
  getContext().execute(new TxRunnable(){
    @Override public void run(    DatasetContext context) throws Exception {
      KeyValueTable table=context.getDataset(DATASET_NAME);
      datasetHashCode=System.identityHashCode(table);
    }
  }
);
}

Fixed version (ground truth):
@Override public void initialize(ServiceWorkerContext context) throws Exception {
  super.initialize(context);
  valueToWriteOnRun=context.getRuntimeArguments().get(WRITE_VALUE_RUN_KEY);
  valueToWriteOnStop=context.getRuntimeArguments().get(WRITE_VALUE_STOP_KEY);
  getContext().execute(new TxRunnable(){
    @Override public void run(    DatasetContext context) throws Exception {
      KeyValueTable table=context.getDataset(DATASET_NAME);
      datasetHashCode=System.identityHashCode(table);
    }
  }
);
}
Program: 7421
Project: 7421
Buggy source:
protected void sendMetrics(String context,int containers,int memory,int vcores,String runId){
  LOG.trace("String_Node_Str",context,containers,memory,vcores);
  MetricsCollector collector=collectionService.getCollector(MetricsScope.SYSTEM,context,runId);
  collector.increment(METRIC_CONTAINERS,containers);
  collector.increment(METRIC_MEMORY_USAGE,memory);
  collector.increment(METRIC_VIRTUAL_CORE_USAGE,vcores);
}

Fixed version (ground truth):
protected void sendMetrics(String context,int containers,int memory,int vcores,String runId){
  LOG.trace("String_Node_Str",context,containers,memory,vcores);
  MetricsCollector collector=collectionService.getCollector(MetricsScope.SYSTEM,context,runId);
  collector.gauge(METRIC_CONTAINERS,containers);
  collector.gauge(METRIC_MEMORY_USAGE,memory);
  collector.gauge(METRIC_VIRTUAL_CORE_USAGE,vcores);
}
Program: 7422
Project: 7422
Buggy source:
@Override public void reportResources(){
  for (  TwillRunner.LiveInfo info : twillRunner.lookupLive()) {
    String metricContext=getMetricContext(info);
    if (metricContext == null) {
      continue;
    }
    int containers=0;
    int memory=0;
    int vcores=0;
    for (    TwillController controller : info.getControllers()) {
      ResourceReport report=controller.getResourceReport();
      if (report == null) {
        continue;
      }
      containers++;
      memory+=report.getAppMasterResources().getMemoryMB();
      vcores+=report.getAppMasterResources().getVirtualCores();
      sendMetrics(metricContext,containers,memory,vcores,controller.getRunId().getId());
    }
  }
  reportClusterStorage();
  reportClusterMemory();
}

Fixed version (ground truth):
@Override public void reportResources(){
  for (  TwillRunner.LiveInfo info : twillRunner.lookupLive()) {
    String metricContext=getMetricContext(info);
    if (metricContext == null) {
      continue;
    }
    for (    TwillController controller : info.getControllers()) {
      ResourceReport report=controller.getResourceReport();
      if (report == null) {
        continue;
      }
      int memory=report.getAppMasterResources().getMemoryMB();
      int vcores=report.getAppMasterResources().getVirtualCores();
      sendMetrics(metricContext,1,memory,vcores,controller.getRunId().getId());
    }
  }
  reportClusterStorage();
  reportClusterMemory();
}
Program: 7423
Project: 7423
Buggy source:
private static HttpURLConnection openStreamConnection(String streamName) throws IOException {
  int port=streamHttpService.getBindAddress().getPort();
  URL url=new URL(String.format("String_Node_Str",port,Constants.Gateway.GATEWAY_VERSION,streamName));
  return (HttpURLConnection)url.openConnection();
}

Fixed version (ground truth):
private static HttpURLConnection openStreamConnection(String streamName) throws IOException {
  int port=streamHttpService.getBindAddress().getPort();
  URL url=new URL(String.format("String_Node_Str",port,Constants.Gateway.API_VERSION_2,streamName));
  return (HttpURLConnection)url.openConnection();
}
Program: 7424
Project: 7424
Buggy source:
@GET @Path("String_Node_Str") public void getNamespace(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespace){
  try {
    NamespaceMeta ns=store.getNamespace(Id.Namespace.from(namespace));
    if (ns == null) {
      responder.sendString(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",namespace));
      return;
    }
    responder.sendJson(HttpResponseStatus.OK,ns);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") public void getNamespace(HttpRequest request,HttpResponder responder,@PathParam("String_Node_Str") String namespace){
  try {
    NamespaceMeta ns=store.getNamespace(Id.Namespace.from(namespace));
    if (ns == null) {
      responder.sendString(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",namespace));
      return;
    }
    responder.sendJson(HttpResponseStatus.OK,ns);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",namespace,e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}
Program: 7425
Project: 7425
Buggy source:
@PUT @Path("String_Node_Str") public void create(HttpRequest request,HttpResponder responder){
  NamespaceMeta metadata;
  try {
    metadata=parseBody(request,NamespaceMeta.class);
  }
 catch (  JsonSyntaxException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
    return;
  }
catch (  IOException e) {
    LOG.error("String_Node_Str",e);
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,"String_Node_Str");
    return;
  }
  String name=metadata.getName();
  if (name == null || name.isEmpty()) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
    return;
  }
  String displayName=metadata.getDisplayName();
  if (displayName == null || displayName.isEmpty()) {
    displayName=name;
  }
  String description=metadata.getDescription();
  if (description == null) {
    description="String_Node_Str";
  }
  try {
    NamespaceMeta existing=store.createNamespace(new NamespaceMeta.Builder().setName(name).setDisplayName(displayName).setDescription(description).build());
    if (existing == null) {
      responder.sendStatus(HttpResponseStatus.OK);
    }
 else {
      responder.sendString(HttpResponseStatus.CONFLICT,String.format("String_Node_Str",name));
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}

Fixed version (ground truth):
@PUT @Path("String_Node_Str") public void create(HttpRequest request,HttpResponder responder){
  NamespaceMeta metadata;
  try {
    metadata=parseBody(request,NamespaceMeta.class);
  }
 catch (  JsonSyntaxException e) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
    return;
  }
catch (  IOException e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
    return;
  }
  String name=metadata.getName();
  if (name == null || name.isEmpty()) {
    responder.sendString(HttpResponseStatus.BAD_REQUEST,"String_Node_Str");
    return;
  }
  String displayName=metadata.getDisplayName();
  if (displayName == null || displayName.isEmpty()) {
    displayName=name;
  }
  String description=metadata.getDescription();
  if (description == null) {
    description="String_Node_Str";
  }
  try {
    NamespaceMeta existing=store.createNamespace(new NamespaceMeta.Builder().setName(name).setDisplayName(displayName).setDescription(description).build());
    if (existing == null) {
      responder.sendStatus(HttpResponseStatus.OK);
    }
 else {
      responder.sendString(HttpResponseStatus.CONFLICT,String.format("String_Node_Str",name));
    }
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    responder.sendStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
  }
}
Program: 7426
Project: 7426
Buggy source:
@Override public void initialize(MapReduceContext context) throws Exception {
  userProfileServiceURL=context.getServiceURL(UserProfileService.SERVICE_NAME);
}

Fixed version (ground truth):
@Override public void initialize(MapReduceContext context) throws Exception {
  userProfileServiceURL=context.getServiceURL(UserProfileServiceHandler.SERVICE_NAME);
}
Program: 7428
Project: 7428
Buggy source:
/** 
 * Children call this method to signal the program is started.
 */
protected final void started(){
  if (!state.compareAndSet(State.STARTING,State.ALIVE)) {
    LOG.debug("String_Node_Str",programName,runId);
    return;
  }
  LOG.debug("String_Node_Str",programName,runId);
  executor(State.ALIVE).execute(new Runnable(){
    @Override public void run(){
      state.set(State.ALIVE);
      caller.alive();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Children call this method to signal the program is started.
 */
protected final void started(){
  if (!state.compareAndSet(State.STARTING,State.ALIVE)) {
    LOG.debug("String_Node_Str",state.get(),programName,runId);
    return;
  }
  LOG.debug("String_Node_Str",programName,runId);
  executor(State.ALIVE).execute(new Runnable(){
    @Override public void run(){
      state.set(State.ALIVE);
      caller.alive();
    }
  }
);
}
Program: 7430
Project: 7430
Buggy source:
@Override public void initialize(Configuration conf,Properties properties) throws SerDeException {
  columnNames=Lists.newArrayList(properties.getProperty(serdeConstants.LIST_COLUMNS).split("String_Node_Str"));
  columnTypes=TypeInfoUtils.getTypeInfosFromTypeString(properties.getProperty(serdeConstants.LIST_COLUMN_TYPES));
  int numCols=columnNames.size();
  final List<ObjectInspector> columnOIs=new ArrayList<ObjectInspector>(numCols);
  for (int i=0; i < numCols; i++) {
    columnOIs.add(TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(columnTypes.get(i)));
  }
  this.inspector=ObjectInspectorFactory.getStandardStructObjectInspector(columnNames,columnOIs);
  String streamName=properties.getProperty(Constants.Explore.STREAM_NAME);
  try {
    ContextManager.Context context=ContextManager.getContext(conf);
    StreamAdmin streamAdmin=context.getStreamAdmin();
    StreamConfig streamConfig=streamAdmin.getConfig(streamName);
    Location streamPath=StreamUtils.createGenerationLocation(streamConfig.getLocation(),StreamUtils.getGeneration(streamConfig));
    StreamInputFormatConfigurer.setTTL(conf,streamConfig.getTTL());
    StreamInputFormatConfigurer.setStreamPath(conf,streamPath.toURI());
  }
 catch (  IOException e) {
    LOG.error("String_Node_Str",e);
    throw new SerDeException(e);
  }
}

Fixed version (ground truth):
@Override public void initialize(Configuration conf,Properties properties) throws SerDeException {
  columnNames=Lists.newArrayList(properties.getProperty(serdeConstants.LIST_COLUMNS).split("String_Node_Str"));
  columnTypes=TypeInfoUtils.getTypeInfosFromTypeString(properties.getProperty(serdeConstants.LIST_COLUMN_TYPES));
  int numCols=columnNames.size();
  final List<ObjectInspector> columnOIs=new ArrayList<ObjectInspector>(numCols);
  for (int i=0; i < numCols; i++) {
    columnOIs.add(TypeInfoUtils.getStandardJavaObjectInspectorFromTypeInfo(columnTypes.get(i)));
  }
  this.inspector=ObjectInspectorFactory.getStandardStructObjectInspector(columnNames,columnOIs);
}
Program: 7431
Project: 7431
Buggy source:
@Override public Class<? extends InputFormat> getInputFormatClass(){
  return StreamInputFormat.class;
}

Fixed version (ground truth):
@Override public Class<? extends InputFormat> getInputFormatClass(){
  return HiveStreamInputFormat.class;
}
Program: 7433
Project: 7433
Buggy source:
@Override public RecordReader<K,V> createRecordReader(InputSplit split,TaskAttemptContext context) throws IOException, InterruptedException {
  return new StreamRecordReader(createStreamEventDecoder(context.getConfiguration()));
}

Fixed version (ground truth):
@Override public RecordReader<K,V> createRecordReader(InputSplit split,TaskAttemptContext context) throws IOException, InterruptedException {
  return new StreamRecordReader<K,V>(createStreamEventDecoder(context.getConfiguration()));
}