nus-yam/ex-repair huggingface dataset:
Program: 47305
Project: 47305
Buggy source:
private static void purgeFiles(){
  File purge=new File("String_Node_Str");
  String action=PMS.getConfiguration().getPluginPurgeAction();
  if (action.equalsIgnoreCase("String_Node_Str")) {
    purge.delete();
    return;
  }
  try {
    FileInputStream fis=new FileInputStream(purge);
    BufferedReader in=new BufferedReader(new InputStreamReader(fis));
    String line;
    while ((line=in.readLine()) != null) {
      File f=new File(line);
      if (action.equalsIgnoreCase("String_Node_Str")) {
        f.delete();
      }
 else       if (action.equalsIgnoreCase("String_Node_Str")) {
        FileUtils.moveFileToDirectory(f,new File("String_Node_Str"),true);
      }
    }
    fis.close();
  }
 catch (  Exception e) {
  }
  purge.delete();
}

Fixed version (ground truth):
private static void purgeFiles(){
  File purge=new File("String_Node_Str");
  String action=PMS.getConfiguration().getPluginPurgeAction();
  if (action.equalsIgnoreCase("String_Node_Str")) {
    purge.delete();
    return;
  }
  try {
    FileInputStream fis=new FileInputStream(purge);
    BufferedReader in=new BufferedReader(new InputStreamReader(fis));
    String line;
    while ((line=in.readLine()) != null) {
      File f=new File(line);
      if (action.equalsIgnoreCase("String_Node_Str")) {
        f.delete();
      }
 else       if (action.equalsIgnoreCase("String_Node_Str")) {
        FileUtils.moveFileToDirectory(f,new File("String_Node_Str"),true);
        f.delete();
      }
    }
    fis.close();
  }
 catch (  Exception e) {
  }
  purge.delete();
}
Program: 47307
Project: 47307
Buggy source:
public ArrayList<String> getStrings(String sql){
  ArrayList<String> list=new ArrayList<String>();
  Connection conn=null;
  ResultSet rs=null;
  PreparedStatement ps=null;
  try {
    conn=getConnection();
    ps=conn.prepareStatement(sql);
    rs=ps.executeQuery();
    while (rs.next()) {
      String str=rs.getString(1);
      if (StringUtils.isBlank(str)) {
        if (!list.contains(NONAME)) {
          list.add(NONAME);
        }
      }
 else       if (!list.contains(str)) {
        list.add(str);
      }
    }
  }
 catch (  SQLException se) {
    LOGGER.error(null,se);
    return null;
  }
 finally {
    close(rs);
    close(ps);
    close(conn);
  }
  return list;
}

Fixed version (ground truth):
public ArrayList<String> getStrings(String sql){
  ArrayList<String> list=new ArrayList<String>();
  Connection conn=null;
  ResultSet rs=null;
  PreparedStatement ps=null;
  try {
    conn=getConnection();
    ps=conn.prepareStatement(sql);
    rs=ps.executeQuery();
    while (rs.next()) {
      String str=rs.getString(1);
      if (isBlank(str)) {
        if (!list.contains(NONAME)) {
          list.add(NONAME);
        }
      }
 else       if (!list.contains(str)) {
        list.add(str);
      }
    }
  }
 catch (  SQLException se) {
    LOGGER.error(null,se);
    return null;
  }
 finally {
    close(rs);
    close(ps);
    close(conn);
  }
  return list;
}
Program: 47309
Project: 47309
Buggy source:
protected String[] getDefaultArgs(){
  return new String[]{"String_Node_Str","String_Node_Str",oaccopy ? "String_Node_Str" : (pcm ? "String_Node_Str" : "String_Node_Str"),"String_Node_Str",(wmv || mpegts) ? "String_Node_Str" : (pcm && avisynth()) ? "String_Node_Str" : (((pcm || dtsRemux || ac3Remux) ? "String_Node_Str" : "String_Node_Str")),(wmv || mpegts) ? "String_Node_Str" : "String_Node_Str",wmv ? "String_Node_Str" : (mpegts ? "String_Node_Str" : "String_Node_Str"),"String_Node_Str","String_Node_Str","String_Node_Str",(ac3Remux || ovccopy) ? "String_Node_Str" : "String_Node_Str"};
}

Fixed version (ground truth):
protected String[] getDefaultArgs(){
  return new String[]{"String_Node_Str","String_Node_Str",(ac3Remux || dtsRemux) ? "String_Node_Str" : (pcm ? "String_Node_Str" : "String_Node_Str"),"String_Node_Str",(wmv || mpegts) ? "String_Node_Str" : (pcm && avisynth()) ? "String_Node_Str" : (((pcm || dtsRemux || ac3Remux) ? "String_Node_Str" : "String_Node_Str")),(wmv || mpegts) ? "String_Node_Str" : "String_Node_Str",wmv ? "String_Node_Str" : (mpegts ? "String_Node_Str" : "String_Node_Str"),"String_Node_Str","String_Node_Str","String_Node_Str",(ac3Remux || ovccopy) ? "String_Node_Str" : "String_Node_Str"};
}
Program: 47313
Project: 47313
Buggy source:
private static void killProc() throws IOException {
  ProcessBuilder pb=null;
  BufferedReader in=new BufferedReader(new FileReader("String_Node_Str"));
  String pid=in.readLine();
  in.close();
  if (Platform.isWindows()) {
    pb=new ProcessBuilder("String_Node_Str","String_Node_Str","String_Node_Str",pid,"String_Node_Str");
  }
 else   if (Platform.isFreeBSD() || Platform.isLinux() || Platform.isOpenBSD()|| Platform.isSolaris())   pb=new ProcessBuilder("String_Node_Str","String_Node_Str",pid);
  if (pb == null)   return;
  try {
    Process p=pb.start();
    p.waitFor();
  }
 catch (  Exception e) {
    LOGGER.debug("String_Node_Str" + e);
  }
}

