nus-yam/ex-repair huggingface dataset:
Program: 46916
Project: 46916
Buggy source:
QueryRequest(String serviceName,String spanName,List<String> annotations,Map<String,String> binaryAnnotations,Long minDuration,Long maxDuration,long endTs,long lookback,int limit){
  checkArgument(serviceName == null || !serviceName.isEmpty(),"String_Node_Str");
  checkArgument(spanName == null || !spanName.isEmpty(),"String_Node_Str");
  checkArgument(endTs > 0,"String_Node_Str",endTs);
  checkArgument(limit > 0,"String_Node_Str",limit);
  this.serviceName=serviceName != null ? serviceName.toLowerCase() : null;
  this.spanName=spanName != null ? spanName.toLowerCase() : null;
  this.annotations=annotations;
  for (  String annotation : annotations) {
    checkArgument(!annotation.isEmpty(),"String_Node_Str");
  }
  this.binaryAnnotations=binaryAnnotations;
  for (  Map.Entry<String,String> entry : binaryAnnotations.entrySet()) {
    checkArgument(!entry.getKey().isEmpty(),"String_Node_Str");
    checkArgument(!entry.getValue().isEmpty(),"String_Node_Str");
  }
  this.minDuration=minDuration;
  this.maxDuration=maxDuration;
  this.endTs=endTs;
  this.lookback=lookback;
  this.limit=limit;
}

Fixed version (ground truth):
QueryRequest(String serviceName,String spanName,List<String> annotations,Map<String,String> binaryAnnotations,Long minDuration,Long maxDuration,long endTs,long lookback,int limit){
  checkArgument(serviceName == null || !serviceName.isEmpty(),"String_Node_Str");
  checkArgument(spanName == null || !spanName.isEmpty(),"String_Node_Str");
  checkArgument(endTs > 0,"String_Node_Str",endTs);
  checkArgument(limit > 0,"String_Node_Str",limit);
  this.serviceName=serviceName != null ? serviceName.toLowerCase() : null;
  this.spanName=spanName != null ? spanName.toLowerCase() : null;
  this.annotations=annotations;
  for (  String annotation : annotations) {
    checkArgument(!annotation.isEmpty(),"String_Node_Str");
  }
  this.binaryAnnotations=binaryAnnotations;
  for (  Map.Entry<String,String> entry : binaryAnnotations.entrySet()) {
    checkArgument(!entry.getKey().isEmpty(),"String_Node_Str");
    checkArgument(!entry.getValue().isEmpty(),"String_Node_Str",entry.getKey());
  }
  this.minDuration=minDuration;
  this.maxDuration=maxDuration;
  this.endTs=endTs;
  this.lookback=lookback;
  this.limit=limit;
}
Program: 46917
Project: 46917
Buggy source:
/** 
 * Corresponds to query parameter "annotationQuery". Ex. "http.method=GET and finagle.retry"
 * @see QueryRequest#toAnnotationQuery()
 */
public Builder parseAnnotationQuery(String annotationQuery){
  if (annotationQuery != null && !annotationQuery.isEmpty()) {
    for (    String ann : annotationQuery.split("String_Node_Str")) {
      if (ann.indexOf('=') == -1) {
        addAnnotation(ann);
      }
 else {
        String[] keyValue=ann.split("String_Node_Str");
        if (keyValue.length < 2 || keyValue[1] == null) {
          addAnnotation(ann);
        }
        addBinaryAnnotation(keyValue[0],keyValue[1]);
      }
    }
  }
  return this;
}

Fixed version (ground truth):
/** 
 * Corresponds to query parameter "annotationQuery". Ex. "http.method=GET and finagle.retry"
 * @see QueryRequest#toAnnotationQuery()
 */
public Builder parseAnnotationQuery(String annotationQuery){
  if (annotationQuery != null && !annotationQuery.isEmpty()) {
    for (    String ann : annotationQuery.split("String_Node_Str")) {
      if (ann.indexOf('=') == -1) {
        addAnnotation(ann);
      }
 else {
        String[] keyValue=ann.split("String_Node_Str");
        addBinaryAnnotation(keyValue[0],keyValue.length < 2 ? "String_Node_Str" : keyValue[1]);
      }
    }
  }
  return this;
}
Program: 46918
Project: 46918
Buggy source:
@Bean @ConditionalOnMissingBean(DataSource.class) DataSource mysqlDataSource(){
  StringBuilder url=new StringBuilder("String_Node_Str");
  url.append(mysql.getHost()).append("String_Node_Str").append(mysql.getPort());
  url.append("String_Node_Str").append(mysql.getDb());
  url.append("String_Node_Str");
  url.append("String_Node_Str").append(mysql.isUseSsl());
  HikariDataSource result=new HikariDataSource();
  result.setDriverClassName("String_Node_Str");
  result.setJdbcUrl(url.toString());
  result.setMaximumPoolSize(mysql.getMaxActive());
  return result;
}

Fixed version (ground truth):
@Bean @ConditionalOnMissingBean(DataSource.class) DataSource mysqlDataSource(){
  StringBuilder url=new StringBuilder("String_Node_Str");
  url.append(mysql.getHost()).append("String_Node_Str").append(mysql.getPort());
  url.append("String_Node_Str").append(mysql.getDb());
  url.append("String_Node_Str");
  url.append("String_Node_Str").append(mysql.isUseSsl());
  HikariDataSource result=new HikariDataSource();
  result.setDriverClassName("String_Node_Str");
  result.setJdbcUrl(url.toString());
  result.setMaximumPoolSize(mysql.getMaxActive());
  result.setUsername(mysql.getUsername());
  result.setPassword(mysql.getPassword());
  return result;
}
Program: 46919
Project: 46919
Buggy source:
public QueryRequest build(){
  long selectedEndTs=endTs == null ? System.currentTimeMillis() * 1000 : endTs;
  return new QueryRequest(serviceName,spanName,annotations,binaryAnnotations,minDuration,maxDuration,selectedEndTs,Math.min(lookback == null ? selectedEndTs : lookback,selectedEndTs),limit == null ? 10 : limit);
}

