nus-yam/ex-repair huggingface dataset:
Program: 29243
Project: 29243
Buggy source:
/** 
 * utility method for deleting a directory and all its content
 */
private boolean deleteDir(File directory) throws IOException {
  if (!directory.isDirectory()) {
    throw new FileNotFoundException(directory.getPath());
  }
  boolean allDeletesSucceeded=true;
  File[] entries=directory.listFiles();
  for (int i=0; i < entries.length; i++) {
    if (entries[i].isDirectory()) {
      allDeletesSucceeded&=deleteDir(entries[i]);
    }
 else {
      if (!entries[i].equals(StaleFileManager.Util.markerFile(archive))) {
        final boolean fileDeleteOK=FileUtils.deleteFile(entries[i]);
        if (fileDeleteOK) {
          staleFileManager.recordDeletedEntry(entries[i]);
        }
        allDeletesSucceeded&=fileDeleteOK;
      }
    }
  }
  return (allDeletesSucceeded && FileUtils.deleteFile(directory));
}

Fixed version (ground truth):
/** 
 * utility method for deleting a directory and all its content
 */
private boolean deleteDir(File directory) throws IOException {
  if (!directory.isDirectory()) {
    throw new FileNotFoundException(directory.getPath());
  }
  boolean allDeletesSucceeded=true;
  if (FileUtils.safeIsRealDirectory(directory)) {
    File[] entries=directory.listFiles();
    for (int i=0; i < entries.length; i++) {
      if (entries[i].isDirectory()) {
        allDeletesSucceeded&=deleteDir(entries[i]);
      }
 else {
        if (!entries[i].equals(StaleFileManager.Util.markerFile(archive))) {
          final boolean fileDeleteOK=FileUtils.deleteFile(entries[i]);
          if (fileDeleteOK) {
            staleFileManager.recordDeletedEntry(entries[i]);
          }
          allDeletesSucceeded&=fileDeleteOK;
        }
      }
    }
  }
  return (allDeletesSucceeded && FileUtils.deleteFile(directory));
}
Program: 29244
Project: 29244
Buggy source:
/** 
 * Cleans up the CoordinatorLogSection and returns it to the pool for re-use Note: the implementation of the cache does not ensure that when an object is re-used there are no outstanding references to that object. However, the risk involved is minimal since reUse() replaces the existing call to finalize(). The existing call to finalize also does not ensure that there are no outstanding references to the object being finalized.
 * @param
 * @return
 * @see
 */
synchronized void reUse(){
  if (unwrittenObjects != null)   unwrittenObjects.removeAllElements();
  if (unwrittenData != null)   unwrittenData.removeAllElements();
  if (writtenObjects != null)   writtenObjects.removeAllElements();
  if (writtenData != null)   writtenData.removeAllElements();
  sectionName=null;
  unwrittenEmpty=true;
  writtenEmpty=true;
  headerLength=0;
  SectionPool.putCoordinatorLogSection(this);
}

Fixed version (ground truth):
/** 
 * Cleans up the CoordinatorLogSection and returns it to the pool for re-use Note: the implementation of the cache does not ensure that when an object is re-used there are no outstanding references to that object. However, the risk involved is minimal since reUse() replaces the existing call to finalize(). The existing call to finalize also does not ensure that there are no outstanding references to the object being finalized.
 * @param
 * @return
 * @see
 */
synchronized void reUse(){
  if (unwrittenObjects != null)   unwrittenObjects.removeAllElements();
  if (unwrittenData != null)   unwrittenData.removeAllElements();
  if (writtenObjects != null)   writtenObjects.removeAllElements();
  if (writtenData != null)   writtenData.removeAllElements();
  sectionName=null;
  unwrittenEmpty=true;
  writtenEmpty=true;
  SectionPool.putCoordinatorLogSection(this);
}
Program: 29245
Project: 29245
Buggy source:
/** 
 * Opens the log file for all CoordinatorLogs in this process. <p> If the log has already been opened, the operation uses the opened LogFile.
 * @param
 * @return  Indicates success of the operation.
 * @see
 */
private static boolean openLog(String logPath){
  boolean result=false;
  String logName;
  CoordinatorLogStateHolder logStateHolder=getStateHolder(logPath);
  if (logStateHolder.log == null) {
    logStateHolder.log=new Log(logPath);
    if (!logStateHolder.log.initialise()) {
      logStateHolder.log=null;
      _logger.log(Level.SEVERE,"String_Node_Str");
      String msg=LogFormatter.getLocalizedMessage(_logger,"String_Node_Str");
      throw new org.omg.CORBA.INTERNAL(msg);
    }
  }
  String serverName=null;
  if (logStateHolder.log != null && (serverName=Configuration.getServerName(logPath)) != null) {
    logStateHolder.logFile=logStateHolder.log.open(serverName,CoordinatorLogPool.getCoordinatorLog(logPath));
    if (logStateHolder.logFile == null) {
      _logger.log(Level.SEVERE,"String_Node_Str",serverName);
      String msg=LogFormatter.getLocalizedMessage(_logger,"String_Node_Str");
      throw new org.omg.CORBA.INTERNAL(msg);
    }
 else     Configuration.setLogFile(logPath,logStateHolder.logFile);
  }
  result=(logStateHolder.log != null && logStateHolder.logFile != null);
  return result;
}

Fixed version (ground truth):
/** 
 * Opens the log file for all CoordinatorLogs in this process. <p> If the log has already been opened, the operation uses the opened LogFile.
 * @param
 * @return  Indicates success of the operation.
 * @see
 */