Fixed version (ground truth):
private static void killProc() throws IOException {
  ProcessBuilder pb=null;
  BufferedReader in=new BufferedReader(new FileReader("String_Node_Str"));
  String pid=in.readLine();
  in.close();
  if (Platform.isWindows()) {
    if (verifyPidName(pid)) {
      pb=new ProcessBuilder("String_Node_Str","String_Node_Str","String_Node_Str",pid,"String_Node_Str");
    }
  }
 else   if (Platform.isFreeBSD() || Platform.isLinux() || Platform.isOpenBSD()|| Platform.isSolaris())   pb=new ProcessBuilder("String_Node_Str","String_Node_Str",pid);
  if (pb == null)   return;
  try {
    Process p=pb.start();
    p.waitFor();
  }
 catch (  Exception e) {
    LOGGER.debug("String_Node_Str" + e);
  }
}
Program: 47314
Project: 47314
Buggy source:
private void processInitial(HttpServletRequest request,ServletResponse response,FilterChain chain,String returnUri,String authStateValue,Client client) throws IOException, ServletException {
  AuthenticatedPrincipal principal=(AuthenticatedPrincipal)request.getAttribute(AbstractAuthenticator.PRINCIPAL);
  List<AccessToken> tokens=accessTokenRepository.findByResourceOwnerIdAndClient(principal.getName(),client);
  if (!CollectionUtils.isEmpty(tokens)) {
    chain.doFilter(request,response);
  }
 else {
    AuthorizationRequest authorizationRequest=authorizationRequestRepository.findByAuthState(authStateValue);
    request.setAttribute("String_Node_Str",authorizationRequest.getRequestedScopes());
    request.setAttribute("String_Node_Str",client);
    request.setAttribute(AUTH_STATE,authStateValue);
    request.setAttribute("String_Node_Str",returnUri);
    request.getRequestDispatcher(getUserConsentUrl()).forward(request,response);
  }
}

Fixed version (ground truth):
private void processInitial(HttpServletRequest request,ServletResponse response,FilterChain chain,String returnUri,String authStateValue,Client client) throws IOException, ServletException {
  AuthenticatedPrincipal principal=(AuthenticatedPrincipal)request.getAttribute(AbstractAuthenticator.PRINCIPAL);
  List<AccessToken> tokens=accessTokenRepository.findByResourceOwnerIdAndClient(principal.getName(),client);
  if (!CollectionUtils.isEmpty(tokens)) {
    List<String> grantedScopes=tokens.get(0).getScopes();
    setGrantedScopes(request,grantedScopes.toArray(new String[grantedScopes.size()]));
    chain.doFilter(request,response);
  }
 else {
    AuthorizationRequest authorizationRequest=authorizationRequestRepository.findByAuthState(authStateValue);
    request.setAttribute("String_Node_Str",authorizationRequest.getRequestedScopes());
    request.setAttribute("String_Node_Str",client);
    request.setAttribute(AUTH_STATE,authStateValue);
    request.setAttribute("String_Node_Str",returnUri);
    request.getRequestDispatcher(getUserConsentUrl()).forward(request,response);
  }
}
Program: 47315
Project: 47315
Buggy source:
public Response validateScope(HttpServletRequest request,List<String> requiredScopes){
  VerifyTokenResponse verifyTokenResponse=(VerifyTokenResponse)request.getAttribute(AuthorizationServerFilter.VERIFY_TOKEN_RESPONSE);
  List<String> grantedScopes=verifyTokenResponse.getScopes();
  for (  String requiredScope : requiredScopes) {
    if (!grantedScopes.contains(requiredScope)) {
      return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(new ErrorResponse(OAuth2Validator.ValidationResponse.SCOPE_NOT_VALID.getValue(),OAuth2Validator.ValidationResponse.SCOPE_NOT_VALID.getDescription())).build();
    }
  }
  return null;
}