Fixed version (ground truth):
public QueryRequest build(){
  long selectedEndTs=endTs == null ? System.currentTimeMillis() : endTs;
  return new QueryRequest(serviceName,spanName,annotations,binaryAnnotations,minDuration,maxDuration,selectedEndTs,Math.min(lookback == null ? selectedEndTs : lookback,selectedEndTs),limit == null ? 10 : limit);
}
Program: 46920
Project: 46920
Buggy source:
/** 
 * Removes an item from the list and animates the removal.
 * @param which Position to remove (NOTE: headers/footers ignored!this is a position in your input ListAdapter).
 * @param velocityX 
 */
public void removeItem(int which,float velocityX){
  if (mDragState == IDLE || mDragState == DRAGGING) {
    mDragState=REMOVING;
    mRemoveVelocityX=velocityX;
    if (mDragState == IDLE) {
      mSrcPos=getHeaderViewsCount() + which;
      mFirstExpPos=mSrcPos;
      mSecondExpPos=mSrcPos;
      mFloatPos=mSrcPos;
      View v=getChildAt(mSrcPos - getFirstVisiblePosition());
      if (v != null) {
        v.setVisibility(View.INVISIBLE);
      }
    }
    if (mInTouchEvent) {
switch (mCancelMethod) {
case ON_TOUCH_EVENT:
        super.onTouchEvent(mCancelEvent);
      break;
case ON_INTERCEPT_TOUCH_EVENT:
    super.onInterceptTouchEvent(mCancelEvent);
  break;
}
}
if (mRemoveAnimator != null) {
mRemoveAnimator.start();
}
 else {
doRemoveItem(which);
}
}
}

Fixed version (ground truth):
/** 
 * Removes an item from the list and animates the removal.
 * @param which Position to remove (NOTE: headers/footers ignored!this is a position in your input ListAdapter).
 * @param velocityX 
 */
public void removeItem(int which,float velocityX){
  if (mDragState == IDLE || mDragState == DRAGGING) {
    if (mDragState == IDLE) {
      mSrcPos=getHeaderViewsCount() + which;
      mFirstExpPos=mSrcPos;
      mSecondExpPos=mSrcPos;
      mFloatPos=mSrcPos;
      View v=getChildAt(mSrcPos - getFirstVisiblePosition());
      if (v != null) {
        v.setVisibility(View.INVISIBLE);
      }
    }
    mDragState=REMOVING;
    mRemoveVelocityX=velocityX;
    if (mInTouchEvent) {
switch (mCancelMethod) {
case ON_TOUCH_EVENT:
        super.onTouchEvent(mCancelEvent);
      break;
case ON_INTERCEPT_TOUCH_EVENT:
    super.onInterceptTouchEvent(mCancelEvent);
  break;
}
}
if (mRemoveAnimator != null) {
mRemoveAnimator.start();
}
 else {
doRemoveItem(which);
}
}
}
Program: 46924
Project: 46924
Buggy source:
private void prepare() throws IOException, InterruptedException {
  logger.debug("String_Node_Str");
  if (settings.getAsStructuredMap().containsKey("String_Node_Str")) {
    settings=settings.getAsSettings("String_Node_Str");
  }
  Runtime.getRuntime().addShutdownHook(shutdownHook());
  BlockingQueue<SettingsPipelineRequest> queue=new ArrayBlockingQueue<>(32);
  setQueue(queue);
  SettingsPipelineRequest element=new SettingsPipelineRequest().set(settings);
  getQueue().put(element);
  logger.debug("String_Node_Str");
}

Fixed version (ground truth):
private void prepare() throws IOException, InterruptedException {
  logger.debug("String_Node_Str");
  this.reloadSettings(settings);
  if (settings.getAsStructuredMap().containsKey("String_Node_Str")) {
    settings=settings.getAsSettings("String_Node_Str");
  }
  Runtime.getRuntime().addShutdownHook(shutdownHook());
  BlockingQueue<SettingsPipelineRequest> queue=new ArrayBlockingQueue<>(32);
  setQueue(queue);
  SettingsPipelineRequest element=new SettingsPipelineRequest().set(settings);
  getQueue().put(element);
  logger.debug("String_Node_Str");
}
Program: 46925
Project: 46925
Buggy source:
public JDBCImporter setSettings(Settings newSettings){
  settings=newSettings;
  String statefile=settings.get("String_Node_Str");
  if (statefile != null) {
    try {
      File file=new File(statefile);
      if (file.exists() && file.isFile() && file.canRead()) {
        InputStream stateFileInputStream=new FileInputStream(file);
        settings=settingsBuilder().put(settings).loadFromStream("String_Node_Str",stateFileInputStream).build();
        logger.info("String_Node_Str",statefile);
      }
 else {
        logger.warn("String_Node_Str",statefile);
      }
    }
 catch (    IOException e) {
      logger.error(e.getMessage(),e);
    }
  }
  return this;
}

Fixed version (ground truth):
public JDBCImporter setSettings(Settings newSettings){
  logger.debug("String_Node_Str",newSettings.getAsMap());
  settings=newSettings;
  String statefile=settings.get("String_Node_Str");
  if (statefile != null) {
    try {
      File file=new File(statefile);
      if (file.exists() && file.isFile() && file.canRead()) {
        InputStream stateFileInputStream=new FileInputStream(file);
        settings=settingsBuilder().put(settings).loadFromStream("String_Node_Str",stateFileInputStream).build();
        logger.info("String_Node_Str",statefile,settings.getAsMap());
      }
 else {
        logger.warn("String_Node_Str",statefile);
      }
    }
 catch (    IOException e) {
      logger.error(e.getMessage(),e);
    }
  }
  return this;
}
Program: 46926
Project: 46926
Buggy source:
@Override public BaseIngestTransportClient newIndex(String index,Settings settings,Map<String,String> mappings){
  if (client == null) {
    logger.warn("String_Node_Str");
    return this;
  }
  if (index == null) {
    logger.warn("String_Node_Str");
    return this;
  }
  CreateIndexRequestBuilder createIndexRequestBuilder=new CreateIndexRequestBuilder(client.admin().indices()).setIndex(index);
  Settings concreteSettings;
  if (settings == null && getSettings() != null) {
    concreteSettings=getSettings();
  }
 else   if (settings != null) {
    concreteSettings=settings;
  }
 else {
    concreteSettings=null;
  }
  if (concreteSettings != null) {
    createIndexRequestBuilder.setSettings(getSettings());
  }
  if (mappings == null && getMappings() != null) {
    for (    String type : getMappings().keySet()) {
      createIndexRequestBuilder.addMapping(type,getMappings().get(type));
    }
  }
 else   if (mappings != null) {
    for (    String type : mappings.keySet()) {
      createIndexRequestBuilder.addMapping(type,mappings.get(type));
    }
  }
  createIndexRequestBuilder.execute().actionGet();
  logger.info("String_Node_Str",index,concreteSettings != null ? concreteSettings.getAsMap() : "String_Node_Str",mappings != null ? mappings.size() : 0);
  return this;
}