private static boolean openLog(String logPath){
  boolean result=false;
  String logName;
  CoordinatorLogStateHolder logStateHolder=getStateHolder(logPath);
  if (logStateHolder.log == null) {
    logStateHolder.log=new Log(logPath);
    if (!logStateHolder.log.initialise()) {
      logStateHolder.log=null;
      _logger.log(Level.SEVERE,"String_Node_Str");
      String msg=LogFormatter.getLocalizedMessage(_logger,"String_Node_Str");
      throw new org.omg.CORBA.INTERNAL(msg);
    }
  }
  String serverName=null;
  if (logStateHolder.log != null && (serverName=Configuration.getServerName(logPath)) != null) {
    logStateHolder.logFile=logStateHolder.log.open(serverName,CoordinatorLogPool.getCoordinatorLog(logPath));
    if (logStateHolder.logFile == null) {
      _logger.log(Level.SEVERE,"String_Node_Str",serverName);
      String msg=LogFormatter.getLocalizedMessage(_logger,"String_Node_Str");
      throw new org.omg.CORBA.INTERNAL(msg);
    }
 else     Configuration.setLogFile(logPath,logStateHolder.logFile);
  }
  result=(logStateHolder.logFile != null);
  return result;
}
Program: 29246
Project: 29246
Buggy source:
/** 
 * Distributes before completion operations to all registered Synchronization objects. <p> Returns a boolean to indicate success/failure.
 * @param
 * @return  Indicates success of the operation.
 * @see
 */
boolean distributeBefore(){
  boolean result=true;
  for (int i=0; i < registered.size() && result == true; i++) {
    Synchronization sync=(Synchronization)registered.elementAt(i);
    try {
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.logp(Level.FINEST,"String_Node_Str","String_Node_Str","String_Node_Str" + sync);
      }
      sync.before_completion();
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.logp(Level.FINEST,"String_Node_Str","String_Node_Str","String_Node_Str" + sync);
      }
    }
 catch (    RuntimeException rex) {
      throw rex;
    }
catch (    Throwable exc) {
      if (!(exc instanceof INVALID_TRANSACTION)) {
        _logger.log(Level.WARNING,"String_Node_Str",new java.lang.Object[]{exc.toString(),"String_Node_Str"});
      }
      result=false;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Distributes before completion operations to all registered Synchronization objects. <p> Returns a boolean to indicate success/failure.
 * @param
 * @return  Indicates success of the operation.
 * @see
 */
boolean distributeBefore(){
  boolean result=true;
  for (int i=0; i < registered.size() && result == true; i++) {
    Synchronization sync=(Synchronization)registered.elementAt(i);
    try {
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.logp(Level.FINEST,"String_Node_Str","String_Node_Str","String_Node_Str" + sync);
      }
      sync.before_completion();
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.logp(Level.FINEST,"String_Node_Str","String_Node_Str","String_Node_Str" + sync);
      }
    }
 catch (    RuntimeException rex) {
      throw rex;
    }
catch (    Throwable exc) {
      _logger.log(Level.WARNING,"String_Node_Str",new java.lang.Object[]{exc.toString(),"String_Node_Str"});
      result=false;
    }
  }
  return result;
}
Program: 29248
Project: 29248
Buggy source:
private void preventNullStatus(String name,String id){
  if (status == null) {
    status=new CommandProgressImpl(name,id);
  }
  map.put(id,status);
}

Fixed version (ground truth):
private synchronized void preventNullStatus(String name,String id){
  if (status == null) {
    status=new CommandProgressImpl(name,id);
  }
  map.put(id,status);
}
Program: 29249
Project: 29249
Buggy source:
public ProgressStatus getProgressStatus(){
  return status;
}

Fixed version (ground truth):
public synchronized ProgressStatus getProgressStatus(){
  return status;
}
Program: 29251
Project: 29251
Buggy source:
public static ProgressStatusDTO readProgressStatus(JsonParser jp) throws IOException {
  ChildProgressStatusDTO child=readChildProgressStatus(jp);
  if (child == null) {
    return null;
  }
 else {
    return child.getProgressStatus();
  }
}

Fixed version (ground truth):
public static ProgressStatusDTO readProgressStatus(JsonParser jp) throws IOException {
  ChildProgressStatusDTO child=readChildProgressStatus(jp);
  return child.getProgressStatus();
}
Program: 29253
Project: 29253
Buggy source:
private void processField(GfSseInboundEvent inboundEvent,String name,byte[] value){
  if (name.equals("String_Node_Str")) {
    inboundEvent.setName(new String(value));
  }
 else   if (name.equals("String_Node_Str")) {
    inboundEvent.addData(value);
    inboundEvent.addData(new byte[]{'\n'});
  }
 else   if (name.equals("String_Node_Str")) {
    String s=new String(value);
    try {
      Integer.parseInt(new String(value));
    }
 catch (    NumberFormatException nfe) {
      s="String_Node_Str";
    }
    inboundEvent.setId(s);
  }
 else   if (name.equals("String_Node_Str")) {
  }
 else {
  }
}

Fixed version (ground truth):
private void processField(GfSseInboundEvent inboundEvent,String name,byte[] value){
  if (name.equals("String_Node_Str")) {
    inboundEvent.setName(new String(value));
  }
 else   if (name.equals("String_Node_Str")) {
    inboundEvent.addData(value);
    inboundEvent.addData(new byte[]{'\n'});
  }
 else   if (name.equals("String_Node_Str")) {
    String s=new String(value);
    if (s == null) {
      s="String_Node_Str";
    }
 else {
      s=s.trim();
      if (!s.matches("String_Node_Str")) {
        s="String_Node_Str";
      }
    }
    inboundEvent.setId(s);
  }
 else   if (name.equals("String_Node_Str")) {
  }
 else {
  }
}
Program: 29255
Project: 29255
Buggy source:
@Override public void onAdminCommandEvent(String name,Object event){
  if (name == null || name.startsWith("String_Node_Str")) {
    return;
  }
  if (event == null) {
    return;
  }
  OutboundEvent outEvent=new OutboundEvent.Builder().name(name).mediaType(MediaType.APPLICATION_JSON_TYPE).data(event.getClass(),event).build();
  try {
    ec.write(outEvent);
  }
 catch (  IOException ex) {
    logger.log(Level.WARNING,strings.getLocalString("String_Node_Str","String_Node_Str",event.getClass().getName()),ex);
  }
}