Fixed version (ground truth):
public Response validateScope(HttpServletRequest request,List<String> requiredScopes){
  VerifyTokenResponse verifyTokenResponse=(VerifyTokenResponse)request.getAttribute(AuthorizationServerFilter.VERIFY_TOKEN_RESPONSE);
  List<String> grantedScopes=verifyTokenResponse.getScopes();
  for (  String requiredScope : requiredScopes) {
    if (!grantedScopes.contains(requiredScope)) {
      LOG.debug("String_Node_Str",requiredScopes,grantedScopes);
      return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(new ErrorResponse(OAuth2Validator.ValidationResponse.SCOPE_NOT_VALID.getValue(),OAuth2Validator.ValidationResponse.SCOPE_NOT_VALID.getDescription())).build();
    }
  }
  return null;
}
Program: 47316
Project: 47316
Buggy source:
private void sendError(HttpServletResponse response,AuthorizationRequest authReq,ValidationResponse validate) throws IOException {
  LOG.info("String_Node_Str",authReq,validate);
  String redirectUri=authReq.getRedirectUri();
  String state=authReq.getState();
  if (isValidUrl(redirectUri)) {
    redirectUri.concat(redirectUri.contains("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
    redirectUri=redirectUri.concat("String_Node_Str").concat(validate.getValue()).concat("String_Node_Str").concat(validate.getDescription()).concat(StringUtils.isBlank(state) ? "String_Node_Str" : "String_Node_Str".concat(state));
    LOG.info("String_Node_Str",redirectUri);
    response.sendRedirect(redirectUri);
  }
 else {
    LOG.info("String_Node_Str",validate.getDescription());
    response.sendError(HttpServletResponse.SC_BAD_REQUEST,validate.getDescription());
  }
}

Fixed version (ground truth):
private void sendError(HttpServletResponse response,AuthorizationRequest authReq,ValidationResponse validate) throws IOException {
  LOG.info("String_Node_Str",authReq,validate);
  String redirectUri=authReq.getRedirectUri();
  String state=authReq.getState();
  if (isValidUrl(redirectUri)) {
    redirectUri=redirectUri.concat(redirectUri.contains("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
    redirectUri=redirectUri.concat("String_Node_Str").concat(validate.getValue()).concat("String_Node_Str").concat(validate.getDescription()).concat(StringUtils.isBlank(state) ? "String_Node_Str" : "String_Node_Str".concat(state));
    LOG.info("String_Node_Str",redirectUri);
    response.sendRedirect(redirectUri);
  }
 else {
    LOG.info("String_Node_Str",validate.getDescription());
    response.sendError(HttpServletResponse.SC_BAD_REQUEST,validate.getDescription());
  }
}
Program: 47317
Project: 47317
Buggy source:
@Override public void run(){
  try {
    fsCrawler.close();
  }
 catch (  InterruptedException ignored) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    fsCrawler.close();
  }
 catch (  InterruptedException ignored) {
    Thread.currentThread().interrupt();
  }
}
Program: 47318
Project: 47318
Buggy source:
private static void sleep(){
  try {
    Thread.sleep(CLOSE_POLLING_WAIT_MS);
  }
 catch (  InterruptedException ignored) {
  }
}

Fixed version (ground truth):
private static void sleep(){
  try {
    Thread.sleep(CLOSE_POLLING_WAIT_MS);
  }
 catch (  InterruptedException ignored) {
    Thread.currentThread().interrupt();
  }
}
Program: 47321
Project: 47321
Buggy source:
/** 
 * Test case for https://github.com/dadoonet/fscrawler/issues/221
 */
@Test public void testPdfIssue221() throws IOException {
  Doc doc=extractFromFile("String_Node_Str");
  assertThat(doc.getContent(),containsString("String_Node_Str"));
  assertThat(doc.getFile().getContentType(),containsString("String_Node_Str"));
  assertThat(doc.getMeta().getAuthor(),is(notNullValue()));
  assertThat(doc.getMeta().getDate(),is(LocalDateTime.of(2016,9,20,9,38,56)));
  assertThat(doc.getMeta().getKeywords(),not(emptyIterable()));
  assertThat(doc.getMeta().getTitle(),containsString("String_Node_Str"));
  doc=extractFromFile("String_Node_Str");
  assertThat(doc.getContent(),containsString("String_Node_Str"));
  assertThat(doc.getFile().getContentType(),containsString("String_Node_Str"));
  assertThat(doc.getMeta().getAuthor(),is(nullValue()));
  assertThat(doc.getMeta().getDate(),is(LocalDateTime.of(2016,9,19,14,29,37)));
  assertThat(doc.getMeta().getKeywords(),emptyIterable());
  assertThat(doc.getMeta().getTitle(),is(nullValue()));
}

Fixed version (ground truth):
/** 
 * Test case for https://github.com/dadoonet/fscrawler/issues/221
 */
@Test public void testPdfIssue221() throws IOException {
  Doc doc=extractFromFile("String_Node_Str");
  assertThat(doc.getContent(),containsString("String_Node_Str"));
  assertThat(doc.getFile().getContentType(),containsString("String_Node_Str"));
  assertThat(doc.getMeta().getAuthor(),is(notNullValue()));
  assertThat(doc.getMeta().getDate(),is(localDateTimeToDate(LocalDateTime.of(2016,9,20,9,38,56))));
  assertThat(doc.getMeta().getKeywords(),not(emptyIterable()));
  assertThat(doc.getMeta().getTitle(),containsString("String_Node_Str"));
  doc=extractFromFile("String_Node_Str");
  assertThat(doc.getContent(),containsString("String_Node_Str"));
  assertThat(doc.getFile().getContentType(),containsString("String_Node_Str"));
  assertThat(doc.getMeta().getAuthor(),is(nullValue()));
  assertThat(doc.getMeta().getDate(),is(localDateTimeToDate(LocalDateTime.of(2016,9,19,14,29,37))));
  assertThat(doc.getMeta().getKeywords(),emptyIterable());
  assertThat(doc.getMeta().getTitle(),is(nullValue()));
}
Program: 47324
Project: 47324
Buggy source:
public void index(String index,String type,String id,String json) throws IOException {
  logger.debug("String_Node_Str",index,type,id);
  StringEntity entity=new StringEntity(json,Charset.defaultCharset());
  Response restResponse=client.performRequest("String_Node_Str","String_Node_Str" + index + "String_Node_Str"+ type+ "String_Node_Str"+ id,Collections.emptyMap(),entity);
  Map<String,Object> responseAsMap=JsonUtil.asMap(restResponse);
  logger.trace("String_Node_Str",responseAsMap);
}

Fixed version (ground truth):
public void index(String index,String type,String id,String json) throws IOException {
  logger.debug("String_Node_Str",index,type,id);
  StringEntity entity=new StringEntity(json,StandardCharsets.UTF_8);
  Response restResponse=client.performRequest("String_Node_Str","String_Node_Str" + index + "String_Node_Str"+ type+ "String_Node_Str"+ id,Collections.emptyMap(),entity);
  Map<String,Object> responseAsMap=JsonUtil.asMap(restResponse);
  logger.trace("String_Node_Str",responseAsMap);
}
Program: 47325
Project: 47325
Buggy source:
public void putMapping(String index,String type,String mapping) throws IOException {
  logger.debug("String_Node_Str",index,type);
  StringEntity entity=new StringEntity(mapping,Charset.defaultCharset());
  Response restResponse=client.performRequest("String_Node_Str","String_Node_Str" + index + "String_Node_Str"+ type,Collections.emptyMap(),entity);
  Map<String,Object> responseAsMap=JsonUtil.asMap(restResponse);
  logger.trace("String_Node_Str",responseAsMap);
}

Fixed version (ground truth):
public void putMapping(String index,String type,String mapping) throws IOException {
  logger.debug("String_Node_Str",index,type);
  StringEntity entity=new StringEntity(mapping,StandardCharsets.UTF_8);
  Response restResponse=client.performRequest("String_Node_Str","String_Node_Str" + index + "String_Node_Str"+ type,Collections.emptyMap(),entity);
  Map<String,Object> responseAsMap=JsonUtil.asMap(restResponse);
  logger.trace("String_Node_Str",responseAsMap);
}
Program: 47326
Project: 47326
Buggy source:
public BulkResponse bulk(BulkRequest bulkRequest,String pipeline) throws Exception {
  StringBuffer sbf=new StringBuffer();
  for (  SingleBulkRequest request : bulkRequest.getRequests()) {
    sbf.append("String_Node_Str");
    String header=JsonUtil.serialize(request);
    if (request instanceof DeleteRequest) {
      sbf.append("String_Node_Str").append(header).append("String_Node_Str");
    }
    if (request instanceof IndexRequest) {
      sbf.append("String_Node_Str").append(header).append("String_Node_Str");
      sbf.append(((IndexRequest)request).content().replaceAll("String_Node_Str","String_Node_Str")).append("String_Node_Str");
    }
  }
  logger.trace("String_Node_Str");
  logger.trace("String_Node_Str",sbf);
  Map<String,String> params;
  if (pipeline != null) {
    params=new HashMap<>(1);
    params.put("String_Node_Str",pipeline);
  }
 else {
    params=Collections.emptyMap();
  }
  StringEntity entity=new StringEntity(sbf.toString(),Charset.defaultCharset());
  Response restResponse=client.performRequest("String_Node_Str","String_Node_Str",params,entity);
  BulkResponse response=JsonUtil.deserialize(restResponse,BulkResponse.class);
  logger.debug("String_Node_Str",response);
  return response;
}

Fixed version (ground truth):
public BulkResponse bulk(BulkRequest bulkRequest,String pipeline) throws Exception {
  StringBuffer sbf=new StringBuffer();
  for (  SingleBulkRequest request : bulkRequest.getRequests()) {
    sbf.append("String_Node_Str");
    String header=JsonUtil.serialize(request);
    if (request instanceof DeleteRequest) {
      sbf.append("String_Node_Str").append(header).append("String_Node_Str");
    }
    if (request instanceof IndexRequest) {
      sbf.append("String_Node_Str").append(header).append("String_Node_Str");
      sbf.append(((IndexRequest)request).content().replaceAll("String_Node_Str","String_Node_Str")).append("String_Node_Str");
    }
  }
  logger.trace("String_Node_Str");
  logger.trace("String_Node_Str",sbf);
  Map<String,String> params;
  if (pipeline != null) {
    params=new HashMap<>(1);
    params.put("String_Node_Str",pipeline);
  }
 else {
    params=Collections.emptyMap();
  }
  StringEntity entity=new StringEntity(sbf.toString(),StandardCharsets.UTF_8);
  Response restResponse=client.performRequest("String_Node_Str","String_Node_Str",params,entity);
  BulkResponse response=JsonUtil.deserialize(restResponse,BulkResponse.class);
  logger.debug("String_Node_Str",response);
  return response;
}
Program: 47327
Project: 47327
Buggy source:
/** 
 * Write a file in ~/.fscrawler/{subdir} dir
 * @param subdir subdir where we can read the file (null if we read in the root dir)
 * @param filename filename
 * @param content The String UTF-8 content to write
 * @throws IOException in case of error while reading
 */
protected void writeFile(String subdir,String filename,String content) throws IOException {
  Path dir=root;
  if (subdir != null) {
    dir=dir.resolve(subdir);
    if (Files.notExists(dir)) {
      Files.createDirectory(dir);
    }
  }
  Files.write(dir.resolve(filename),content.getBytes(Charset.forName("String_Node_Str")));
}

Fixed version (ground truth):
/** 
 * Write a file in ~/.fscrawler/{subdir} dir
 * @param subdir subdir where we can read the file (null if we read in the root dir)
 * @param filename filename
 * @param content The String UTF-8 content to write
 * @throws IOException in case of error while reading
 */
protected void writeFile(String subdir,String filename,String content) throws IOException {
  Path dir=root;
  if (subdir != null) {
    dir=dir.resolve(subdir);
    if (Files.notExists(dir)) {
      Files.createDirectory(dir);
    }
  }
  Files.write(dir.resolve(filename),content.getBytes(StandardCharsets.UTF_8));
}
Program: 47328
Project: 47328
Buggy source:
@Test public void testBulkWithPipeline() throws IOException, InterruptedException {
  assumeThat("String_Node_Str",elasticsearchClient.isIngestSupported(),is(true));
  elasticsearchClient.createIndex(getCrawlerName());
  elasticsearchClient.waitForHealthyIndex(getCrawlerName());
  String pipeline="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";
  StringEntity entity=new StringEntity(pipeline,Charset.defaultCharset());
  elasticsearchClient.getClient().performRequest("String_Node_Str","String_Node_Str" + getCrawlerName(),Collections.emptyMap(),entity);
  BulkProcessor bulkProcessor=BulkProcessor.simpleBulkProcessor(elasticsearchClient,100,TimeValue.timeValueSeconds(2),getCrawlerName());
  for (int i=0; i < 10; i++) {
    bulkProcessor.add(new IndexRequest(getCrawlerName(),FsCrawlerUtil.INDEX_TYPE_DOC,"String_Node_Str" + i).source("String_Node_Str"));
  }
  elasticsearchClient.refresh(getCrawlerName());
  waitForAllShardsAssigned();
  Thread.sleep(3000L);
  elasticsearchClient.refresh(getCrawlerName());
  SearchResponse response=elasticsearchClient.search(getCrawlerName(),FsCrawlerUtil.INDEX_TYPE_DOC,"String_Node_Str");
  assertThat(response.getHits().getTotal(),is(10L));
  bulkProcessor.close();
}

Fixed version (ground truth):
@Test public void testBulkWithPipeline() throws IOException, InterruptedException {
  assumeThat("String_Node_Str",elasticsearchClient.isIngestSupported(),is(true));
  elasticsearchClient.createIndex(getCrawlerName());
  elasticsearchClient.waitForHealthyIndex(getCrawlerName());
  String pipeline="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";
  StringEntity entity=new StringEntity(pipeline,StandardCharsets.UTF_8);
  elasticsearchClient.getClient().performRequest("String_Node_Str","String_Node_Str" + getCrawlerName(),Collections.emptyMap(),entity);
  BulkProcessor bulkProcessor=BulkProcessor.simpleBulkProcessor(elasticsearchClient,100,TimeValue.timeValueSeconds(2),getCrawlerName());
  for (int i=0; i < 10; i++) {
    bulkProcessor.add(new IndexRequest(getCrawlerName(),FsCrawlerUtil.INDEX_TYPE_DOC,"String_Node_Str" + i).source("String_Node_Str"));
  }
  elasticsearchClient.refresh(getCrawlerName());
  waitForAllShardsAssigned();
  Thread.sleep(3000L);
  elasticsearchClient.refresh(getCrawlerName());
  SearchResponse response=elasticsearchClient.search(getCrawlerName(),FsCrawlerUtil.INDEX_TYPE_DOC,"String_Node_Str");
  assertThat(response.getHits().getTotal(),is(10L));
  bulkProcessor.close();
}
Program: 47329
Project: 47329
Buggy source:
/** 
 * Test case for #234: https://github.com/dadoonet/fscrawler/issues/234 : Support ingest pipeline processing
 */
@Test public void test_ingest_pipeline() throws Exception {
  String crawlerName=getCrawlerName();
  assumeThat("String_Node_Str",elasticsearchClient.isIngestSupported(),is(true));
  String pipeline="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";
  StringEntity entity=new StringEntity(pipeline,Charset.defaultCharset());
  elasticsearchClient.getClient().performRequest("String_Node_Str","String_Node_Str" + crawlerName,Collections.emptyMap(),entity);
  Elasticsearch elasticsearch=endCrawlerDefinition(crawlerName);
  elasticsearch.setPipeline(crawlerName);
  startCrawler(crawlerName,startCrawlerDefinition().build(),elasticsearch,null);
  countTestHelper(crawlerName,"String_Node_Str",1);
}

Fixed version (ground truth):
/** 
 * Test case for #234: https://github.com/dadoonet/fscrawler/issues/234 : Support ingest pipeline processing
 */
@Test public void test_ingest_pipeline() throws Exception {
  String crawlerName=getCrawlerName();
  assumeThat("String_Node_Str",elasticsearchClient.isIngestSupported(),is(true));
  String pipeline="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";
  StringEntity entity=new StringEntity(pipeline,StandardCharsets.UTF_8);
  elasticsearchClient.getClient().performRequest("String_Node_Str","String_Node_Str" + crawlerName,Collections.emptyMap(),entity);
  Elasticsearch elasticsearch=endCrawlerDefinition(crawlerName);
  elasticsearch.setPipeline(crawlerName);
  startCrawler(crawlerName,startCrawlerDefinition().build(),elasticsearch,null);
  countTestHelper(crawlerName,"String_Node_Str",1);
}
Program: 47330
Project: 47330
Buggy source:
@Override protected boolean validateAction(){
  return getLookupRule() != null;
}

Fixed version (ground truth):
@Override protected boolean validateAction(){
  return true;
}
Program: 47331
Project: 47331
Buggy source:
private void initializePermissionPanel(Document fileInfo){
  usersAndRolesList.clear();
  existingUsersAndRoles.clear();
  for (  String name : getNames(fileInfo,USER_TYPE)) {
    usersAndRolesList.addItem(name,name + "String_Node_Str");
    existingUsersAndRoles.add(name);
  }
  for (  String name : getNames(fileInfo,ROLE_TYPE)) {
    usersAndRolesList.addItem(name,name + "String_Node_Str");
    existingUsersAndRoles.add(name);
  }
  if (usersAndRolesList.getItemCount() > 0) {
    usersAndRolesList.setSelectedIndex(0);
  }
  buildPermissionsTable(fileInfo);
}

Fixed version (ground truth):
private void initializePermissionPanel(Document fileInfo){
  this.fileInfo=fileInfo;
  usersAndRolesList.clear();
  existingUsersAndRoles.clear();
  for (  String name : getNames(fileInfo,USER_TYPE)) {
    usersAndRolesList.addItem(name,name + "String_Node_Str");
    existingUsersAndRoles.add(name);
  }
  for (  String name : getNames(fileInfo,ROLE_TYPE)) {
    usersAndRolesList.addItem(name,name + "String_Node_Str");
    existingUsersAndRoles.add(name);
  }
  if (usersAndRolesList.getItemCount() > 0) {
    usersAndRolesList.setSelectedIndex(0);
  }
  buildPermissionsTable(fileInfo);
}
Program: 47332
Project: 47332
Buggy source:
private void refreshPermission(Boolean inheritCheckBoxValue,Boolean managePermissionCheckBoxValue,Boolean deletePermissionCheckBoxValue){
  setInheritsAcls(inheritCheckBoxValue,fileInfo);
  managePermissionCheckBox.setEnabled(!inheritCheckBoxValue);
  deletePermissionCheckBox.setEnabled(!inheritCheckBoxValue && !managePermissionCheckBoxValue);
  writePermissionCheckBox.setEnabled(!inheritCheckBoxValue && !managePermissionCheckBoxValue && !deletePermissionCheckBoxValue);
  addButton.setEnabled(!inheritCheckBoxValue);
  removeButton.setEnabled(!inheritCheckBoxValue);
}

Fixed version (ground truth):
private void refreshPermission(Boolean inheritCheckBoxValue,Boolean managePermissionCheckBoxValue,Boolean deletePermissionCheckBoxValue){
  setInheritsAcls(inheritCheckBoxValue,fileInfo);
  managePermissionCheckBox.setEnabled(!inheritCheckBoxValue);
  deletePermissionCheckBox.setEnabled(!inheritCheckBoxValue && !managePermissionCheckBoxValue);
  writePermissionCheckBox.setEnabled(!inheritCheckBoxValue && !managePermissionCheckBoxValue && !deletePermissionCheckBoxValue);
  addButton.setEnabled(!inheritCheckBoxValue);
  removeButton.setEnabled(isRemovable());
}
Program: 47333
Project: 47333
Buggy source:
/** 
 * @param recipientName
 * @param recipientType
 */
void addRecipient(String recipientName,int recipientType,Document fileInfo){
  Element newAces=fileInfo.createElement(ACES_ELEMENT_NAME);
  Element newPermission=fileInfo.createElement(PERMISSIONS_ELEMENT_NAME);
  Element newRecipient=fileInfo.createElement(RECIPIENT_ELEMENT_NAME);
  Element newRecipientType=fileInfo.createElement(RECIPIENT_TYPE_ELEMENT_NAME);
  Text textNode=fileInfo.createTextNode(recipientName);
  newRecipient.appendChild(textNode);
  textNode=fileInfo.createTextNode(Integer.toString(recipientType));
  newRecipientType.appendChild(textNode);
  newAces.appendChild(newPermission);
  newAces.appendChild(newRecipient);
  newAces.appendChild(newRecipientType);
  fileInfo.getDocumentElement().appendChild(newAces);
  String strRecipientType=Integer.toString(recipientType);
  updatePermissionForUserOrRole(fileInfo,recipientName,strRecipientType,true,PERM_READ);
}

Fixed version (ground truth):
/** 
 * @param recipientName
 * @param recipientType
 */
void addRecipient(String recipientName,int recipientType,Document fileInfo){
  Element newAces=fileInfo.createElement(ACES_ELEMENT_NAME);
  Element newPermission=fileInfo.createElement(PERMISSIONS_ELEMENT_NAME);
  Element newRecipient=fileInfo.createElement(RECIPIENT_ELEMENT_NAME);
  Element newRecipientType=fileInfo.createElement(RECIPIENT_TYPE_ELEMENT_NAME);
  Element modifiableElementName=fileInfo.createElement(MODIFIABLE_ELEMENT_NAME);
  Text textNode=fileInfo.createTextNode(recipientName);
  newRecipient.appendChild(textNode);
  textNode=fileInfo.createTextNode(Integer.toString(recipientType));
  newRecipientType.appendChild(textNode);
  textNode=fileInfo.createTextNode(Boolean.toString(true));
  modifiableElementName.appendChild(textNode);
  newAces.appendChild(newPermission);
  newAces.appendChild(newRecipient);
  newAces.appendChild(newRecipientType);
  newAces.appendChild(modifiableElementName);
  fileInfo.getDocumentElement().appendChild(newAces);
  String strRecipientType=Integer.toString(recipientType);
  updatePermissionForUserOrRole(fileInfo,recipientName,strRecipientType,true,PERM_READ);
}
Program: 47336
Project: 47336
Buggy source:
public void setCurrentTabSaveEnabled(boolean enabled){
  IFrameTabPanel panel=getCurrentFrame();
  if (panel != null) {
    panel.setSaveEnabled(enabled);
    Widget selectTabContent=null;
    if (getTab(getSelectedTabIndex()) != null) {
      selectTabContent=getTab(getSelectedTabIndex()).getContent();
    }
    List<FileItem> selectedItems=SolutionBrowserPanel.getInstance().getFilesListPanel().getSelectedFileItems();
    EventBusUtil.EVENT_BUS.fireEvent(new SolutionBrowserSelectEvent(selectTabContent,selectedItems));
  }
}

Fixed version (ground truth):
public void setCurrentTabSaveEnabled(boolean enabled){
  PentahoTab tab=getTab(getSelectedTabIndex());
  setTabSaveEnabled(tab,enabled);
}
Program: 47339
Project: 47339
Buggy source:
@After public void tearDown() throws Exception {
  PentahoSystem.clearObjectFactory();
}

Fixed version (ground truth):
@After public void tearDown() throws Exception {
  ImportSession.getSession().getImportedScheduleJobIds().clear();
  PentahoSystem.clearObjectFactory();
}
Program: 47340
Project: 47340
Buggy source:
protected void exportFileContent(RepositoryFile exportRepositoryFile) throws IOException, ExportException {
  String filePath=new File(this.path).getParent();
  if (filePath == null) {
    filePath="String_Node_Str";
  }
  if (exportRepositoryFile == null) {
    throw new FileNotFoundException("String_Node_Str" + this.path);
  }
  if (exportRepositoryFile.isFolder()) {
    getExportManifest().getManifestInformation().setRootFolder(path.substring(0,path.lastIndexOf("String_Node_Str") + 1));
    if (!ClientRepositoryPaths.getRootFolderPath().equals(exportRepositoryFile.getPath())) {
      zos.putNextEntry(new ZipEntry(ExportFileNameEncoder.encodeZipPathName(getZipEntryName(exportRepositoryFile,filePath))));
    }
    exportDirectory(exportRepositoryFile,zos,filePath);
  }
 else {
    getExportManifest().getManifestInformation().setRootFolder(path.substring(0,path.lastIndexOf("String_Node_Str") + 1));
    exportFile(exportRepositoryFile,zos,filePath);
  }
}

Fixed version (ground truth):
protected void exportFileContent(RepositoryFile exportRepositoryFile) throws IOException, ExportException {
  String filePath=new File(this.path).getParent();
  if (filePath == null) {
    filePath="String_Node_Str";
  }
  if (exportRepositoryFile == null) {
    throw new FileNotFoundException("String_Node_Str" + this.path);
  }
  if (exportRepositoryFile.isFolder()) {
    getExportManifest().getManifestInformation().setRootFolder(path.substring(0,path.lastIndexOf("String_Node_Str") + 1));
    if (!ClientRepositoryPaths.getRootFolderPath().equals(exportRepositoryFile.getPath())) {
      zos.putNextEntry(new ZipEntry(getFixedZipEntryName(exportRepositoryFile,filePath)));
    }
    exportDirectory(exportRepositoryFile,zos,filePath);
  }
 else {
    getExportManifest().getManifestInformation().setRootFolder(path.substring(0,path.lastIndexOf("String_Node_Str") + 1));
    exportFile(exportRepositoryFile,zos,filePath);
  }
}
Program: 47341
Project: 47341
Buggy source:
protected void exportMetadataModels(){
  log.debug("String_Node_Str");
  Set<String> domainIds=getMetadataDomainRepository().getDomainIds();
  for (  String domainId : domainIds) {
    Map<String,InputStream> domainFilesData=getDomainFilesData(domainId);
    for (    String fileName : domainFilesData.keySet()) {
      String path=METADATA_PATH_IN_ZIP + fileName;
      if (!path.endsWith("String_Node_Str")) {
        path+="String_Node_Str";
      }
      ZipEntry zipEntry=new ZipEntry(new ZipEntry(ExportFileNameEncoder.encodeZipPathName(path)));
      InputStream inputStream=domainFilesData.get(fileName);
      try {
        zos.putNextEntry(zipEntry);
        IOUtils.copy(inputStream,zos);
        ExportManifestMetadata metadata=new ExportManifestMetadata();
        metadata.setDomainId(domainId);
        metadata.setFile(path);
        getExportManifest().addMetadata(metadata);
      }
 catch (      IOException e) {
        log.warn(e.getMessage(),e);
      }
 finally {
        IOUtils.closeQuietly(inputStream);
        try {
          zos.closeEntry();
        }
 catch (        IOException e) {
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void exportMetadataModels(){
  log.debug("String_Node_Str");
  Set<String> domainIds=getMetadataDomainRepository().getDomainIds();
  for (  String domainId : domainIds) {
    Map<String,InputStream> domainFilesData=getDomainFilesData(domainId);
    for (    String fileName : domainFilesData.keySet()) {
      String metadataFilePath=METADATA_PATH_IN_ZIP + fileName;
      if (!metadataFilePath.endsWith("String_Node_Str")) {
        metadataFilePath+="String_Node_Str";
      }
      String metadataZipEntryName=metadataFilePath;
      if (this.withManifest) {
        metadataZipEntryName=ExportFileNameEncoder.encodeZipPathName(metadataZipEntryName);
      }
      ZipEntry zipEntry=new ZipEntry(metadataZipEntryName);
      InputStream inputStream=domainFilesData.get(fileName);
      try {
        zos.putNextEntry(zipEntry);
        IOUtils.copy(inputStream,zos);
        ExportManifestMetadata metadata=new ExportManifestMetadata();
        metadata.setDomainId(domainId);
        metadata.setFile(metadataFilePath);
        getExportManifest().addMetadata(metadata);
      }
 catch (      IOException e) {
        log.warn(e.getMessage(),e);
      }
 finally {
        IOUtils.closeQuietly(inputStream);
        try {
          zos.closeEntry();
        }
 catch (        IOException e) {
        }
      }
    }
  }
}
Program: 47342
Project: 47342
Buggy source:
/** 
 * @param repositoryFile
 * @param outputStream
 * @throws ExportManifestFormatException
 */
public void exportFile(RepositoryFile repositoryFile,OutputStream outputStream,String filePath) throws ExportException, IOException {
  ZipOutputStream zos=(ZipOutputStream)outputStream;
  for (  ExportHandler exportHandler : exportHandlerList) {
    InputStream is=exportHandler.doExport(repositoryFile,filePath);
    if (is != null) {
      addToManifest(repositoryFile);
      String zipEntryName=getZipEntryName(repositoryFile,filePath);
      if (this.withManifest) {
        zipEntryName=ExportFileNameEncoder.encodeZipPathName(zipEntryName);
      }
      ZipEntry entry=new ZipEntry(zipEntryName);
      zos.putNextEntry(entry);
      IOUtils.copy(is,outputStream);
      zos.closeEntry();
      is.close();
      createLocales(repositoryFile,filePath,repositoryFile.isFolder(),outputStream);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param repositoryFile
 * @param outputStream
 * @throws ExportManifestFormatException
 */
public void exportFile(RepositoryFile repositoryFile,OutputStream outputStream,String filePath) throws ExportException, IOException {
  ZipOutputStream zos=(ZipOutputStream)outputStream;
  for (  ExportHandler exportHandler : exportHandlerList) {
    InputStream is=exportHandler.doExport(repositoryFile,filePath);
    if (is != null) {
      addToManifest(repositoryFile);
      String zipEntryName=getFixedZipEntryName(repositoryFile,filePath);
      ZipEntry entry=new ZipEntry(zipEntryName);
      zos.putNextEntry(entry);
      IOUtils.copy(is,outputStream);
      zos.closeEntry();
      is.close();
      createLocales(repositoryFile,filePath,repositoryFile.isFolder(),outputStream);
    }
  }
}
Program: 47343
Project: 47343
Buggy source:
/** 
 * @param repositoryDir
 * @param outputStream
 */
@Override public void exportDirectory(RepositoryFile repositoryDir,OutputStream outputStream,String filePath) throws ExportException, IOException {
  addToManifest(repositoryDir);
  List<RepositoryFile> children=this.unifiedRepository.getChildren(new RepositoryRequest(String.valueOf(repositoryDir.getId()),true,1,null));
  for (  RepositoryFile repositoryFile : children) {
    if (!ClientRepositoryPaths.getEtcFolderPath().equals(repositoryFile.getPath())) {
      if (repositoryFile.isFolder()) {
        if (outputStream.getClass().isAssignableFrom(ZipOutputStream.class)) {
          ZipOutputStream zos=(ZipOutputStream)outputStream;
          String zipEntryName=getZipEntryName(repositoryFile,filePath);
          if (this.withManifest) {
            zipEntryName=ExportFileNameEncoder.encodeZipPathName(zipEntryName);
          }
          ZipEntry entry=new ZipEntry(zipEntryName);
          zos.putNextEntry(entry);
        }
        exportDirectory(repositoryFile,outputStream,filePath);
      }
 else {
        try {
          exportFile(repositoryFile,outputStream,filePath);
        }
 catch (        ZipException e) {
          log.debug(e.getMessage(),e);
        }
      }
    }
  }
  createLocales(repositoryDir,filePath,repositoryDir.isFolder(),outputStream);
}

Fixed version (ground truth):
/** 
 * @param repositoryDir
 * @param outputStream
 */
@Override public void exportDirectory(RepositoryFile repositoryDir,OutputStream outputStream,String filePath) throws ExportException, IOException {
  addToManifest(repositoryDir);
  List<RepositoryFile> children=this.unifiedRepository.getChildren(new RepositoryRequest(String.valueOf(repositoryDir.getId()),true,1,null));
  for (  RepositoryFile repositoryFile : children) {
    if (!ClientRepositoryPaths.getEtcFolderPath().equals(repositoryFile.getPath())) {
      if (repositoryFile.isFolder()) {
        if (outputStream.getClass().isAssignableFrom(ZipOutputStream.class)) {
          ZipOutputStream zos=(ZipOutputStream)outputStream;
          String zipEntryName=getFixedZipEntryName(repositoryFile,filePath);
          ZipEntry entry=new ZipEntry(zipEntryName);
          zos.putNextEntry(entry);
        }
        exportDirectory(repositoryFile,outputStream,filePath);
      }
 else {
        try {
          exportFile(repositoryFile,outputStream,filePath);
        }
 catch (        ZipException e) {
          log.debug(e.getMessage(),e);
        }
      }
    }
  }
  createLocales(repositoryDir,filePath,repositoryDir.isFolder(),outputStream);
}
Program: 47345
Project: 47345
Buggy source:
/** 
 * Take repository file path and local file path and return computed zip entry path
 * @param repositoryFile
 * @param filePath
 * @return
 */
protected String getZipEntryName(RepositoryFile repositoryFile,String filePath){
  String result="String_Node_Str";
  int filePathLength=0;
  if (filePath.equals("String_Node_Str") || filePath.equals("String_Node_Str")) {
    filePathLength=filePath.length();
  }
 else {
    filePathLength=filePath.length() + 1;
  }
  result=repositoryFile.getPath().substring(filePathLength);
  if (repositoryFile.isFolder()) {
    result+="String_Node_Str";
  }
  return result;
}

Fixed version (ground truth):
protected String getZipEntryName(RepositoryFile repositoryFile,String filePath){
  String result="String_Node_Str";
  int filePathLength=0;
  if (filePath.equals("String_Node_Str") || filePath.equals("String_Node_Str")) {
    filePathLength=filePath.length();
  }
 else {
    filePathLength=filePath.length() + 1;
  }
  result=repositoryFile.getPath().substring(filePathLength);
  if (repositoryFile.isFolder()) {
    result+="String_Node_Str";
  }
  return result;
}
Program: 47348
Project: 47348
Buggy source:
/** 
 * @param repositoryFile
 * @param outputStream
 * @throws ExportManifestFormatException
 */
public void exportFile(RepositoryFile repositoryFile,OutputStream outputStream,String filePath) throws ExportException, IOException {
  ZipOutputStream zos=(ZipOutputStream)outputStream;
  for (  ExportHandler exportHandler : exportHandlerList) {
    InputStream is=exportHandler.doExport(repositoryFile,filePath);
    if (is != null) {
      addToManifest(repositoryFile);
      ZipEntry entry=new ZipEntry(ExportFileNameEncoder.encodeZipPathName(getZipEntryName(repositoryFile,filePath)));
      zos.putNextEntry(entry);
      IOUtils.copy(is,outputStream);
      zos.closeEntry();
      is.close();
      createLocales(repositoryFile,filePath,repositoryFile.isFolder(),outputStream);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param repositoryFile
 * @param outputStream
 * @throws ExportManifestFormatException
 */
public void exportFile(RepositoryFile repositoryFile,OutputStream outputStream,String filePath) throws ExportException, IOException {
  ZipOutputStream zos=(ZipOutputStream)outputStream;
  for (  ExportHandler exportHandler : exportHandlerList) {
    InputStream is=exportHandler.doExport(repositoryFile,filePath);
    if (is != null) {
      addToManifest(repositoryFile);
      String zipEntryName=getZipEntryName(repositoryFile,filePath);
      if (this.withManifest) {
        zipEntryName=ExportFileNameEncoder.encodeZipPathName(zipEntryName);
      }
      ZipEntry entry=new ZipEntry(zipEntryName);
      zos.putNextEntry(entry);
      IOUtils.copy(is,outputStream);
      zos.closeEntry();
      is.close();
      createLocales(repositoryFile,filePath,repositoryFile.isFolder(),outputStream);
    }
  }
}
Program: 47349
Project: 47349
Buggy source:
/** 
 * @param repositoryDir
 * @param outputStream
 */
@Override public void exportDirectory(RepositoryFile repositoryDir,OutputStream outputStream,String filePath) throws ExportException, IOException {
  addToManifest(repositoryDir);
  List<RepositoryFile> children=this.unifiedRepository.getChildren(new RepositoryRequest(String.valueOf(repositoryDir.getId()),true,1,null));
  for (  RepositoryFile repositoryFile : children) {
    if (!ClientRepositoryPaths.getEtcFolderPath().equals(repositoryFile.getPath())) {
      if (repositoryFile.isFolder()) {
        if (outputStream.getClass().isAssignableFrom(ZipOutputStream.class)) {
          ZipOutputStream zos=(ZipOutputStream)outputStream;
          ZipEntry entry=new ZipEntry(ExportFileNameEncoder.encodeZipPathName(getZipEntryName(repositoryFile,filePath)));
          zos.putNextEntry(entry);
        }
        exportDirectory(repositoryFile,outputStream,filePath);
      }
 else {
        try {
          exportFile(repositoryFile,outputStream,filePath);
        }
 catch (        ZipException e) {
          log.debug(e.getMessage(),e);
        }
      }
    }
  }
  createLocales(repositoryDir,filePath,repositoryDir.isFolder(),outputStream);
}

Fixed version (ground truth):
/** 
 * @param repositoryDir
 * @param outputStream
 */
@Override public void exportDirectory(RepositoryFile repositoryDir,OutputStream outputStream,String filePath) throws ExportException, IOException {
  addToManifest(repositoryDir);
  List<RepositoryFile> children=this.unifiedRepository.getChildren(new RepositoryRequest(String.valueOf(repositoryDir.getId()),true,1,null));
  for (  RepositoryFile repositoryFile : children) {
    if (!ClientRepositoryPaths.getEtcFolderPath().equals(repositoryFile.getPath())) {
      if (repositoryFile.isFolder()) {
        if (outputStream.getClass().isAssignableFrom(ZipOutputStream.class)) {
          ZipOutputStream zos=(ZipOutputStream)outputStream;
          String zipEntryName=getZipEntryName(repositoryFile,filePath);
          if (this.withManifest) {
            zipEntryName=ExportFileNameEncoder.encodeZipPathName(zipEntryName);
          }
          ZipEntry entry=new ZipEntry(zipEntryName);
          zos.putNextEntry(entry);
        }
        exportDirectory(repositoryFile,outputStream,filePath);
      }
 else {
        try {
          exportFile(repositoryFile,outputStream,filePath);
        }
 catch (        ZipException e) {
          log.debug(e.getMessage(),e);
        }
      }
    }
  }
  createLocales(repositoryDir,filePath,repositoryDir.isFolder(),outputStream);
}
Program: 47352
Project: 47352
Buggy source:
@Test public void testDoGetFileOrDirAsDownload() throws Throwable {
  final String fileName="String_Node_Str";
  IAuthorizationPolicy mockAuthPolicy=mock(IAuthorizationPolicy.class);
  doReturn(true).when(mockAuthPolicy).isAllowed(anyString());
  BaseExportProcessor mockExportProcessor=mock(BaseExportProcessor.class);
  File mockExportFile=mock(File.class);
  ExportHandler mockExportHandler=mock(ExportHandler.class);
  StreamingOutput mockStream=mock(StreamingOutput.class);
  RepositoryFile mockRepoFile=mock(RepositoryFile.class);
  doReturn(fileName).when(mockRepoFile).getName();
  doReturn(mockExportFile).when(mockExportProcessor).performExport(mockRepoFile);
  doReturn(mockRepoFile).when(fileService.repository).getFile(anyString());
  doReturn(mockAuthPolicy).when(fileService).getPolicy();
  doReturn(mockExportProcessor).when(fileService).getDownloadExportProcessor(anyString(),anyBoolean(),anyBoolean());
  doReturn(mockExportHandler).when(fileService).getDownloadExportHandler();
  doReturn(mockStream).when(fileService).getDownloadStream(mockRepoFile,mockExportProcessor);
  FileService.DownloadFileWrapper wrapper=fileService.doGetFileOrDirAsDownload("String_Node_Str","String_Node_Str" + fileName,"String_Node_Str");
  verify(fileService.repository,times(1)).getFile(anyString());
  assertEquals(mockStream,wrapper.getOutputStream());
  assertEquals(fileName + "String_Node_Str",wrapper.getEncodedFileName());
  assertEquals(true,wrapper.getAttachment().equals("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void testDoGetFileOrDirAsDownload() throws Throwable {
  assertDoGetFileOrDirAsDownload("String_Node_Str","String_Node_Str","String_Node_Str");
  assertDoGetFileOrDirAsDownload("String_Node_Str","String_Node_Str","String_Node_Str");
  assertDoGetFileOrDirAsDownload("String_Node_Str","String_Node_Str","String_Node_Str");
  assertDoGetFileOrDirAsDownload("String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 47355
Project: 47355
Buggy source:
@Test public void testImportFile() throws Exception {
  IPlatformImportBundle bundle=mock(IPlatformImportBundle.class);
  InputStream ios=mock(InputStream.class);
  byte[] bytes=new byte[]{};
  when(ios.read(any(bytes.getClass()),anyInt(),anyInt())).thenReturn(-1);
  when(bundle.getInputStream()).thenReturn(ios);
  when(bundle.getName()).thenReturn("String_Node_Str");
  when(bundle.getProperty("String_Node_Str")).thenReturn("String_Node_Str");
  handler.tmpXmlMetaStore=fromMetaStore;
  handler.importFile(bundle);
  verify(metastore).createNamespace("String_Node_Str");
  verify(metastore).createNamespace("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testImportFile() throws Exception {
  IPlatformImportBundle bundle=mock(IPlatformImportBundle.class);
  InputStream ios=mock(InputStream.class);
  byte[] bytes=new byte[]{};
  when(ios.read(any(bytes.getClass()),anyInt(),anyInt())).thenReturn(-1);
  when(bundle.getInputStream()).thenReturn(ios);
  when(bundle.getName()).thenReturn("String_Node_Str");
  when(bundle.getProperty("String_Node_Str")).thenReturn("String_Node_Str");
  handler.tmpXmlMetaStore=fromMetaStore;
  handler.importFile(bundle);
  verify(metastore).createNamespace("String_Node_Str");
  verify(metastore).createNamespace("String_Node_Str");
  verify(fromMetaStore).setRootFolder(anyString());
}
Program: 47356
Project: 47356
Buggy source:
@Override public List<String> getBoundLogicalRoleNames(ITenant tenant,List<String> runtimeRoleNames){
  return null;
}

Fixed version (ground truth):
@Override public List<String> getBoundLogicalRoleNames(Session session,ITenant tenant,List<String> runtimeRoleNames) throws RepositoryException {
  return null;
}