Fixed version (ground truth):
@Override public BaseIngestTransportClient newIndex(String index,Settings settings,Map<String,String> mappings){
  if (client == null) {
    logger.warn("String_Node_Str");
    return this;
  }
  if (index == null) {
    logger.warn("String_Node_Str");
    return this;
  }
  CreateIndexRequestBuilder createIndexRequestBuilder=new CreateIndexRequestBuilder(client.admin().indices()).setIndex(index);
  Settings concreteSettings=null;
  if (settings != null) {
    concreteSettings=settings;
  }
 else   if (getSettings() != null) {
    concreteSettings=getSettings();
  }
  if (concreteSettings != null) {
    createIndexRequestBuilder.setSettings(concreteSettings);
  }
  if (mappings == null && getMappings() != null) {
    for (    String type : getMappings().keySet()) {
      createIndexRequestBuilder.addMapping(type,getMappings().get(type));
    }
  }
 else   if (mappings != null) {
    for (    String type : mappings.keySet()) {
      createIndexRequestBuilder.addMapping(type,mappings.get(type));
    }
  }
  createIndexRequestBuilder.execute().actionGet();
  logger.info("String_Node_Str",index,concreteSettings != null ? concreteSettings.getAsMap() : "String_Node_Str",mappings != null ? mappings.size() : 0);
  return this;
}
Program: 46927
Project: 46927
Buggy source:
public JDBCFeeder(JDBCFeeder feeder){
  super(feeder);
}

Fixed version (ground truth):
public JDBCFeeder(JDBCFeeder feeder){
  super(feeder);
  this.name=feeder.getName();
}
Program: 46928
Project: 46928
Buggy source:
@Test() @Parameters({"String_Node_Str"}) public void testWriteLastRiverRunTimeToCustomRiverInfo(String riverResource) throws IOException {
  final Client client=client("String_Node_Str");
  setupContext(new MockRiverSource(){
    @Override public void fetch(){
    }
  }
,riverResource);
  Map<String,Object> spec=(Map<String,Object>)riverSettings(riverResource).settings().get("String_Node_Str");
  Map<String,String> loadedSettings=new JsonSettingsLoader().load(jsonBuilder().map(spec).string());
  Settings settings=settingsBuilder().put(loadedSettings).build();
  RiverFlow flow=new ColumnRiverFlow();
  flow.setRiverContext(context);
  flow.getFeeder().setRiverState(new RiverState()).setSpec(spec).setSettings(settings).setClient(client).run();
}

Fixed version (ground truth):
@Test() @Parameters({"String_Node_Str"}) public void testWriteLastRiverRunTimeToCustomRiverInfo(String riverResource) throws IOException {
  final Client client=client("String_Node_Str");
  setupContext(new MockRiverSource(){
    @Override public void fetch(){
    }
  }
,riverResource);
  Map<String,Object> spec=(Map<String,Object>)riverSettings(riverResource).settings().get("String_Node_Str");
  Map<String,String> loadedSettings=new JsonSettingsLoader().load(jsonBuilder().map(spec).string());
  Settings settings=settingsBuilder().put(loadedSettings).build();
  RiverFlow flow=new ColumnRiverFlow();
  flow.setRiverContext(context);
  flow.getFeeder().setName(context.getRiverName()).setRiverState(new RiverState()).setSpec(spec).setSettings(settings).setClient(client).run();
  client.admin().indices().refresh(Requests.refreshRequest("String_Node_Str")).actionGet();
  assertLastRiverRunTimeExists(client);
}
Program: 46929
Project: 46929
Buggy source:
@Test @Parameters({"String_Node_Str","String_Node_Str","String_Node_Str"}) public void testSimpleRiverJob(String riverResource,String sql1,String sql2) throws IOException, InterruptedException, SQLException {
  Connection connection=source.connectionForWriting();
  createRandomProductsJob(connection,sql2,100);
  source.closeWriting();
  connection=source.connectionForReading();
  ResultSet results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  int count=results.next() ? results.getInt(1) : -1;
  source.close(results);
  source.closeReading();
  assertEquals(count,100);
  Client client=client("String_Node_Str");
  assertEquals(client.prepareSearch(INDEX).execute().actionGet().getHits().getTotalHits(),0);
  RiverSettings settings=riverSettings(riverResource);
  JDBCRiver river=new JDBCRiver(new RiverName(INDEX,TYPE),settings,client);
  river.once();
  Thread.sleep(10000L);
  assertEquals(client.prepareSearch(INDEX).setTypes(TYPE).execute().actionGet().getHits().getTotalHits(),100);
  connection=source.connectionForReading();
  results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  count=results.next() ? results.getInt(1) : -1;
  results.close();
  assertEquals(count,0);
  river.close();
}