Fixed version (ground truth):
@Override public void onAdminCommandEvent(String name,Object event){
  if (name == null || name.startsWith("String_Node_Str")) {
    return;
  }
  if (event == null) {
    return;
  }
  if (ec.isClosed()) {
    return;
  }
  OutboundEvent outEvent=new OutboundEvent.Builder().name(name).mediaType(MediaType.APPLICATION_JSON_TYPE).data(event.getClass(),event).build();
  try {
    ec.write(outEvent);
  }
 catch (  Exception ex) {
    if (logger.isLoggable(Level.FINE)) {
      logger.log(Level.FINE,strings.getLocalString("String_Node_Str","String_Node_Str",event.getClass().getName()),ex);
    }
  }
}
Program: 29260
Project: 29260
Buggy source:
/** 
 * This method opens the server.log file and moves the stream to the specified filePosition.
 */
protected BufferedReader getLogFileReader(long fromFilePosition){
  try {
    FileInputStream file=new FileInputStream(getLogFileName());
    file.skip(fromFilePosition);
    BufferedReader reader=new BufferedReader(new InputStreamReader(file));
    return reader;
  }
 catch (  Exception ex) {
    Logger.getAnonymousLogger().log(Level.INFO,"String_Node_Str",ex);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This method opens the server.log file and moves the stream to the specified filePosition.
 */
protected BufferedReader getLogFileReader(long fromFilePosition){
  FileInputStream file=null;
  try {
    file=new FileInputStream(getLogFileName());
    file.skip(fromFilePosition);
    BufferedReader reader=new BufferedReader(new InputStreamReader(file));
    return reader;
  }
 catch (  Exception ex) {
    if (file != null)     try {
      file.close();
    }
 catch (    Exception ex2) {
    }
    Logger.getAnonymousLogger().log(Level.INFO,"String_Node_Str",ex);
  }
  return null;
}
Program: 29262
Project: 29262
Buggy source:
/** 
 * Rename the existing log file to something else. Then open the old log file name up once again. Intended to be called by a JMX agent.
 * @param newFileName The file name to move the log file entry to
 * @return true if a file was rotated with no error
 */
public synchronized boolean rotate(String newFileName){
  if (currentLogFile != null) {
    File holder=currentLogFile;
    close();
    try {
      holder.renameTo(new File(newFileName));
    }
 catch (    Throwable e) {
      log.log(Level.SEVERE,"String_Node_Str",e);
    }
    currentDate=new Date();
    fileDateFormatter=new ThreadLocal<SimpleDateFormat>(){
      @Override protected SimpleDateFormat initialValue(){
        return new SimpleDateFormat("String_Node_Str");
      }
    }
;
    dateStamp=dateFormatter.get().format(currentDate);
    open();
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Rename the existing log file to something else. Then open the old log file name up once again. Intended to be called by a JMX agent.
 * @param newFileName The file name to move the log file entry to
 * @return true if a file was rotated with no error
 */
public synchronized boolean rotate(String newFileName){
  if (currentLogFile != null) {
    File holder=currentLogFile;
    close();
    try {
      if (!holder.renameTo(new File(newFileName))) {
        log.log(Level.SEVERE,sm.getString("String_Node_Str",newFileName));
      }
    }
 catch (    Throwable e) {
      log.log(Level.SEVERE,sm.getString("String_Node_Str",newFileName),e);
    }
    currentDate=new Date();
    fileDateFormatter=new ThreadLocal<SimpleDateFormat>(){
      @Override protected SimpleDateFormat initialValue(){
        return new SimpleDateFormat("String_Node_Str");
      }
    }
;
    dateStamp=dateFormatter.get().format(currentDate);
    open();
    return true;
  }
 else {
    return false;
  }
}
Program: 29263
Project: 29263
Buggy source:
/** 
 * Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties. Do not create the JAAS default realm since all children will have their own.
 */
@Override public Engine createEngine(){
  StandardEngine engine=new StandardEngine();
  engine.setDebug(debug);
  engine.setLogger(logger);
  engine.setRealm(null);
  return (engine);
}

Fixed version (ground truth):
/** 
 * Create, configure, and return an Engine that will process all HTTP requests received from one of the associated Connectors, based on the specified properties. Do not create the JAAS default realm since all children will have their own.
 */
@Override public Engine createEngine(){
  StandardEngine engine=new StandardEngine();
  engine.setDebug(debug);
  engine.setLogger(super.getLogger());
  engine.setRealm(null);
  return (engine);
}
Program: 29264
Project: 29264
Buggy source:
/** 
 * Create a customized version of the Tomcat's 5 Coyote Connector. This connector is required in order to support PE Web Programmatic login functionality.
 * @param address InetAddress to bind to, or <code>null</code> if theconnector is supposed to bind to all addresses on this server
 * @param port Port number to listen to
 * @param protocol the http protocol to use.
 */
@Override public Connector createConnector(String address,int port,String protocol){
  if (address != null) {
    int index=address.indexOf('/');
    if (index != -1) {
      address=address.substring(index + 1);
    }
  }
  _logger.log(Level.FINE,"String_Node_Str" + ((address == null) ? "String_Node_Str" : address) + "String_Node_Str"+ port+ "String_Node_Str"+ protocol+ "String_Node_Str");
  WebConnector connector=new WebConnector(webContainer);
  if (address != null) {
    connector.setAddress(address);
  }
  connector.setPort(port);
  if (protocol.equals("String_Node_Str")) {
    connector.setProtocolHandlerClassName("String_Node_Str");
  }
 else   if (protocol.equals("String_Node_Str")) {
    connector.setProtocolHandlerClassName("String_Node_Str");
  }
 else   if (protocol.equals("String_Node_Str")) {
    connector.setScheme("String_Node_Str");
    connector.setSecure(true);
  }
  return (connector);
}

Fixed version (ground truth):
/** 
 * Create a customized version of the Tomcat's 5 Coyote Connector. This connector is required in order to support PE Web Programmatic login functionality.
 * @param address InetAddress to bind to, or <code>null</code> if theconnector is supposed to bind to all addresses on this server
 * @param port Port number to listen to
 * @param protocol the http protocol to use.
 */
@Override public Connector createConnector(String address,int port,String protocol){
  if (address != null) {
    int index=address.indexOf('/');
    if (index != -1) {
      address=address.substring(index + 1);
    }
  }
  if (logger.isLoggable(Level.FINE)) {
    logger.log(Level.FINE,CREATE_CONNECTOR,new Object[]{(address == null) ? "String_Node_Str" : address,port,protocol});
  }
  WebConnector connector=new WebConnector(webContainer);
  if (address != null) {
    connector.setAddress(address);
  }
  connector.setPort(port);
  if (protocol.equals("String_Node_Str")) {
    connector.setProtocolHandlerClassName("String_Node_Str");
  }
 else   if (protocol.equals("String_Node_Str")) {
    connector.setProtocolHandlerClassName("String_Node_Str");
  }
 else   if (protocol.equals("String_Node_Str")) {
    connector.setScheme("String_Node_Str");
    connector.setSecure(true);
  }
  return (connector);
}
Program: 29265
Project: 29265
Buggy source:
/** 
 * Util method to load classes that might get compiled after this class is compiled.
 */
private ContainerListener loadListener(String className){
  try {
    Class clazz=Class.forName(className);
    return (ContainerListener)clazz.newInstance();
  }
 catch (  Throwable ex) {
    String msg=rb.getString("String_Node_Str");
    msg=MessageFormat.format(msg,className);
    _logger.log(Level.SEVERE,msg,ex);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Util method to load classes that might get compiled after this class is compiled.
 */
private ContainerListener loadListener(String className){
  try {
    Class clazz=Class.forName(className);
    return (ContainerListener)clazz.newInstance();
  }
 catch (  Throwable ex) {
    String msg=logger.getResourceBundle().getString(UNABLE_TO_INSTANTIATE_CONTAINER_LISTENER);
    msg=MessageFormat.format(msg,className);
    logger.log(Level.SEVERE,msg,ex);
  }
  return null;
}
Program: 29266
Project: 29266
Buggy source:
public boolean enableModifAccessToInstances(){
  return false;
}

Fixed version (ground truth):
@Override public boolean enableModifAccessToInstances(){
  return false;
}
Program: 29267
Project: 29267
Buggy source:
protected Map<String,Boolean> getFeatures(){
  return new HashMap<String,Boolean>(){
{
    }
  }
;
}

Fixed version (ground truth):
protected Map<String,Boolean> getFeatures(){
  if (features == null) {
    features=new HashMap<String,Boolean>();
  }
  return features;
}
Program: 29268
Project: 29268
Buggy source:
protected Map<String,MediaType> getMimeMappings(){
  return new HashMap<String,MediaType>(){
{
      put("String_Node_Str",MediaType.APPLICATION_XML_TYPE);
      put("String_Node_Str",MediaType.APPLICATION_JSON_TYPE);
      put("String_Node_Str",MediaType.TEXT_HTML_TYPE);
      put("String_Node_Str",new MediaType("String_Node_Str","String_Node_Str"));
    }
  }
;
}

Fixed version (ground truth):
protected Map<String,MediaType> getMimeMappings(){
  if (mappings == null) {
    mappings=new HashMap<String,MediaType>();
    mappings.put("String_Node_Str",MediaType.APPLICATION_XML_TYPE);
    mappings.put("String_Node_Str",MediaType.APPLICATION_JSON_TYPE);
    mappings.put("String_Node_Str",MediaType.TEXT_HTML_TYPE);
    mappings.put("String_Node_Str",new MediaType("String_Node_Str","String_Node_Str"));
  }
  return mappings;
}
Program: 29270
Project: 29270
Buggy source:
@Override public Map<String,MediaType> getMimeMappings(){
  return new HashMap<String,MediaType>(){
{
      put("String_Node_Str",MediaType.APPLICATION_JSON_TYPE);
      put("String_Node_Str",MediaType.TEXT_PLAIN_TYPE);
      put("String_Node_Str",new MediaType("String_Node_Str",null));
      put("String_Node_Str",new MediaType("String_Node_Str","String_Node_Str"));
    }
  }
;
}

Fixed version (ground truth):
@Override public Map<String,MediaType> getMimeMappings(){
  if (mappings == null) {
    mappings=new HashMap<String,MediaType>();
    mappings.put("String_Node_Str",MediaType.APPLICATION_JSON_TYPE);
    mappings.put("String_Node_Str",MediaType.TEXT_PLAIN_TYPE);
    mappings.put("String_Node_Str",new MediaType("String_Node_Str",null));
    mappings.put("String_Node_Str",new MediaType("String_Node_Str","String_Node_Str"));
  }
  ;
  return mappings;
}
Program: 29271
Project: 29271
Buggy source:
@Override public boolean process(Set<? extends TypeElement> elements,RoundEnvironment env){
  Messager messager=processingEnv.getMessager();
  try {
    Map<String,List<String>> classes=new HashMap<String,List<String>>();
    for (    TypeElement te : elements) {
      for (      Element e : env.getElementsAnnotatedWith(te)) {
        final RestModelExtension annotation=e.getAnnotation(RestModelExtension.class);
        final String parent=annotation.parent();
        List<String> list=classes.get(parent);
        if (list == null) {
          list=new ArrayList<String>();
          classes.put(parent,list);
        }
        list.add(e.toString());
      }
    }
    if (!classes.isEmpty()) {
      final Filer filer=processingEnv.getFiler();
      FileObject fo=filer.createResource(StandardLocation.CLASS_OUTPUT,"String_Node_Str","String_Node_Str");
      BufferedWriter bw=new BufferedWriter(fo.openWriter());
      for (      Map.Entry<String,List<String>> entry : classes.entrySet()) {
        final String key=entry.getKey();
        for (        String ext : entry.getValue()) {
          bw.write(key + "String_Node_Str" + ext+ "String_Node_Str");
        }
      }
      bw.close();
    }
  }
 catch (  IOException ex) {
    messager.printMessage(Kind.ERROR,ex.getLocalizedMessage());
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean process(Set<? extends TypeElement> elements,RoundEnvironment env){
  Messager messager=processingEnv.getMessager();
  BufferedWriter bw=null;
  try {
    Map<String,List<String>> classes=new HashMap<String,List<String>>();
    for (    TypeElement te : elements) {
      for (      Element e : env.getElementsAnnotatedWith(te)) {
        final RestModelExtension annotation=e.getAnnotation(RestModelExtension.class);
        final String parent=annotation.parent();
        List<String> list=classes.get(parent);
        if (list == null) {
          list=new ArrayList<String>();
          classes.put(parent,list);
        }
        list.add(e.toString());
      }
    }
    if (!classes.isEmpty()) {
      final Filer filer=processingEnv.getFiler();
      FileObject fo=filer.createResource(StandardLocation.CLASS_OUTPUT,"String_Node_Str","String_Node_Str");
      bw=new BufferedWriter(fo.openWriter());
      for (      Map.Entry<String,List<String>> entry : classes.entrySet()) {
        final String key=entry.getKey();
        for (        String ext : entry.getValue()) {
          bw.write(key + "String_Node_Str" + ext+ "String_Node_Str");
        }
      }
      bw.close();
    }
  }
 catch (  IOException ex) {
    messager.printMessage(Kind.ERROR,ex.getLocalizedMessage());
    if (bw != null) {
      try {
        bw.close();
      }
 catch (      Exception e) {
      }
    }
  }
  return true;
}
Program: 29272
Project: 29272
Buggy source:
@Override public List<RestModel> readFrom(Class<List<RestModel>> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,String> httpHeaders,InputStream entityStream) throws IOException, WebApplicationException {
  try {
    List<RestModel> list=new ArrayList<RestModel>();
    BufferedReader in=new BufferedReader(new InputStreamReader(entityStream));
    StringBuilder sb=new StringBuilder();
    String line=in.readLine();
    while (line != null) {
      sb.append(line);
      line=in.readLine();
    }
    JSONArray array=new JSONArray(sb.toString());
    Class<?> modelType=null;
    if (ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
      final ParameterizedType pt=(ParameterizedType)genericType;
      modelType=(Class)pt.getActualTypeArguments()[0];
    }
    for (int i=0; i < array.length(); i++) {
      JSONObject o=array.getJSONObject(i);
      RestModel model=(RestModel)CompositeUtil.instance().unmarshallClass(modelType,o);
      Set<ConstraintViolation<RestModel>> cv=CompositeUtil.instance().validateRestModel(model);
      if (!cv.isEmpty()) {
        final Response response=Response.status(Status.BAD_REQUEST).entity(CompositeUtil.instance().getValidationFailureMessages(cv,model)).build();
        throw new WebApplicationException(response);
      }
      list.add(model);
    }
    return list;
  }
 catch (  Exception e) {
    throw new WebApplicationException(e);
  }
}

Fixed version (ground truth):
@Override public List<RestModel> readFrom(Class<List<RestModel>> type,Type genericType,Annotation[] annotations,MediaType mediaType,MultivaluedMap<String,String> httpHeaders,InputStream entityStream) throws IOException, WebApplicationException {
  try {
    List<RestModel> list=new ArrayList<RestModel>();
    BufferedReader in=new BufferedReader(new InputStreamReader(entityStream));
    StringBuilder sb=new StringBuilder();
    String line=in.readLine();
    while (line != null) {
      sb.append(line);
      line=in.readLine();
    }
    JSONArray array=new JSONArray(sb.toString());
    Class<?> modelType=null;
    if (genericType instanceof ParameterizedType) {
      final ParameterizedType pt=(ParameterizedType)genericType;
      modelType=(Class)pt.getActualTypeArguments()[0];
    }
    for (int i=0; i < array.length(); i++) {
      JSONObject o=array.getJSONObject(i);
      RestModel model=(RestModel)CompositeUtil.instance().unmarshallClass(modelType,o);
      Set<ConstraintViolation<RestModel>> cv=CompositeUtil.instance().validateRestModel(model);
      if (!cv.isEmpty()) {
        final Response response=Response.status(Status.BAD_REQUEST).entity(CompositeUtil.instance().getValidationFailureMessages(cv,model)).build();
        throw new WebApplicationException(response);
      }
      list.add(model);
    }
    return list;
  }
 catch (  Exception e) {
    throw new WebApplicationException(e);
  }
}
Program: 29273
Project: 29273
Buggy source:
/** 
 * This method takes a Type argument that represents a generic class (e.g., <code>List&lt;String&gt;) and returns the <code>Class</code> for the first generic type.  If the <code>Class</code> is not a generic type, <code>null</code> is returned. The primary intended usage for this is in the <code>MessageBodyReader</code>s to help return a more accurate result from <code>isReadable</code>, though it may also be helpful in other, more general situations.
 * @param genericType
 * @return
 */
public static Class<?> getFirstGenericType(Type genericType){
  if (ParameterizedType.class.isAssignableFrom(genericType.getClass())) {
    ParameterizedType pt=(ParameterizedType)genericType;
    Type[] typeArgs=pt.getActualTypeArguments();
    if ((typeArgs != null) && (typeArgs.length >= 1)) {
      final Type type=typeArgs[0];
      if (ParameterizedType.class.isAssignableFrom(type.getClass())) {
        return (Class<?>)((ParameterizedType)type).getRawType();
      }
 else {
        return (Class<?>)type;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This method takes a Type argument that represents a generic class (e.g., <code>List&lt;String&gt;) and returns the <code>Class</code> for the first generic type.  If the <code>Class</code> is not a generic type, <code>null</code> is returned. The primary intended usage for this is in the <code>MessageBodyReader</code>s to help return a more accurate result from <code>isReadable</code>, though it may also be helpful in other, more general situations.
 * @param genericType
 * @return
 */
public static Class<?> getFirstGenericType(Type genericType){
  if (genericType instanceof ParameterizedType) {
    ParameterizedType pt=(ParameterizedType)genericType;
    Type[] typeArgs=pt.getActualTypeArguments();
    if ((typeArgs != null) && (typeArgs.length >= 1)) {
      final Type type=typeArgs[0];
      if (ParameterizedType.class.isAssignableFrom(type.getClass())) {
        return (Class<?>)((ParameterizedType)type).getRawType();
      }
 else {
        return (Class<?>)type;
      }
    }
  }
  return null;
}
Program: 29276
Project: 29276
Buggy source:
/** 
 * Closes the input stream.
 * @param pCloseUnderlying Whether to close the underlying stream(hard close)
 * @throws IOException An I/O error occurred.
 */
public void close(boolean pCloseUnderlying) throws IOException {
  if (closed) {
    return;
  }
  if (pCloseUnderlying) {
    closed=true;
    input.close();
  }
 else {
    for (; ; ) {
      int av=available();
      if (av == 0) {
        av=makeAvailable();
        if (av == 0) {
          break;
        }
      }
      skip(av);
    }
  }
  closed=true;
}

Fixed version (ground truth):
/** 
 * Closes the input stream.
 * @param pCloseUnderlying Whether to close the underlying stream(hard close)
 * @throws IOException An I/O error occurred.
 */
public void close(boolean pCloseUnderlying) throws IOException {
  if (closed) {
    return;
  }
  if (pCloseUnderlying) {
    closed=true;
    input.close();
  }
 else {
    for (; ; ) {
      int av=available();
      if (av == 0) {
        av=makeAvailable();
        if (av == 0) {
          break;
        }
      }
      if (skip(av) != av && log.isLoggable(Level.WARNING)) {
        log.warning(sm.getString("String_Node_Str",av));
      }
    }
  }
  closed=true;
}
Program: 29277
Project: 29277
Buggy source:
/** 
 * Returns the contents of the file as an array of bytes.  If the contents of the file were not yet cached in memory, they will be loaded from the disk storage and cached.
 * @return The contents of the file as an array of bytes.
 */
public byte[] get(){
  if (isInMemory()) {
    if (cachedContent == null) {
      cachedContent=dfos.getData();
    }
    return cachedContent;
  }
  byte[] fileData=new byte[(int)getSize()];
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(dfos.getFile());
    fis.read(fileData);
  }
 catch (  IOException e) {
    fileData=null;
  }
 finally {
    if (fis != null) {
      try {
        fis.close();
      }
 catch (      IOException e) {
      }
    }
  }
  return fileData;
}

Fixed version (ground truth):
/** 
 * Returns the contents of the file as an array of bytes.  If the contents of the file were not yet cached in memory, they will be loaded from the disk storage and cached.
 * @return The contents of the file as an array of bytes.
 */
public byte[] get(){
  if (isInMemory()) {
    if (cachedContent == null) {
      cachedContent=dfos.getData();
    }
    return cachedContent;
  }
  byte[] fileData=new byte[(int)getSize()];
  FileInputStream fis=null;
  try {
    fis=new FileInputStream(dfos.getFile());
    if (fis.read(fileData) != (int)getSize())     if (log.isLoggable(Level.INFO))     log.log(Level.INFO,sm.getString("String_Node_Str"));
  }
 catch (  IOException e) {
    fileData=null;
  }
 finally {
    if (fis != null) {
      try {
        fis.close();
      }
 catch (      IOException e) {
      }
    }
  }
  return fileData;
}
Program: 29278
Project: 29278
Buggy source:
/** 
 * Return the xsl template inputstream (if possible)
 */
protected InputStream findXsltInputStream(DirContext directory) throws IOException, ServletException {
  if (localXsltFile != null) {
    try {
      Object obj=directory.lookup(localXsltFile);
      if (obj != null && obj instanceof Resource) {
        InputStream is=((Resource)obj).streamContent();
        if (is != null)         return is;
      }
    }
 catch (    Throwable e) {
      ;
      if (debug > 10)       log("String_Node_Str" + localXsltFile + "String_Node_Str",e);
      return null;
    }
  }
  if (globalXsltFile != null) {
    FileInputStream fis=null;
    try {
      File f=new File(globalXsltFile);
      if (f.exists()) {
        fis=new FileInputStream(f);
        byte b[]=new byte[(int)f.length()];
        fis.read(b);
        return new ByteArrayInputStream(b);
      }
    }
  finally {
      if (fis != null)       fis.close();
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return the xsl template inputstream (if possible)
 */
protected InputStream findXsltInputStream(DirContext directory) throws IOException, ServletException {
  if (localXsltFile != null) {
    try {
      Object obj=directory.lookup(localXsltFile);
      if (obj != null && obj instanceof Resource) {
        InputStream is=((Resource)obj).streamContent();
        if (is != null)         return is;
      }
    }
 catch (    Throwable e) {
      ;
      if (debug > 10)       log("String_Node_Str" + localXsltFile + "String_Node_Str",e);
      return null;
    }
  }
  if (globalXsltFile != null) {
    FileInputStream fis=null;
    try {
      File f=new File(globalXsltFile);
      if (f.exists()) {
        fis=new FileInputStream(f);
        byte b[]=new byte[(int)f.length()];
        if ((fis.read(b) < 0) && (debug > 0))         log("String_Node_Str" + globalXsltFile + "String_Node_Str");
        return new ByteArrayInputStream(b);
      }
    }
  finally {
      if (fis != null)       fis.close();
    }
  }
  return null;
}
Program: 29279
Project: 29279
Buggy source:
/** 
 * Lock the DAS from accepting any commands annotated with a SHARED or EXCLUSIVE CommandLock.  This method will result in the acquisition of an EXCLUSIVE lock.  This method will not return until the lock is acquired, it times out or an error occurs. 
 * @param timeout         lock timeout in seconds
 * @param lockOwner       the user who acquired the lock
 * @param message         message to return when a command is blocked
 * @return                  status regarding acquisition of the lock
 */
public synchronized SuspendStatus suspendCommands(long timeout,String lockOwner,String message){
  BlockingQueue<AdminCommandLock.SuspendStatus> suspendStatusQ=new ArrayBlockingQueue<AdminCommandLock.SuspendStatus>(1);
  if (suspendCommandsLockThread != null && suspendCommandsLockThread.isAlive()) {
    return SuspendStatus.ILLEGALSTATE;
  }
  suspendCommandsTimedOut=false;
  suspendCommandsLockThread=new SuspendCommandsLockThread(timeout,suspendStatusQ,lockOwner,message);
  try {
    suspendCommandsLockThread.setName("String_Node_Str");
    suspendCommandsLockThread.setDaemon(true);
  }
 catch (  IllegalThreadStateException e) {
    return SuspendStatus.ERROR;
  }
catch (  SecurityException e) {
    return SuspendStatus.ERROR;
  }
  suspendCommandsLockThread.start();
  SuspendStatus suspendStatus=queueTake(suspendStatusQ);
  return suspendStatus;
}

Fixed version (ground truth):
/** 
 * Lock the DAS from accepting any commands annotated with a SHARED or EXCLUSIVE CommandLock.  This method will result in the acquisition of an EXCLUSIVE lock.  This method will not return until the lock is acquired, it times out or an error occurs. 
 * @param timeout         lock timeout in seconds
 * @param lockOwner       the user who acquired the lock
 * @param message         message to return when a command is blocked
 * @return                  status regarding acquisition of the lock
 */
public synchronized SuspendStatus suspendCommands(long timeout,String lockOwner,String message){
  BlockingQueue<AdminCommandLock.SuspendStatus> suspendStatusQ=new ArrayBlockingQueue<AdminCommandLock.SuspendStatus>(1);
  if (suspendCommandsLockThread != null && suspendCommandsLockThread.isAlive()) {
    return SuspendStatus.ILLEGALSTATE;
  }
  suspendCommandsLockThread=new SuspendCommandsLockThread(timeout,suspendStatusQ,lockOwner,message);
  try {
    suspendCommandsLockThread.setName("String_Node_Str");
    suspendCommandsLockThread.setDaemon(true);
  }
 catch (  IllegalThreadStateException e) {
    return SuspendStatus.ERROR;
  }
catch (  SecurityException e) {
    return SuspendStatus.ERROR;
  }
  suspendCommandsLockThread.start();
  SuspendStatus suspendStatus=queueTake(suspendStatusQ);
  return suspendStatus;
}
Program: 29280
Project: 29280
Buggy source:
public void setCommandRun(String fullcommand){
  FullCommand=fullcommand;
}

Fixed version (ground truth):
public void setCommandRun(String fullcommand){
  fullCommand=fullcommand;
}
Program: 29281
Project: 29281
Buggy source:
public String getCommandRun(){
  return FullCommand;
}

Fixed version (ground truth):
public String getCommandRun(){
  return fullCommand;
}
Program: 29282
Project: 29282
Buggy source:
@Override public int getTotalStepCount(){
  return totalStepCount;
}

Fixed version (ground truth):
@Override public synchronized int getTotalStepCount(){
  return totalStepCount;
}
Program: 29283
Project: 29283
Buggy source:
public int getCurrentStepCount(){
  return this.currentStepCount;
}

Fixed version (ground truth):
public synchronized int getCurrentStepCount(){
  return this.currentStepCount;
}
Program: 29284
Project: 29284
Buggy source:
public ClassLoader getClassLoader(){
  if (classLoader == null) {
    URL[] urls=new URL[1];
    try {
      urls[0]=directory.getAbsoluteFile().toURL();
      classLoader=new URLClassLoader(urls);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return classLoader;
}

Fixed version (ground truth):
public ClassLoader getClassLoader(){
  if (classLoader == null) {
    final URL[] urls=new URL[1];
    try {
      if (directory == null)       throw new IllegalStateException("String_Node_Str");
      urls[0]=directory.getAbsoluteFile().toURL();
      classLoader=new PrivilegedAction<URLClassLoader>(){
        @Override public URLClassLoader run(){
          return new URLClassLoader(urls);
        }
      }
.run();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return classLoader;
}
Program: 29285
Project: 29285
Buggy source:
public ClassLoader getClassLoader(){
  if (classLoader == null) {
    URL[] urls=new URL[1];
    try {
      urls[0]=jarFile.getAbsoluteFile().toURL();
      classLoader=new URLClassLoader(urls);
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return classLoader;
}

Fixed version (ground truth):
public ClassLoader getClassLoader(){
  if (classLoader == null) {
    final URL[] urls=new URL[1];
    try {
      if (jarFile == null)       throw new IllegalStateException("String_Node_Str");
      urls[0]=jarFile.getAbsoluteFile().toURL();
      classLoader=new PrivilegedAction<URLClassLoader>(){
        @Override public URLClassLoader run(){
          return new URLClassLoader(urls);
        }
      }
.run();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
  return classLoader;
}
Program: 29286
Project: 29286
Buggy source:
static SetterData createLockMode(LockModeType lockMode){
  SetterData data=new SetterData();
  data.type=SetterType.LOCK_MODE;
  data.lockMode=lockMode;
  return data;
}

Fixed version (ground truth):
static SetterData createLockMode(LockModeType lockMode){
  SetterData data=new SetterData(SetterType.LOCK_MODE);
  data.lockMode=lockMode;
  return data;
}
Program: 29287
Project: 29287
Buggy source:
static SetterData createFirstResult(int firstResult){
  SetterData data=new SetterData();
  data.type=SetterType.FIRST_RESULT;
  data.int1=firstResult;
  return data;
}

Fixed version (ground truth):
static SetterData createFirstResult(int firstResult){
  SetterData data=new SetterData(SetterType.FIRST_RESULT);
  data.int1=firstResult;
  return data;
}
Program: 29288
Project: 29288
Buggy source:
static SetterData createParameter(int position,Calendar value,TemporalType temporalType){
  SetterData data=new SetterData();
  data.type=SetterType.PARAM_POSITION_CAL_TEMPORAL;
  data.int1=position;
  data.calendar=value;
  data.temporalType=temporalType;
  return data;
}

Fixed version (ground truth):
static SetterData createParameter(int position,Calendar value,TemporalType temporalType){
  SetterData data=new SetterData(SetterType.PARAM_POSITION_CAL_TEMPORAL);
  data.int1=position;
  data.calendar=value;
  data.temporalType=temporalType;
  return data;
}
Program: 29289
Project: 29289
Buggy source:
static SetterData createFlushMode(FlushModeType flushMode){
  SetterData data=new SetterData();
  data.type=SetterType.FLUSH_MODE;
  data.flushMode=flushMode;
  return data;
}

Fixed version (ground truth):
static SetterData createFlushMode(FlushModeType flushMode){
  SetterData data=new SetterData(SetterType.FLUSH_MODE);
  data.flushMode=flushMode;
  return data;
}
Program: 29290
Project: 29290
Buggy source:
static SetterData createHint(String hintName,Object value){
  SetterData data=new SetterData();
  data.type=SetterType.HINT;
  data.string1=hintName;
  data.object1=value;
  return data;
}

Fixed version (ground truth):
static SetterData createHint(String hintName,Object value){
  SetterData data=new SetterData(SetterType.HINT);
  data.string1=hintName;
  data.object1=value;
  return data;
}
Program: 29291
Project: 29291
Buggy source:
static SetterData createMaxResults(int maxResults){
  SetterData data=new SetterData();
  data.type=SetterType.MAX_RESULTS;
  data.int1=maxResults;
  return data;
}

Fixed version (ground truth):
static SetterData createMaxResults(int maxResults){
  SetterData data=new SetterData(SetterType.MAX_RESULTS);
  data.int1=maxResults;
  return data;
}
Program: 29292
Project: 29292
Buggy source:
void reset(){
  newReplica=null;
  hashKey=null;
  oldReplica=null;
}

Fixed version (ground truth):
void reset(){
  newReplica=null;
  oldReplica=null;
}
Program: 29293
Project: 29293
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + newReplica + '\''+ "String_Node_Str"+ hashKey+ "String_Node_Str"+ oldReplica+ '\''+ '}';
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + "String_Node_Str" + newReplica + '\''+ "String_Node_Str"+ oldReplica+ '\''+ '}';
}
Program: 29294
Project: 29294
Buggy source:
@Override public Container createContainer(EjbDescriptor ejbDescriptor,ClassLoader loader,DeploymentContext deployContext) throws Exception {
  EjbSessionDescriptor sd=(EjbSessionDescriptor)ejbDescriptor;
  AbstractSingletonContainer container;
  if (sd.hasContainerManagedConcurrency()) {
    container=new CMCSingletonContainer(ejbDescriptor,loader);
  }
 else {
    container=new BMCSingletonContainer(ejbDescriptor,loader);
  }
  initContainer(container,ejbDescriptor);
  return container;
}

Fixed version (ground truth):
@Override public Container createContainer(EjbDescriptor ejbDescriptor,ClassLoader loader,DeploymentContext deployContext) throws Exception {
}
Program: 29295
Project: 29295
Buggy source:
public Container createContainer(EjbDescriptor ejbDescriptor,ClassLoader loader,DeploymentContext deployContext) throws Exception {
  EntityContainer container=null;
  if (((EjbEntityDescriptor)ejbDescriptor).getIASEjbExtraDescriptors().isIsReadOnlyBean()) {
    container=new ReadOnlyBeanContainer(ejbDescriptor,loader);
  }
 else {
    String commitOption=null;
    IASEjbExtraDescriptors iased=((EjbEntityDescriptor)ejbDescriptor).getIASEjbExtraDescriptors();
    if (iased != null) {
      commitOption=iased.getCommitOption();
    }
    if (commitOption == null) {
      commitOption=ejbContainerDesc.getCommitOption();
    }
    if (commitOption.equals("String_Node_Str")) {
      _logger.log(Level.WARNING,"String_Node_Str",new Object[]{ejbDescriptor.getName()});
      container=new EntityContainer(ejbDescriptor,loader);
    }
 else     if (commitOption.equals("String_Node_Str")) {
      _logger.log(Level.FINE,"String_Node_Str" + ejbDescriptor.getName());
      container=new CommitCEntityContainer(ejbDescriptor,loader);
    }
 else {
      _logger.log(Level.FINE,"String_Node_Str" + ejbDescriptor.getName());
      container=new EntityContainer(ejbDescriptor,loader);
    }
  }
  initContainer(container,ejbDescriptor);
  return container;
}

Fixed version (ground truth):
public Container createContainer(EjbDescriptor ejbDescriptor,ClassLoader loader,DeploymentContext deployContext) throws Exception {
}
Program: 29296
Project: 29296
Buggy source:
public <T>T get(String key) throws InsufficientCredentialException {
  Entry entry=simpleMap.getEntry(key);
  if (entry == null) {
    if (contextAccessController.isAccessAllowed(key,ContextAccessLevel.READ)) {
      return null;
    }
  }
 else {
    if (entry != null && (entry.allowAllToRead || contextAccessController.isAccessAllowed(key,ContextAccessLevel.READ))) {
      return (T)entry.getValue();
    }
  }
  throw new InsufficientCredentialException();
}

Fixed version (ground truth):
public <T>T get(String key) throws InsufficientCredentialException {
  Entry entry=simpleMap.getEntry(key);
  if (entry == null) {
    if (contextAccessController.isAccessAllowed(key,ContextAccessLevel.READ)) {
      return null;
    }
  }
 else {
    if (entry.allowAllToRead || contextAccessController.isAccessAllowed(key,ContextAccessLevel.READ)) {
      return (T)entry.getValue();
    }
  }
  throw new InsufficientCredentialException();
}
Program: 29297
Project: 29297
Buggy source:
public void updateCatalogMetadata(byte[] contents){
  short offset=findOffset(contents);
  short position=positions.get(positions.size() - 2);
  contents[offset++]=(byte)(position >>> 8);
  contents[offset++]=(byte)position;
  short end=positions.get(positions.size() - 1);
  contents[offset++]=(byte)(end >>> 8);
  contents[offset++]=(byte)end;
}

Fixed version (ground truth):
public void updateCatalogMetadata(byte[] contents){
  short offset=findOffset(contents);
  short position=positions.get(positions.size() - 2);
  contents[offset++]=(byte)(position >>> 8);
  contents[offset++]=(byte)position;
  short end=positions.get(positions.size() - 1);
  contents[offset++]=(byte)(end >>> 8);
  contents[offset]=(byte)end;
}