Fixed version (ground truth):
@Test @Parameters({"String_Node_Str","String_Node_Str","String_Node_Str"}) public void testSimpleRiverJob(String riverResource,String sql1,String sql2) throws IOException, InterruptedException, SQLException {
  Connection connection=source.connectionForWriting();
  createRandomProductsJob(connection,sql2,100);
  source.closeWriting();
  connection=source.connectionForReading();
  ResultSet results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  int count=results.next() ? results.getInt(1) : -1;
  source.close(results);
  source.closeReading();
  assertEquals(count,100);
  Client client=client("String_Node_Str");
  try {
    assertEquals(client.prepareSearch(INDEX).execute().actionGet().getHits().getTotalHits(),0);
  }
 catch (  ElasticsearchException e) {
    logger.error("String_Node_Str",e,e.toString());
  }
  RiverSettings settings=riverSettings(riverResource);
  JDBCRiver river=new JDBCRiver(new RiverName(INDEX,TYPE),settings,client);
  river.once();
  Thread.sleep(10000L);
  assertEquals(client.prepareSearch(INDEX).setTypes(TYPE).execute().actionGet().getHits().getTotalHits(),100);
  connection=source.connectionForReading();
  results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  count=results.next() ? results.getInt(1) : -1;
  results.close();
  assertEquals(count,0);
  river.close();
}
Program: 46930
Project: 46930
Buggy source:
@Test @Parameters({"String_Node_Str","String_Node_Str","String_Node_Str"}) public void testSimpleRiverJob(String riverResource,String sql1,String sql2) throws IOException, InterruptedException, SQLException {
  Connection connection=source.connectionForWriting();
  createRandomProductsJob(connection,sql2,100);
  source.closeWriting();
  connection=source.connectionForReading();
  ResultSet results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  int count=results.next() ? results.getInt(1) : -1;
  source.close(results);
  source.closeReading();
  assertEquals(count,100);
  Client client=client("String_Node_Str");
  assertEquals(client.prepareSearch(INDEX).execute().actionGet().getHits().getTotalHits(),0);
  RiverSettings settings=riverSettings(riverResource);
  JDBCRiver river=new JDBCRiver(new RiverName(INDEX,TYPE),settings,client);
  river.once();
  Thread.sleep(10000L);
  assertEquals(client.prepareSearch(INDEX).setTypes(TYPE).execute().actionGet().getHits().getTotalHits(),100);
  connection=source.connectionForReading();
  results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  count=results.next() ? results.getInt(1) : -1;
  results.close();
  assertEquals(count,0);
  river.close();
}

Fixed version (ground truth):
@Test @Parameters({"String_Node_Str","String_Node_Str","String_Node_Str"}) public void testSimpleRiverJob(String riverResource,String sql1,String sql2) throws IOException, InterruptedException, SQLException {
  Connection connection=source.connectionForWriting();
  createRandomProductsJob(connection,sql2,100);
  source.closeWriting();
  connection=source.connectionForReading();
  ResultSet results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  int count=results.next() ? results.getInt(1) : -1;
  source.close(results);
  source.closeReading();
  assertEquals(count,100);
  Client client=client("String_Node_Str");
  try {
    assertEquals(client.prepareSearch(INDEX).execute().actionGet().getHits().getTotalHits(),0);
  }
 catch (  ElasticsearchException e) {
    logger.error("String_Node_Str",e,e.toString());
  }
  RiverSettings settings=riverSettings(riverResource);
  JDBCRiver river=new JDBCRiver(new RiverName(INDEX,TYPE),settings,client);
  river.once();
  Thread.sleep(10000L);
  assertEquals(client.prepareSearch(INDEX).setTypes(TYPE).execute().actionGet().getHits().getTotalHits(),100);
  connection=source.connectionForReading();
  results=connection.createStatement().executeQuery(sql1);
  if (!connection.getAutoCommit()) {
    connection.commit();
  }
  count=results.next() ? results.getInt(1) : -1;
  results.close();
  assertEquals(count,0);
  river.close();
}
Program: 46931
Project: 46931
Buggy source:
@BeforeMethod public void createIndices() throws Exception {
  startNode("String_Node_Str").client();
  client("String_Node_Str").admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
  client("String_Node_Str").admin().indices().create(new CreateIndexRequest(INDEX)).actionGet();
}

Fixed version (ground truth):
@BeforeMethod public void createIndices() throws Exception {
  startNode("String_Node_Str").client();
  client("String_Node_Str").admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
  client("String_Node_Str").admin().indices().create(new CreateIndexRequest(INDEX)).actionGet();
}
Program: 46932
Project: 46932
Buggy source:
@SuppressWarnings({"String_Node_Str"}) private void writeTimesToJdbcSettings(TimeValue lastRunTime,TimeValue currentTime){
  if (riverContext == null || riverContext.getRiverSettings() == null) {
    return;
  }
  Map<String,Object> jdbcSettings=(Map<String,Object>)riverContext.getRiverSettings().get("String_Node_Str");
  if (jdbcSettings == null) {
    jdbcSettings=new HashMap<String,Object>();
    riverContext.getRiverSettings().put("String_Node_Str",jdbcSettings);
  }
  jdbcSettings.put(ColumnRiverFlow.LAST_RUN_TIME,lastRunTime);
  jdbcSettings.put(ColumnRiverFlow.CURRENT_RUN_STARTED_TIME,currentTime);
}

Fixed version (ground truth):
private void writeTimesToJdbcSettings(TimeValue lastRunTime,TimeValue currentTime){
  if (riverContext == null || riverContext.getRiverSettings() == null) {
    return;
  }
  Map<String,Object> settings=riverContext.getRiverSettings();
  settings.put(ColumnRiverFlow.LAST_RUN_TIME,lastRunTime);
  settings.put(ColumnRiverFlow.CURRENT_RUN_STARTED_TIME,currentTime);
}
Program: 46933
Project: 46933
Buggy source:
private Timestamp getLastRunTimestamp(){
  Map jdbcSettings=(Map)context.getRiverSettings().get("String_Node_Str");
  logger.info("String_Node_Str",jdbcSettings);
  if (jdbcSettings == null || jdbcSettings.get(ColumnRiverFlow.LAST_RUN_TIME) == null) {
    return new Timestamp(0);
  }
  TimeValue lastRunTime=(TimeValue)jdbcSettings.get(ColumnRiverFlow.LAST_RUN_TIME);
  return new Timestamp(lastRunTime.millis());
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private Timestamp getLastRunTimestamp(){
  Map settings=(Map)context.getRiverSettings();
  logger.info("String_Node_Str",context.getRiverSettings());
  if (settings == null || settings.get(ColumnRiverFlow.LAST_RUN_TIME) == null) {
    return new Timestamp(0);
  }
  TimeValue lastRunTime=(TimeValue)settings.get(ColumnRiverFlow.LAST_RUN_TIME);
  return new Timestamp(lastRunTime.millis());
}
Program: 46934
Project: 46934
Buggy source:
/** 
 * Gets a raw uri like "/{name}/id/*" and returns "/([^/]*)/id/*." Also handles regular expressions if defined inside routes: For instance "/users/{username: [a-zA-Z][a-zA-Z_0-9]}" becomes "/users/([a-zA-Z][a-zA-Z_0-9])"
 * @return The converted regex with default matching regex - or the regexspecified by the user.
 */
protected static String convertRawUriToRegex(String rawUri){
  Matcher matcher=PATTERN_FOR_VARIABLE_PARTS_OF_ROUTE.matcher(rawUri);
  StringBuffer stringBuffer=new StringBuffer();
  while (matcher.find()) {
    String namedVariablePartOfRoute=matcher.group(3);
    String namedVariablePartOfORouteReplacedWithRegex;
    if (namedVariablePartOfRoute != null) {
      namedVariablePartOfORouteReplacedWithRegex="String_Node_Str" + Matcher.quoteReplacement(namedVariablePartOfRoute) + "String_Node_Str";
    }
 else {
      namedVariablePartOfORouteReplacedWithRegex=VARIABLE_ROUTES_DEFAULT_REGEX;
    }
    matcher.appendReplacement(stringBuffer,namedVariablePartOfORouteReplacedWithRegex);
  }
  matcher.appendTail(stringBuffer);
  return stringBuffer.toString();
}

Fixed version (ground truth):
/** 
 * Gets a raw uri like "/{name}/id/*" and returns "/([^/]*)/id/*." Also handles regular expressions if defined inside routes: For instance "/users/{username: [a-zA-Z][a-zA-Z_0-9]}" becomes "/users/([a-zA-Z][a-zA-Z_0-9])"
 * @return The converted regex with default matching regex - or the regexspecified by the user.
 */
protected static String convertRawUriToRegex(String rawUri){
  Matcher groupMatcher=Pattern.compile("String_Node_Str").matcher(rawUri);
  String converted=groupMatcher.replaceAll("String_Node_Str");
  Matcher matcher=PATTERN_FOR_VARIABLE_PARTS_OF_ROUTE.matcher(converted);
  StringBuffer stringBuffer=new StringBuffer();
  while (matcher.find()) {
    String namedVariablePartOfRoute=matcher.group(3);
    String namedVariablePartOfORouteReplacedWithRegex;
    if (namedVariablePartOfRoute != null) {
      namedVariablePartOfORouteReplacedWithRegex="String_Node_Str" + Matcher.quoteReplacement(namedVariablePartOfRoute) + "String_Node_Str";
    }
 else {
      namedVariablePartOfORouteReplacedWithRegex=VARIABLE_ROUTES_DEFAULT_REGEX;
    }
    matcher.appendReplacement(stringBuffer,namedVariablePartOfORouteReplacedWithRegex);
  }
  matcher.appendTail(stringBuffer);
  return stringBuffer.toString();
}
Program: 46935
Project: 46935
Buggy source:
@Test public void convertRawUriToRegex(){
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void convertRawUriToRegex(){
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
  assertThat(Route.convertRawUriToRegex("String_Node_Str"),CoreMatchers.equalTo("String_Node_Str"));
}
Program: 46936
Project: 46936
Buggy source:
public void renderResult(Context context,Result result) throws IOException {
  String out=render();
  ResponseStreams responseStreams=context.finalizeHeaders(result);
  try (Writer w=responseStreams.getWriter()){
    w.write(out);
    w.flush();
    w.close();
  }
 }

Fixed version (ground truth):
public void renderResult(Context context,Result result) throws IOException {
  String out=render();
  result.contentType("String_Node_Str");
  result.charset("String_Node_Str");
  ResponseStreams responseStreams=context.finalizeHeaders(result);
  try (Writer w=responseStreams.getWriter()){
    w.write(out);
    w.flush();
    w.close();
  }
 }
Program: 46937
Project: 46937
Buggy source:
/** 
 * Loads files from assets directory. This is the default directory of Ninja where to store stuff. Usually in src/main/java/assets/. But if user wants to use a dir outside of application project dir, then base dir can be overridden by static.asset.base.dir in application conf file.
 */
private URL getStaticFileFromAssetsDir(String fileName){
  URL url=null;
  if (ninjaProperties.isDev()) {
    String finalNameWithoutLeadingSlash=assetsControllerHelper.normalizePathWithoutLeadingSlash(fileName,false);
    File possibleFile=new File(assetsDirInDevModeWithoutTrailingSlash() + File.separator + finalNameWithoutLeadingSlash);
    url=getUrlForFile(possibleFile);
  }
 else {
    String finalNameWithoutLeadingSlash=assetsControllerHelper.normalizePathWithoutLeadingSlash(fileName,true);
    url=this.getClass().getClassLoader().getResource(ASSETS_DIR + "String_Node_Str" + finalNameWithoutLeadingSlash);
  }
  return url;
}

Fixed version (ground truth):
/** 
 * Loads files from assets directory. This is the default directory of Ninja where to store stuff. Usually in src/main/java/assets/. But if user wants to use a dir outside of application project dir, then base dir can be overridden by static.asset.base.dir in application conf file.
 */
private URL getStaticFileFromAssetsDir(String fileName){
  URL url=null;
  if (ninjaProperties.isDev() && new File(assetsDirInDevModeWithoutTrailingSlash()).exists()) {
    String finalNameWithoutLeadingSlash=assetsControllerHelper.normalizePathWithoutLeadingSlash(fileName,false);
    File possibleFile=new File(assetsDirInDevModeWithoutTrailingSlash() + File.separator + finalNameWithoutLeadingSlash);
    url=getUrlForFile(possibleFile);
  }
 else {
    String finalNameWithoutLeadingSlash=assetsControllerHelper.normalizePathWithoutLeadingSlash(fileName,true);
    url=this.getClass().getClassLoader().getResource(ASSETS_DIR + "String_Node_Str" + finalNameWithoutLeadingSlash);
  }
  return url;
}
Program: 46938
Project: 46938
Buggy source:
@Test public void testNormalizePathWithoutLeadingSlash(){
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals(null,assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals(null,assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals(null,assetsController.normalizePathWithoutLeadingSlash(null,true));
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  mockStatic(FilenameUtils.class,Mockito.CALLS_REAL_METHODS);
  when(FilenameUtils.normalize(anyString())).then(new Answer<String>(){
    @Override public String answer(    InvocationOnMock invocation) throws Throwable {
      Object[] args=invocation.getArguments();
      String file=(String)args[0];
      return FilenameUtils.normalize(file,false);
    }
  }
);
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",!SystemUtils.IS_OS_WINDOWS));
  assertNotEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",SystemUtils.IS_OS_WINDOWS));
  verifyStatic();
}

Fixed version (ground truth):
@Test public void testNormalizePathWithoutLeadingSlash(){
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals(null,assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals(null,assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  assertEquals(null,assetsController.normalizePathWithoutLeadingSlash(null,true));
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  mockStatic(FilenameUtils.class,Mockito.CALLS_REAL_METHODS);
  when(FilenameUtils.normalize(anyString())).then(new Answer<String>(){
    @Override public String answer(    InvocationOnMock invocation) throws Throwable {
      Object[] args=invocation.getArguments();
      String file=(String)args[0];
      return FilenameUtils.normalize(file,false);
    }
  }
);
  assertEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",false));
  assertNotEquals("String_Node_Str",assetsController.normalizePathWithoutLeadingSlash("String_Node_Str",true));
  verifyStatic();
}
Program: 46939
Project: 46939
Buggy source:
/** 
 * Whether diagnostics are enabled. If enabled then the default system/views will be skipped and a detailed diagnostic error result will be returned by the various methods in this class. You get precise feedback where an error occurred including original source code.
 * @return True if diagnostics are enabled otherwise false.
 */
public boolean isDiagnosticsEnabled(){
  return ninjaProperties.isDev() && ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,false);
}

Fixed version (ground truth):
/** 
 * Whether diagnostics are enabled. If enabled then the default system/views will be skipped and a detailed diagnostic error result will be returned by the various methods in this class. You get precise feedback where an error occurred including original source code.
 * @return True if diagnostics are enabled otherwise false.
 */
public boolean isDiagnosticsEnabled(){
  return ninjaProperties.isDev() && ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,Boolean.TRUE);
}
Program: 46940
Project: 46940
Buggy source:
@Test public void testOnRouteRequestWhenOnBadRequestInDiagnosticMode() throws Exception {
  FilterChain filterChain=Mockito.mock(FilterChain.class);
  Mockito.when(route.getFilterChain()).thenReturn(filterChain);
  BadRequestException badRequest=new BadRequestException("String_Node_Str");
  ;
  Mockito.when(filterChain.next(contextImpl)).thenThrow(badRequest);
  when(ninjaProperties.isDev()).thenReturn(true);
  when(ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,false)).thenReturn(true);
  ninjaDefault.onRouteRequest(contextImpl);
  Result localResult=ninjaDefault.getBadRequestResult(contextImpl,badRequest);
  assertThat(localResult.getRenderable(),CoreMatchers.instanceOf(DiagnosticError.class));
}

Fixed version (ground truth):
@Test public void testOnRouteRequestWhenOnBadRequestInDiagnosticMode() throws Exception {
  FilterChain filterChain=Mockito.mock(FilterChain.class);
  Mockito.when(route.getFilterChain()).thenReturn(filterChain);
  BadRequestException badRequest=new BadRequestException("String_Node_Str");
  ;
  Mockito.when(filterChain.next(contextImpl)).thenThrow(badRequest);
  when(ninjaProperties.isDev()).thenReturn(true);
  when(ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,true)).thenReturn(true);
  ninjaDefault.onRouteRequest(contextImpl);
  Result localResult=ninjaDefault.getBadRequestResult(contextImpl,badRequest);
  assertThat(localResult.getRenderable(),CoreMatchers.instanceOf(DiagnosticError.class));
}
Program: 46941
Project: 46941
Buggy source:
@Test public void testOnRouteRequestWhenInternalServerErrorExceptionInDiagnosticMode() throws Exception {
  FilterChain filterChain=Mockito.mock(FilterChain.class);
  Mockito.when(route.getFilterChain()).thenReturn(filterChain);
  InternalServerErrorException internalServerErrorException=new InternalServerErrorException("String_Node_Str");
  Mockito.when(filterChain.next(contextImpl)).thenThrow(internalServerErrorException);
  when(ninjaProperties.isDev()).thenReturn(true);
  when(ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,false)).thenReturn(true);
  ninjaDefault.onRouteRequest(contextImpl);
  Result localResult=ninjaDefault.getInternalServerErrorResult(contextImpl,internalServerErrorException);
  assertThat(localResult.getRenderable(),CoreMatchers.instanceOf(DiagnosticError.class));
}

Fixed version (ground truth):
@Test public void testOnRouteRequestWhenInternalServerErrorExceptionInDiagnosticMode() throws Exception {
  FilterChain filterChain=Mockito.mock(FilterChain.class);
  Mockito.when(route.getFilterChain()).thenReturn(filterChain);
  InternalServerErrorException internalServerErrorException=new InternalServerErrorException("String_Node_Str");
  Mockito.when(filterChain.next(contextImpl)).thenThrow(internalServerErrorException);
  when(ninjaProperties.isDev()).thenReturn(true);
  when(ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,true)).thenReturn(true);
  ninjaDefault.onRouteRequest(contextImpl);
  Result localResult=ninjaDefault.getInternalServerErrorResult(contextImpl,internalServerErrorException);
  assertThat(localResult.getRenderable(),CoreMatchers.instanceOf(DiagnosticError.class));
}
Program: 46942
Project: 46942
Buggy source:
@Test public void testOnRouteRequestWhenOnNotFoundInDiagnosticMode() throws Exception {
  FilterChain filterChain=Mockito.mock(FilterChain.class);
  Mockito.when(route.getFilterChain()).thenReturn(filterChain);
  Mockito.when(router.getRouteFor(Matchers.anyString(),Matchers.anyString())).thenReturn(null);
  when(ninjaProperties.isDev()).thenReturn(true);
  when(ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,false)).thenReturn(true);
  ninjaDefault.onRouteRequest(contextImpl);
  Result localResult=ninjaDefault.getNotFoundResult(contextImpl);
  assertThat(localResult.getRenderable(),CoreMatchers.instanceOf(DiagnosticError.class));
}

Fixed version (ground truth):
@Test public void testOnRouteRequestWhenOnNotFoundInDiagnosticMode() throws Exception {
  FilterChain filterChain=Mockito.mock(FilterChain.class);
  Mockito.when(route.getFilterChain()).thenReturn(filterChain);
  Mockito.when(router.getRouteFor(Matchers.anyString(),Matchers.anyString())).thenReturn(null);
  when(ninjaProperties.isDev()).thenReturn(true);
  when(ninjaProperties.getBooleanWithDefault(NinjaConstant.DIAGNOSTICS_KEY_NAME,true)).thenReturn(true);
  ninjaDefault.onRouteRequest(contextImpl);
  Result localResult=ninjaDefault.getNotFoundResult(contextImpl);
  assertThat(localResult.getRenderable(),CoreMatchers.instanceOf(DiagnosticError.class));
}
Program: 46944
Project: 46944
Buggy source:
public <T>T invoke(Context context,Class<T> classOfT){
  T t=null;
  try (InputStream inputStream=context.getInputStream()){
    t=objectMapper.readValue(inputStream,classOfT);
  }
 catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  return t;
}

Fixed version (ground truth):
public <T>T invoke(Context context,Class<T> classOfT){
  T t=null;
  try (InputStream inputStream=context.getInputStream()){
    t=objectMapper.readValue(inputStream,classOfT);
  }
 catch (  JsonMappingException ex) {
    try {
      t=classOfT.newInstance();
    }
 catch (    InstantiationException|IllegalAccessException e) {
      logger.error("String_Node_Str",classOfT.getName(),e);
    }
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  return t;
}
Program: 46945
Project: 46945
Buggy source:
public <T>T invoke(Context context,Class<T> classOfT){
  T t=null;
  try {
    t=xmlMapper.readValue(context.getInputStream(),classOfT);
  }
 catch (  JsonParseException e) {
    logger.error("String_Node_Str",e);
  }
catch (  JsonMappingException e) {
    logger.error("String_Node_Str",e);
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  return t;
}

Fixed version (ground truth):
public <T>T invoke(Context context,Class<T> classOfT){
  T t=null;
  try {
    t=xmlMapper.readValue(context.getInputStream(),classOfT);
  }
 catch (  JsonParseException|JsonMappingException e) {
    logger.error("String_Node_Str",e);
    try {
      t=classOfT.newInstance();
    }
 catch (    InstantiationException|IllegalAccessException ex) {
      logger.error("String_Node_Str",classOfT.getName(),e);
    }
  }
catch (  IOException e) {
    logger.error("String_Node_Str",e);
  }
  return t;
}
Program: 46946
Project: 46946
Buggy source:
public void handleTemplateException(TemplateException te,Environment env,Writer out) throws TemplateException {
  if (!ninjaProperties.isProd()) {
    PrintWriter pw=(out instanceof PrintWriter) ? (PrintWriter)out : new PrintWriter(out);
    pw.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    te.printStackTrace(pw);
    pw.println("String_Node_Str");
    pw.flush();
    pw.close();
    logger.error("String_Node_Str",te);
  }
  throw te;
}

Fixed version (ground truth):
public void handleTemplateException(TemplateException te,Environment env,Writer out) throws TemplateException {
  if (ninjaProperties.isProd()) {
    throw te;
  }
 else {
    PrintWriter pw=(out instanceof PrintWriter) ? (PrintWriter)out : new PrintWriter(out);
    pw.println("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
    te.printStackTrace(pw);
    pw.println("String_Node_Str");
    logger.error("String_Node_Str",te);
  }
}
Program: 46947
Project: 46947
Buggy source:
public static ControllerMethodInvoker build(Method method,Injector injector){
  final Class[] paramTypes=method.getParameterTypes();
  final Annotation[][] paramAnnotations=method.getParameterAnnotations();
  ArgumentExtractor<?>[] argumentExtractors=new ArgumentExtractor<?>[paramTypes.length];
  for (int i=0; i < paramTypes.length; i++) {
    try {
      argumentExtractors[i]=getArgumentExtractor(paramTypes[i],paramAnnotations[i],injector);
    }
 catch (    RoutingException e) {
      throw new RoutingException("String_Node_Str" + i + "String_Node_Str"+ method.getDeclaringClass().getName()+ "String_Node_Str"+ method.getName()+ "String_Node_Str",e);
    }
  }
  boolean bodyAsFound=false;
  for (int i=0; i < argumentExtractors.length; i++) {
    if (argumentExtractors[i] == null) {
      if (bodyAsFound) {
        throw new RoutingException("String_Node_Str" + method.getDeclaringClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str");
      }
 else {
        argumentExtractors[i]=new ArgumentExtractors.BodyAsExtractor(paramTypes[i]);
        bodyAsFound=true;
      }
    }
  }
  for (int i=0; i < argumentExtractors.length; i++) {
    argumentExtractors[i]=validateArgumentWithExtractor(paramTypes[i],paramAnnotations[i],injector,argumentExtractors[i]);
  }
  return new ControllerMethodInvoker(method,argumentExtractors);
}

Fixed version (ground truth):
public static ControllerMethodInvoker build(Method method,Injector injector){
  final Class[] paramTypes=method.getParameterTypes();
  final Annotation[][] paramAnnotations=method.getParameterAnnotations();
  ArgumentExtractor<?>[] argumentExtractors=new ArgumentExtractor<?>[paramTypes.length];
  for (int i=0; i < paramTypes.length; i++) {
    try {
      argumentExtractors[i]=getArgumentExtractor(paramTypes[i],paramAnnotations[i],injector);
    }
 catch (    RoutingException e) {
      throw new RoutingException("String_Node_Str" + i + "String_Node_Str"+ method.getDeclaringClass().getName()+ "String_Node_Str"+ method.getName()+ "String_Node_Str",e);
    }
  }
  int bodyAsFound=-1;
  for (int i=0; i < argumentExtractors.length; i++) {
    if (argumentExtractors[i] == null) {
      if (bodyAsFound > -1) {
        throw new RoutingException("String_Node_Str" + method.getDeclaringClass().getName() + "String_Node_Str"+ method.getName()+ "String_Node_Str"+ "String_Node_Str"+ paramTypes[bodyAsFound].getName()+ "String_Node_Str"+ "String_Node_Str"+ paramTypes[i].getName());
      }
 else {
        argumentExtractors[i]=new ArgumentExtractors.BodyAsExtractor(paramTypes[i]);
        bodyAsFound=i;
      }
    }
  }
  for (int i=0; i < argumentExtractors.length; i++) {
    argumentExtractors[i]=validateArgumentWithExtractor(paramTypes[i],paramAnnotations[i],injector,argumentExtractors[i]);
  }
  return new ControllerMethodInvoker(method,argumentExtractors);
}
Program: 46948
Project: 46948
Buggy source:
@Override public Result getForbiddenResult(Context context){
  String messageI18n=messages.getWithDefault(NinjaConstant.I18N_NINJA_SYSTEM_FORBIDDEN_REQUEST_TEXT_KEY,NinjaConstant.I18N_NINJA_SYSTEM_FORBIDDEN_REQUEST_TEXT_DEFAULT,context,Optional.<Result>absent());
  Message message=new Message(messageI18n);
  Result result=Results.forbidden().supportedContentTypes(Result.TEXT_HTML,Result.APPLICATON_JSON,Result.APPLICATION_XML).fallbackContentType(Result.TEXT_HTML).render(message).template(NinjaConstant.LOCATION_VIEW_FTL_HTML_FORBIDDEN);
  return result;
}

Fixed version (ground truth):
@Override public Result getForbiddenResult(Context context){
  String messageI18n=messages.getWithDefault(NinjaConstant.I18N_NINJA_SYSTEM_FORBIDDEN_REQUEST_TEXT_KEY,NinjaConstant.I18N_NINJA_SYSTEM_FORBIDDEN_REQUEST_TEXT_DEFAULT,context,Optional.<Result>absent());
  Message message=new Message(messageI18n);
  Result result=Results.forbidden().supportedContentTypes(Result.TEXT_HTML,Result.APPLICATION_JSON,Result.APPLICATION_XML).fallbackContentType(Result.TEXT_HTML).render(message).template(NinjaConstant.LOCATION_VIEW_FTL_HTML_FORBIDDEN);
  return result;
}
Program: 46949
Project: 46949
Buggy source:
@Override public Result getInternalServerErrorResult(Context context,Exception exception){
  logger.error("String_Node_Str",context.getRequestPath(),context.getRoute().getControllerClass(),context.getRoute().getControllerMethod(),exception);
  String messageI18n=messages.getWithDefault(NinjaConstant.I18N_NINJA_SYSTEM_INTERNAL_SERVER_ERROR_TEXT_KEY,NinjaConstant.I18N_NINJA_SYSTEM_INTERNAL_SERVER_ERROR_TEXT_DEFAULT,context,Optional.<Result>absent());
  Message message=new Message(messageI18n);
  Result result=Results.internalServerError().supportedContentTypes(Result.TEXT_HTML,Result.APPLICATON_JSON,Result.APPLICATION_XML).fallbackContentType(Result.TEXT_HTML).render(message).template(NinjaConstant.LOCATION_VIEW_FTL_HTML_INTERNAL_SERVER_ERROR);
  return result;
}

Fixed version (ground truth):
@Override public Result getInternalServerErrorResult(Context context,Exception exception){
  logger.error("String_Node_Str",context.getRequestPath(),context.getRoute().getControllerClass(),context.getRoute().getControllerMethod(),exception);
  String messageI18n=messages.getWithDefault(NinjaConstant.I18N_NINJA_SYSTEM_INTERNAL_SERVER_ERROR_TEXT_KEY,NinjaConstant.I18N_NINJA_SYSTEM_INTERNAL_SERVER_ERROR_TEXT_DEFAULT,context,Optional.<Result>absent());
  Message message=new Message(messageI18n);
  Result result=Results.internalServerError().supportedContentTypes(Result.TEXT_HTML,Result.APPLICATION_JSON,Result.APPLICATION_XML).fallbackContentType(Result.TEXT_HTML).render(message).template(NinjaConstant.LOCATION_VIEW_FTL_HTML_INTERNAL_SERVER_ERROR);
  return result;
}
Program: 46950
Project: 46950
Buggy source:
@Override public Result getUnauthorizedResult(Context context){
  String messageI18n=messages.getWithDefault(NinjaConstant.I18N_NINJA_SYSTEM_UNAUTHORIZED_REQUEST_TEXT_KEY,NinjaConstant.I18N_NINJA_SYSTEM_UNAUTHORIZED_REQUEST_TEXT_DEFAULT,context,Optional.<Result>absent());
  Message message=new Message(messageI18n);
  Result result=Results.unauthorized().addHeader(Result.WWW_AUTHENTICATE,"String_Node_Str").supportedContentTypes(Result.TEXT_HTML,Result.APPLICATON_JSON,Result.APPLICATION_XML).fallbackContentType(Result.TEXT_HTML).render(message).template(NinjaConstant.LOCATION_VIEW_FTL_HTML_UNAUTHORIZED);
  return result;
}

Fixed version (ground truth):
@Override public Result getUnauthorizedResult(Context context){
  String messageI18n=messages.getWithDefault(NinjaConstant.I18N_NINJA_SYSTEM_UNAUTHORIZED_REQUEST_TEXT_KEY,NinjaConstant.I18N_NINJA_SYSTEM_UNAUTHORIZED_REQUEST_TEXT_DEFAULT,context,Optional.<Result>absent());
  Message message=new Message(messageI18n);
  Result result=Results.unauthorized().addHeader(Result.WWW_AUTHENTICATE,"String_Node_Str").supportedContentTypes(Result.TEXT_HTML,Result.APPLICATION_JSON,Result.APPLICATION_XML).fallbackContentType(Result.TEXT_HTML).render(message).template(NinjaConstant.LOCATION_VIEW_FTL_HTML_UNAUTHORIZED);
  return result;
}