nus-yam/ex-repair huggingface dataset:
Program: 29345
Project: 29345
Buggy source:
public static DeploymentFactoryInstaller getInstaller(){
  if (dfInstaller == null) {
    dfInstaller=new DeploymentFactoryInstaller();
    dfInstaller.initialize();
  }
  return dfInstaller;
}

Fixed version (ground truth):
public static DeploymentFactoryInstaller getInstaller(){
  if (dfInstaller == null) {
    DeploymentFactoryInstaller tmpInstaller=new DeploymentFactoryInstaller();
    tmpInstaller.initialize();
    dfInstaller=tmpInstaller;
  }
  return dfInstaller;
}
Program: 29346
Project: 29346
Buggy source:
/** 
 * Tests whether this factory can create a DeploymentManager object based on the specificed URI.  This does not indicate whether such an attempt will be successful, only whether the factory can handle the uri.
 * @param uri The uri to check
 * @return <tt>true</tt> if the factory can handle the uri.
 */
public boolean handlesURI(String uri){
  if (sLogger.isLoggable(Level.FINE)) {
    sLogger.fine("String_Node_Str" + uri + "String_Node_Str");
  }
  if (uri != null) {
    try {
      return (parseURIForHostInfo(uri) != null);
    }
 catch (    Exception ex) {
      sLogger.log(Level.SEVERE,"String_Node_Str",new Object[]{uri});
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Tests whether this factory can create a DeploymentManager object based on the specificed URI.  This does not indicate whether such an attempt will be successful, only whether the factory can handle the uri.
 * @param uri The uri to check
 * @return <tt>true</tt> if the factory can handle the uri.
 */
public boolean handlesURI(String uri){
  if (sLogger.isLoggable(Level.FINE)) {
    sLogger.fine("String_Node_Str" + uri + "String_Node_Str");
  }
  if (uri != null) {
    try {
      parseURIForHostInfo(uri);
      return true;
    }
 catch (    Exception ex) {
      sLogger.log(Level.SEVERE,"String_Node_Str",new Object[]{uri});
    }
  }
  return false;
}
Program: 29347
Project: 29347
Buggy source:
/** 
 * This method performs an exec and starts the application client running in another process.
 * @throws ClientExecuteException when the configurationis incomplete.
 */
public void execute() throws ClientExecuteException {
  if (targetModuleID == null) {
    throw new ClientExecuteException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  TargetImpl target=(TargetImpl)targetModuleID.getTarget();
  String moduleID;
  if (targetModuleID.getParentTargetModuleID() != null) {
    moduleID=targetModuleID.getParentTargetModuleID().getModuleID();
  }
 else {
    moduleID=targetModuleID.getModuleID();
  }
  try {
    String location=target.exportClientStubs(moduleID,System.getProperty("String_Node_Str"));
    String j2eeHome=System.getProperty("String_Node_Str");
    String appClientBinary=j2eeHome + File.separatorChar + "String_Node_Str"+ File.separatorChar+ "String_Node_Str";
    String command=appClientBinary + "String_Node_Str" + location;
    Process p=Runtime.getRuntime().exec(command);
  }
 catch (  Exception e) {
    Logger.getAnonymousLogger().log(Level.WARNING,"String_Node_Str",e);
    throw new ClientExecuteException(localStrings.getLocalString("String_Node_Str","String_Node_Str",new Object[]{e.getMessage()}));
  }
}

Fixed version (ground truth):
/** 
 * This method performs an exec and starts the application client running in another process.
 * @throws ClientExecuteException when the configurationis incomplete.
 */
public void execute() throws ClientExecuteException {
  if (targetModuleID == null) {
    throw new ClientExecuteException(localStrings.getLocalString("String_Node_Str","String_Node_Str"));
  }
  TargetImpl target=(TargetImpl)targetModuleID.getTarget();
  String moduleID;
  if (targetModuleID.getParentTargetModuleID() != null) {
    moduleID=targetModuleID.getParentTargetModuleID().getModuleID();
  }
 else {
    moduleID=targetModuleID.getModuleID();
  }
  try {
    String location=target.exportClientStubs(moduleID,System.getProperty("String_Node_Str"));
    String j2eeHome=System.getProperty("String_Node_Str");
    String appClientBinary=j2eeHome + File.separatorChar + "String_Node_Str"+ File.separatorChar+ "String_Node_Str";
    String command=appClientBinary + "String_Node_Str" + location;
    Runtime.getRuntime().exec(command);
  }
 catch (  Exception e) {
    Logger.getAnonymousLogger().log(Level.WARNING,"String_Node_Str",e);
    throw new ClientExecuteException(localStrings.getLocalString("String_Node_Str","String_Node_Str",new Object[]{e.getMessage()}));
  }
}
Program: 29348
Project: 29348
Buggy source:
private File writeMemoryMappedArchiveToTempFile(MemoryMappedArchive mma,String fileSuffix) throws IOException {
  File tempFile=File.createTempFile("String_Node_Str",fileSuffix);
  BufferedOutputStream bos=null;
  BufferedInputStream bis=null;
  int chunkSize=32 * 1024;
  long remaining=mma.getArchiveSize();
  try {
    bos=new BufferedOutputStream(new FileOutputStream(tempFile));
    bis=new BufferedInputStream(new ByteArrayInputStream(mma.getByteArray()));
    while (remaining != 0) {
      int actual=(remaining < chunkSize) ? (int)remaining : chunkSize;
      byte[] bytes=new byte[actual];
      try {
        bis.read(bytes);
        bos.write(bytes);
      }
 catch (      EOFException eof) {
        break;
      }
      remaining-=actual;
    }
  }
  finally {
    if (bos != null) {
      bos.flush();
      bos.close();
    }
    if (bis != null) {
      bis.close();
    }
  }
  return tempFile;
}

Fixed version (ground truth):
private File writeMemoryMappedArchiveToTempFile(MemoryMappedArchive mma,String fileSuffix) throws IOException {
  File tempFile=File.createTempFile("String_Node_Str",fileSuffix);
  BufferedOutputStream bos=null;
  BufferedInputStream bis=null;
  int chunkSize=32 * 1024;
  long remaining=mma.getArchiveSize();
  try {
    bos=new BufferedOutputStream(new FileOutputStream(tempFile));
    bis=new BufferedInputStream(new ByteArrayInputStream(mma.getByteArray()));
    while (remaining != 0) {
      int actual=(remaining < chunkSize) ? (int)remaining : chunkSize;
      byte[] bytes=new byte[actual];
      try {
        for (int totalCount=0, count=0; count != -1 && totalCount < actual; totalCount+=(count=bis.read(bytes,totalCount,actual - totalCount)))         ;
        bos.write(bytes);
      }
 catch (      EOFException eof) {
        break;
      }
      remaining-=actual;
    }
  }
  finally {
    if (bos != null) {
      try {
        bos.flush();
      }
  finally {
        bos.close();
      }
    }
    if (bis != null) {
      bis.close();
    }
  }
  return tempFile;
}
Program: 29352
Project: 29352
Buggy source:
private void processGeneratedContent(final File generatedContentParam,final ExtendedDeploymentContext deploymentContext,final Logger logger) throws IOException {
  if (generatedContentParam == null) {
    return;
  }
  final File baseDir=deploymentContext.getScratchDir("String_Node_Str").getParentFile().getParentFile();
  if (!baseDir.exists() && !baseDir.mkdirs()) {
    throw new IOException(localStrings.getLocalString("String_Node_Str","String_Node_Str",baseDir.getAbsolutePath()));
  }
  final URI baseURI=baseDir.toURI();
  final ZipFile zipFile=new ZipFile(generatedContentParam);
  for (Enumeration<? extends ZipEntry> entries=zipFile.entries(); entries.hasMoreElements(); ) {
    final ZipEntry zipEntry=entries.nextElement();
    final URI outputFileURI=Util.resolve(baseURI,zipEntry.getName());
    final File outputFile=new File(outputFileURI);
    if (zipEntry.isDirectory()) {
      if (!outputFile.exists() && !outputFile.mkdirs()) {
        throw new IOException(localStrings.getLocalString("String_Node_Str","String_Node_Str",baseDir.getAbsolutePath()));
      }
    }
 else {
      final FileOutputStream os=new FileOutputStream(outputFile);
      try {
        FileUtils.copy(zipFile.getInputStream(zipEntry),os,zipEntry.getSize());
      }
 catch (      IOException e) {
        os.close();
      }
    }
  }
}

Fixed version (ground truth):
private void processGeneratedContent(final File generatedContentParam,final ExtendedDeploymentContext deploymentContext,final Logger logger) throws IOException {
  if (generatedContentParam == null) {
    return;
  }
  final File baseDir=deploymentContext.getScratchDir("String_Node_Str").getParentFile().getParentFile();
  if (!baseDir.exists() && !baseDir.mkdirs()) {
    throw new IOException(localStrings.getLocalString("String_Node_Str","String_Node_Str",baseDir.getAbsolutePath()));
  }
  final URI baseURI=baseDir.toURI();
  final ZipFile zipFile=new ZipFile(generatedContentParam);
  for (Enumeration<? extends ZipEntry> entries=zipFile.entries(); entries.hasMoreElements(); ) {
    final ZipEntry zipEntry=entries.nextElement();
    final URI outputFileURI=Util.resolve(baseURI,zipEntry.getName());
    final File outputFile=new File(outputFileURI);
    if (zipEntry.isDirectory()) {
      if (!outputFile.exists() && !outputFile.mkdirs()) {
        throw new IOException(localStrings.getLocalString("String_Node_Str","String_Node_Str",baseDir.getAbsolutePath()));
      }
    }
 else {
      final FileOutputStream os=new FileOutputStream(outputFile);
      try {
        FileUtils.copy(zipFile.getInputStream(zipEntry),os,zipEntry.getSize());
      }
 catch (      IOException e) {
        os.close();
      }
    }
  }
  zipFile.close();
}
Program: 29353
Project: 29353
Buggy source:
private void expandCustomizationJar(File tenantDir) throws IOException {
  tenantDir.mkdirs();
  if (customizations == null) {
    return;
  }
  ReadableArchive cusArchive=null;
  WritableArchive expandedArchive=null;
  try {
    expandedArchive=archiveFactory.createArchive(tenantDir);
    cusArchive=archiveFactory.openArchive(customizations);
    DeploymentUtils.expand(cusArchive,expandedArchive);
  }
  finally {
    try {
      if (cusArchive != null) {
        cusArchive.close();
      }
      if (expandedArchive != null) {
        expandedArchive.close();
      }
    }
 catch (    IOException e) {
    }
  }
}

Fixed version (ground truth):
private void expandCustomizationJar(File tenantDir) throws IOException {
  if (!tenantDir.exists() && !tenantDir.mkdirs()) {
  }
  if (customizations == null) {
    return;
  }
  ReadableArchive cusArchive=null;
  WritableArchive expandedArchive=null;
  try {
    expandedArchive=archiveFactory.createArchive(tenantDir);
    cusArchive=archiveFactory.openArchive(customizations);
    DeploymentUtils.expand(cusArchive,expandedArchive);
  }
  finally {
    try {
      if (cusArchive != null) {
        cusArchive.close();
      }
      if (expandedArchive != null) {
        expandedArchive.close();
      }
    }
 catch (    IOException e) {
    }
  }
}
Program: 29354
Project: 29354
Buggy source:
@Override public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  final Logger logger=context.getLogger();
  try {
    logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName());
    final ExtendedDeploymentContext dc=suppInfo.deploymentContext();
    final InterceptorNotifier notifier=new InterceptorNotifier(habitat,dc);
    try {
      notifier.ensureAfterReported(ExtendedDeploymentContext.Phase.REPLICATION);
      logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName() + "String_Node_Str");
    }
 catch (    Exception e) {
      report.failure(logger,e.getMessage());
      logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
    }
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
  }
}

Fixed version (ground truth):
@Override public void execute(AdminCommandContext context){
  ActionReport report=context.getActionReport();
  final Logger logger=context.getLogger();
  try {
    logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName());
    final ExtendedDeploymentContext dc;
    if (suppInfo == null) {
      throw new IllegalStateException("String_Node_Str");
    }
 else {
      dc=suppInfo.deploymentContext();
    }
    final InterceptorNotifier notifier=new InterceptorNotifier(habitat,dc);
    try {
      notifier.ensureAfterReported(ExtendedDeploymentContext.Phase.REPLICATION);
      logger.log(Level.INFO,"String_Node_Str" + this.getClass().getName() + "String_Node_Str");
    }
 catch (    Exception e) {
      report.failure(logger,e.getMessage());
      logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
    }
  }
 catch (  Exception e) {
    logger.log(Level.SEVERE,"String_Node_Str" + this.getClass().getName(),e);
  }
}
Program: 29355
Project: 29355
Buggy source:
public void execute(AdminCommandContext context){
  ActionReport.MessagePart part=report.getTopMessagePart();
  Iterator it=matchedVersions.iterator();
  while (it.hasNext()) {
    String appName=(String)it.next();
    String status="String_Node_Str";
    if (!DeploymentUtils.isDomainTarget(target)) {
      ApplicationRef ref=domain.getApplicationRefInTarget(appName,target);
      if (ref == null) {
        report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",appName,target));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
      }
    }
    if (domain.isAppEnabledInTarget(appName,target)) {
      status="String_Node_Str";
    }
    ActionReport.MessagePart childPart=part.addChild();
    String message=localStrings.getLocalString("String_Node_Str","String_Node_Str",appName,status);
    childPart.setMessage(message);
    childPart.addProperty(DeploymentProperties.STATE,status);
  }
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}

Fixed version (ground truth):
public void execute(AdminCommandContext context){
  ActionReport.MessagePart part;
  if (report == null) {
    throw new IllegalStateException("String_Node_Str");
  }
 else {
    part=report.getTopMessagePart();
  }
  Iterator it=matchedVersions.iterator();
  while (it.hasNext()) {
    String appName=(String)it.next();
    String status="String_Node_Str";
    if (!DeploymentUtils.isDomainTarget(target)) {
      ApplicationRef ref=domain.getApplicationRefInTarget(appName,target);
      if (ref == null) {
        report.setMessage(localStrings.getLocalString("String_Node_Str","String_Node_Str",appName,target));
        report.setActionExitCode(ActionReport.ExitCode.FAILURE);
        return;
      }
    }
    if (domain.isAppEnabledInTarget(appName,target)) {
      status="String_Node_Str";
    }
    ActionReport.MessagePart childPart=part.addChild();
    String message=localStrings.getLocalString("String_Node_Str","String_Node_Str",appName,status);
    childPart.setMessage(message);
    childPart.addProperty(DeploymentProperties.STATE,status);
  }
  report.setActionExitCode(ActionReport.ExitCode.SUCCESS);
}
Program: 29357
Project: 29357
Buggy source:
/** 
 * create or obtain an embedded archive within this abstraction.
 * @param name name of the embedded archive.
 */
@Override public WritableArchive createSubArchive(String name) throws IOException {
  String subEntryName=getFileSubArchivePath(name);
  File subEntry=new File(subEntryName);
  if (!subEntry.exists()) {
    subEntry.mkdirs();
    logger.log(DEBUG_LEVEL,"String_Node_Str",subEntry.getAbsolutePath());
  }
 else {
    logger.log(DEBUG_LEVEL,"String_Node_Str",subEntry.getAbsolutePath());
    staleFileManager().recordValidEntry(subEntry);
  }
  final WritableArchive result=archiveFactory.createArchive(subEntry);
  if (result instanceof AbstractReadableArchive) {
    ((AbstractReadableArchive)result).setParentArchive(this);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * create or obtain an embedded archive within this abstraction.
 * @param name name of the embedded archive.
 */
@Override public WritableArchive createSubArchive(String name) throws IOException {
  String subEntryName=getFileSubArchivePath(name);
  File subEntry=new File(subEntryName);
  if (!subEntry.exists()) {
    if (!subEntry.exists() && !subEntry.mkdirs()) {
      throw new IOException("String_Node_Str" + subEntry.getAbsolutePath());
    }
    logger.log(DEBUG_LEVEL,"String_Node_Str",subEntry.getAbsolutePath());
  }
 else {
    logger.log(DEBUG_LEVEL,"String_Node_Str",subEntry.getAbsolutePath());
    staleFileManager().recordValidEntry(subEntry);
  }
  final WritableArchive result=archiveFactory.createArchive(subEntry);
  if (result instanceof AbstractReadableArchive) {
    ((AbstractReadableArchive)result).setParentArchive(this);
  }
  return result;
}
Program: 29358
Project: 29358
Buggy source:
/** 
 * creates a new abstract archive with the given path
 * @param uri path to create the archive
 */
@Override public void create(URI uri) throws IOException {
  this.uri=uri;
  archive=new File(uri);
  staleFileManager=StaleFileManager.Util.getInstance(archive);
  archive.mkdirs();
}

Fixed version (ground truth):
/** 
 * creates a new abstract archive with the given path
 * @param uri path to create the archive
 */
@Override public void create(URI uri) throws IOException {
  this.uri=uri;
  archive=new File(uri);
  staleFileManager=StaleFileManager.Util.getInstance(archive);
  if (!archive.exists() && !archive.mkdirs()) {
    throw new IOException("String_Node_Str" + archive.getAbsolutePath());
  }
}
Program: 29359
Project: 29359
Buggy source:
/** 
 * @returns an @see java.io.OutputStream for a new entry in thiscurrent abstract archive.
 * @param name the entry name
 */
@Override public OutputStream putNextEntry(String name) throws java.io.IOException {
  name=name.replace('/',File.separatorChar);
  File newFile=new File(archive,name);
  if (newFile.exists()) {
    if (!deleteEntry(name,false)) {
      logger.log(Level.FINE,"String_Node_Str",new Object[]{name,uri.toASCIIString()});
    }
  }
  if (name.lastIndexOf(File.separatorChar) != -1) {
    String dirs=name.substring(0,name.lastIndexOf(File.separatorChar));
    (new File(archive,dirs)).mkdirs();
  }
  staleFileManager().recordValidEntry(newFile);
  os=new BufferedOutputStream(new FileOutputStream(newFile));
  return os;
}

Fixed version (ground truth):
/** 
 * @returns an @see java.io.OutputStream for a new entry in thiscurrent abstract archive.
 * @param name the entry name
 */
@Override public OutputStream putNextEntry(String name) throws java.io.IOException {
  name=name.replace('/',File.separatorChar);
  File newFile=new File(archive,name);
  if (newFile.exists()) {
    if (!deleteEntry(name,false)) {
      logger.log(Level.FINE,"String_Node_Str",new Object[]{name,uri.toASCIIString()});
    }
  }
  if (name.lastIndexOf(File.separatorChar) != -1) {
    String dirs=name.substring(0,name.lastIndexOf(File.separatorChar));
    File dirsFile=new File(archive,dirs);
    if (!dirsFile.exists() && !dirsFile.mkdirs()) {
      throw new IOException("String_Node_Str" + dirsFile.getAbsolutePath());
    }
  }
  staleFileManager().recordValidEntry(newFile);
  os=new BufferedOutputStream(new FileOutputStream(newFile));
  return os;
}
Program: 29360
Project: 29360
Buggy source:
private void addManifest(final Collection<Artifacts.FullAndPartURIs> artifacts) throws IOException {
  final File mfFile=File.createTempFile("String_Node_Str","String_Node_Str");
  final OutputStream mfOS=new BufferedOutputStream(new FileOutputStream(mfFile));
  final Manifest mf=new Manifest();
  mf.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,"String_Node_Str");
  mf.write(mfOS);
  mfOS.close();
  artifacts.add(new Artifacts.FullAndPartURIs(mfFile.toURI(),JarFile.MANIFEST_NAME,true));
}

Fixed version (ground truth):
private void addManifest(final Collection<Artifacts.FullAndPartURIs> artifacts) throws IOException {
  final File mfFile=File.createTempFile("String_Node_Str","String_Node_Str");
  final OutputStream mfOS=new BufferedOutputStream(new FileOutputStream(mfFile));
  try {
    final Manifest mf=new Manifest();
    mf.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION,"String_Node_Str");
    mf.write(mfOS);
  }
  finally {
    mfOS.close();
  }
  artifacts.add(new Artifacts.FullAndPartURIs(mfFile.toURI(),JarFile.MANIFEST_NAME,true));
}
Program: 29361
Project: 29361
Buggy source:
private File initTenantDir(){
  if (tenant == null || originalAppName == null) {
    return null;
  }
  File f=getRootTenantDirForApp(originalAppName);
  f=new File(f,tenant);
  f.mkdirs();
  return f;
}

Fixed version (ground truth):
private File initTenantDir(){
  if (tenant == null || originalAppName == null) {
    return null;
  }
  File f=getRootTenantDirForApp(originalAppName);
  f=new File(f,tenant);
  if (!f.exists() && !f.mkdirs()) {
    if (logger.isLoggable(Level.FINEST)) {
      logger.log(Level.FINEST,"String_Node_Str" + f.getAbsolutePath());
    }
  }
  return f;
}
Program: 29362
Project: 29362
Buggy source:
public DeploymentProperties(Map map){
  super();
  if (map == null) {
    return;
  }
  Properties props=new Properties();
  for (Iterator itr=map.keySet().iterator(); itr.hasNext(); ) {
    String mapKey=(String)itr.next();
    String mapValue=(String)map.get(mapKey);
    String propsKey=(String)keyMap.get(mapKey);
    if (mapValue != null) {
      if (propsKey != null) {
        props.put(propsKey,mapValue);
      }
 else {
        props.put(mapKey,mapValue);
      }
    }
  }
  putAll(props);
}

Fixed version (ground truth):
public DeploymentProperties(Map map){
  super();
  if (map == null) {
    return;
  }
  Properties props=new Properties();
  for (Iterator<Map.Entry> itr=map.entrySet().iterator(); itr.hasNext(); ) {
    Map.Entry entry=itr.next();
    String mapKey=(String)entry.getKey();
    String mapValue=(String)entry.getValue();
    String propsKey=(String)keyMap.get(mapKey);
    if (mapValue != null) {
      if (propsKey != null) {
        props.put(propsKey,mapValue);
      }
 else {
        props.put(mapKey,mapValue);
      }
    }
  }
  putAll(props);
}
Program: 29363
Project: 29363
Buggy source:
public static Map propsToMap(Properties dProps){
  Map map=new HashMap();
  if (dProps == null) {
    return map;
  }
  for (Iterator itr=dProps.keySet().iterator(); itr.hasNext(); ) {
    String propsKey=(String)itr.next();
    String propsValue=(String)dProps.get(propsKey);
    String mapKey=(String)keyMap.get(propsKey);
    if (propsValue != null) {
      if (mapKey != null) {
        map.put(mapKey,propsValue);
      }
 else {
        map.put(propsKey,propsValue);
      }
    }
  }
  return map;
}

Fixed version (ground truth):
public static Map propsToMap(Properties dProps){
  Map map=new HashMap();
  if (dProps == null) {
    return map;
  }
  for (Iterator<Map.Entry<Object,Object>> itr=dProps.entrySet().iterator(); itr.hasNext(); ) {
    Map.Entry<Object,Object> entry=itr.next();
    String propsKey=(String)entry.getKey();
    String propsValue=(String)entry.getValue();
    String mapKey=(String)keyMap.get(propsKey);
    if (propsValue != null) {
      if (mapKey != null) {
        map.put(mapKey,propsValue);
      }
 else {
        map.put(propsKey,propsValue);
      }
    }
  }
  return map;
}
Program: 29365
Project: 29365
Buggy source:
public static void explodeJar(File source,File destination) throws IOException {
  JarFile jarFile=null;
  String fileSystemName=null;
  try {
    jarFile=new JarFile(source);
    Enumeration<JarEntry> e=jarFile.entries();
    while (e.hasMoreElements()) {
      JarEntry entry=e.nextElement();
      fileSystemName=entry.getName().replace('/',File.separatorChar);
      File out=new File(destination,fileSystemName);
      if (entry.isDirectory()) {
        out.mkdirs();
      }
 else {
        if (!out.getParentFile().exists()) {
          out.getParentFile().mkdirs();
        }
        InputStream is=new BufferedInputStream(jarFile.getInputStream(entry));
        FileOutputStream fos=FileUtils.openFileOutputStream(out);
        FileUtils.copy(is,fos,entry.getSize());
      }
    }
  }
 catch (  Throwable e) {
    String msg0=localStrings.getString("String_Node_Str",new Object[]{source.getAbsolutePath()});
    String msg=localStrings.getString("String_Node_Str",new Object[]{fileSystemName,destination.getAbsolutePath()});
    IOException ioe=new IOException(msg0);
    ioe.initCause(e);
    logger.log(Level.SEVERE,msg,ioe);
    throw ioe;
  }
 finally {
    if (jarFile != null) {
      jarFile.close();
    }
  }
}

Fixed version (ground truth):
public static void explodeJar(File source,File destination) throws IOException {
  JarFile jarFile=null;
  String fileSystemName=null;
  try {
    jarFile=new JarFile(source);
    Enumeration<JarEntry> e=jarFile.entries();
    while (e.hasMoreElements()) {
      JarEntry entry=e.nextElement();
      fileSystemName=entry.getName().replace('/',File.separatorChar);
      File out=new File(destination,fileSystemName);
      if (entry.isDirectory()) {
        if (!out.exists() && !out.mkdirs()) {
          throw new IOException("String_Node_Str" + out.getAbsolutePath());
        }
      }
 else {
        if (!out.getParentFile().exists()) {
          out.getParentFile().mkdirs();
        }
        InputStream is=new BufferedInputStream(jarFile.getInputStream(entry));
        FileOutputStream fos=FileUtils.openFileOutputStream(out);
        FileUtils.copy(is,fos,entry.getSize());
      }
    }
  }
 catch (  Throwable e) {
    String msg0=localStrings.getString("String_Node_Str",new Object[]{source.getAbsolutePath()});
    String msg=localStrings.getString("String_Node_Str",new Object[]{fileSystemName,destination.getAbsolutePath()});
    IOException ioe=new IOException(msg0);
    ioe.initCause(e);
    logger.log(Level.SEVERE,msg,ioe);
    throw ioe;
  }
 finally {
    if (jarFile != null) {
      jarFile.close();
    }
  }
}
Program: 29366
Project: 29366
Buggy source:
private ConfigChangeHandler(PropertyChangeEvent[] events){
  this.events=events;
}

Fixed version (ground truth):
private ConfigChangeHandler(){
}
Program: 29367
Project: 29367
Buggy source:
private static void extractJar(File jarFile,String destDir) throws IOException {
  java.util.jar.JarFile jar=new java.util.jar.JarFile(jarFile);
  java.util.Enumeration enum1=jar.entries();
  while (enum1.hasMoreElements()) {
    java.util.jar.JarEntry file=(java.util.jar.JarEntry)enum1.nextElement();
    java.io.File f=new java.io.File(destDir + java.io.File.separator + file.getName());
    if (file.isDirectory()) {
      f.mkdir();
      continue;
    }
    InputStream is=null;
    FileOutputStream fos=null;
    try {
      is=jar.getInputStream(file);
      fos=new FileOutputStream(f);
      while (is.available() > 0) {
        fos.write(is.read());
      }
    }
  finally {
      try {
        if (fos != null) {
          fos.close();
        }
      }
 catch (      Exception e) {
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str" + f.getName() + "String_Node_Str",e);
        }
      }
      try {
        if (is != null) {
          is.close();
        }
      }
 catch (      Exception e) {
        if (_logger.isLoggable(Level.FINEST)) {
          _logger.log(Level.FINEST,"String_Node_Str" + file.getName() + "String_Node_Str",e);
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void extractJar(File jarFile,String destDir) throws IOException {
  java.util.jar.JarFile jar=new java.util.jar.JarFile(jarFile);
  java.util.Enumeration enum1=jar.entries();
  try {
    while (enum1.hasMoreElements()) {
      java.util.jar.JarEntry file=(java.util.jar.JarEntry)enum1.nextElement();
      java.io.File f=new java.io.File(destDir + java.io.File.separator + file.getName());
      if (file.isDirectory()) {
        f.mkdir();
        continue;
      }
      InputStream is=null;
      FileOutputStream fos=null;
      try {
        is=jar.getInputStream(file);
        fos=new FileOutputStream(f);
        while (is.available() > 0) {
          fos.write(is.read());
        }
      }
  finally {
        try {
          if (fos != null) {
            fos.close();
          }
        }
 catch (        Exception e) {
          if (_logger.isLoggable(Level.FINEST)) {
            _logger.log(Level.FINEST,"String_Node_Str" + f.getName() + "String_Node_Str",e);
          }
        }
        try {
          if (is != null) {
            is.close();
          }
        }
 catch (        Exception e) {
          if (_logger.isLoggable(Level.FINEST)) {
            _logger.log(Level.FINEST,"String_Node_Str" + file.getName() + "String_Node_Str",e);
          }
        }
      }
    }
  }
  finally {
    try {
      jar.close();
    }
 catch (    Exception e) {
      if (_logger.isLoggable(Level.FINEST)) {
        _logger.log(Level.FINEST,"String_Node_Str" + jar.getName() + "String_Node_Str",e);
      }
    }
  }
}
Program: 29368
Project: 29368
Buggy source:
/** 
 * check whether the jndi Name has connector related suffix and return if any.
 * @param name jndi name
 * @return suffix, if found
 */
public static String getValidSuffix(String name){
  if (name != null) {
    for (    String validSuffix : ConnectorConstants.JNDI_SUFFIX_VALUES) {
      if (name.endsWith(validSuffix)) {
        return validSuffix;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * check whether the jndi Name has connector related suffix and return if any.
 * @param name jndi name
 * @return suffix, if found
 */
public static String getValidSuffix(String name){
  if (name != null) {
    for (    String validSuffix : JNDI_SUFFIX_VALUES) {
      if (name.endsWith(validSuffix)) {
        return validSuffix;
      }
    }
  }
  return null;
}
Program: 29369
Project: 29369
Buggy source:
/** 
 * If the suffix is one of the valid context return true. Return false, if that is not the case.
 * @param suffix __nontx / __pm
 * @return boolean whether the suffix is valid or not
 */
public static boolean isValidJndiSuffix(String suffix){
  if (suffix != null) {
    for (    String validSuffix : ConnectorConstants.JNDI_SUFFIX_VALUES) {
      if (validSuffix.equals(suffix)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * If the suffix is one of the valid context return true. Return false, if that is not the case.
 * @param suffix __nontx / __pm
 * @return boolean whether the suffix is valid or not
 */
public static boolean isValidJndiSuffix(String suffix){
  if (suffix != null) {
    for (    String validSuffix : JNDI_SUFFIX_VALUES) {
      if (validSuffix.equals(suffix)) {
        return true;
      }
    }
  }
  return false;
}
Program: 29370
Project: 29370
Buggy source:
@Test public void multipleListeners() throws TransactionFailure {
  final Domain domain=getHabitat().getService(Domain.class);
  final ConfigListener configListener1=new ConfigListener(){
    @Override public UnprocessedChangeEvents changed(    PropertyChangeEvent[] propertyChangeEvents){
      listenersInvoked++;
      return null;
    }
  }
;
  final ConfigListener configListener2=new ConfigListener(){
    @Override public UnprocessedChangeEvents changed(    PropertyChangeEvent[] propertyChangeEvents){
      listenersInvoked++;
      return null;
    }
  }
;
  Transactions transactions=getHabitat().getService(Transactions.class);
  try {
    transactions.addListenerForType(SystemProperty.class,configListener1);
    transactions.addListenerForType(SystemProperty.class,configListener2);
    assertTrue(domain != null);
    ConfigSupport.apply(new SingleConfigCode<Domain>(){
      public Object run(      Domain domain) throws PropertyVetoException, TransactionFailure {
        SystemProperty prop=domain.createChild(SystemProperty.class);
        domain.getSystemProperty().add(prop);
        prop.setName("String_Node_Str");
        prop.setValue("String_Node_Str");
        return prop;
      }
    }
,domain);
    transactions.waitForDrain();
    assertTrue(listenersInvoked == 2);
  }
  finally {
    assertTrue(transactions.removeListenerForType(SystemProperty.class,configListener1));
    assertTrue(transactions.removeListenerForType(SystemProperty.class,configListener2));
  }
}

Fixed version (ground truth):
@Test public void multipleListeners() throws TransactionFailure {
  final Domain domain=getHabitat().getService(Domain.class);
  final ConfigListener configListener1=new ConfigListener(){
    @Override public UnprocessedChangeEvents changed(    PropertyChangeEvent[] propertyChangeEvents){
      listenersInvoked.incrementAndGet();
      return null;
    }
  }
;
  final ConfigListener configListener2=new ConfigListener(){
    @Override public UnprocessedChangeEvents changed(    PropertyChangeEvent[] propertyChangeEvents){
      listenersInvoked.incrementAndGet();
      return null;
    }
  }
;
  Transactions transactions=getHabitat().getService(Transactions.class);
  try {
    transactions.addListenerForType(SystemProperty.class,configListener1);
    transactions.addListenerForType(SystemProperty.class,configListener2);
    assertTrue(domain != null);
    ConfigSupport.apply(new SingleConfigCode<Domain>(){
      @Override public Object run(      Domain domain) throws PropertyVetoException, TransactionFailure {
        SystemProperty prop=domain.createChild(SystemProperty.class);
        domain.getSystemProperty().add(prop);
        prop.setName("String_Node_Str");
        prop.setValue("String_Node_Str");
        return prop;
      }
    }
,domain);
    transactions.waitForDrain();
    assertTrue(listenersInvoked.intValue() == 2);
  }
  finally {
    assertTrue(transactions.removeListenerForType(SystemProperty.class,configListener1));
    assertTrue(transactions.removeListenerForType(SystemProperty.class,configListener2));
  }
}
Program: 29371
Project: 29371
Buggy source:
public Object run(Domain domain) throws PropertyVetoException, TransactionFailure {
  SystemProperty prop=domain.createChild(SystemProperty.class);
  domain.getSystemProperty().add(prop);
  prop.setName("String_Node_Str");
  prop.setValue("String_Node_Str");
  return prop;
}

Fixed version (ground truth):
@Override public Object run(Domain domain) throws PropertyVetoException, TransactionFailure {
  SystemProperty prop=domain.createChild(SystemProperty.class);
  domain.getSystemProperty().add(prop);
  prop.setName("String_Node_Str");
  prop.setValue("String_Node_Str");
  return prop;
}
Program: 29373
Project: 29373
Buggy source:
@Override public UnprocessedChangeEvents changed(PropertyChangeEvent[] propertyChangeEvents){
  listenersInvoked++;
  return null;
}

Fixed version (ground truth):
@Override public UnprocessedChangeEvents changed(PropertyChangeEvent[] propertyChangeEvents){
  listenersInvoked.incrementAndGet();
  return null;
}
Program: 29374
Project: 29374
Buggy source:
/** 
 * Constructs a coordinator
 * @param work     A work object as submitted by the resource adapter
 * @param timeout  timeout for the work instance
 * @param ec       ExecutionContext object.
 * @param queue    WorkQueue of the threadpool, to which the workwill be submitted
 * @param listener WorkListener object from the resource adapter.
 */
public WorkCoordinator(javax.resource.spi.work.Work work,long timeout,ExecutionContext ec,WorkQueue queue,WorkListener listener,WorkManagementProbeProvider probeProvider,ConnectorRuntime runtime,String raName,WorkContextHandlerImpl handler){
  this.work=work;
  this.timeout=timeout;
  this.ec=ec;
  this.queue=queue;
  this.listener=listener;
synchronized (WorkCoordinator.class) {
    this.id=++seed;
  }
  this.runtime=runtime;
  this.lock=new Object();
  this.probeProvider=probeProvider;
  this.raName=raName;
  this.contextHandler=handler;
}

Fixed version (ground truth):
/** 
 * Constructs a coordinator
 * @param work     A work object as submitted by the resource adapter
 * @param timeout  timeout for the work instance
 * @param ec       ExecutionContext object.
 * @param queue    WorkQueue of the threadpool, to which the workwill be submitted
 * @param listener WorkListener object from the resource adapter.
 */
public WorkCoordinator(javax.resource.spi.work.Work work,long timeout,ExecutionContext ec,WorkQueue queue,WorkListener listener,WorkManagementProbeProvider probeProvider,ConnectorRuntime runtime,String raName,WorkContextHandlerImpl handler){
  this.work=work;
  this.timeout=timeout;
  this.ec=ec;
  this.queue=queue;
  this.listener=listener;
synchronized (WorkCoordinator.class) {
    this.id=increaseSeed();
  }
  this.runtime=runtime;
  this.lock=new Object();
  this.probeProvider=probeProvider;
  this.raName=raName;
  this.contextHandler=handler;
}
Program: 29375
Project: 29375
Buggy source:
/** 
 * Lock the thread upto the end of execution or start of work execution.
 */
public void lock(){
  if (!lockRequired()) {
    return;
  }
  try {
synchronized (lock) {
      if (checkStateBeforeLocking()) {
        if (timeout != -1) {
          lock.wait(timeout);
        }
 else {
          lock.wait();
        }
      }
    }
    if (getState() < STARTED) {
      workTimedOut();
    }
    if (lockRequired()) {
synchronized (lock) {
        if (checkStateBeforeLocking()) {
          lock.wait();
        }
      }
    }
  }
 catch (  Exception e) {
    setException(e);
  }
}

Fixed version (ground truth):
/** 
 * Lock the thread upto the end of execution or start of work execution.
 */
public void lock(){
  if (!lockRequired()) {
    return;
  }
  try {
synchronized (lock) {
      while (checkStateBeforeLocking()) {
        if (timeout != -1) {
          lock.wait(timeout);
        }
 else {
          lock.wait();
        }
      }
    }
    if (getState() < STARTED) {
      workTimedOut();
    }
    if (lockRequired()) {
synchronized (lock) {
        if (checkStateBeforeLocking()) {
          lock.wait();
        }
      }
    }
  }
 catch (  Exception e) {
    setException(e);
  }
}
Program: 29376
Project: 29376
Buggy source:
/** 
 * Unlocks the thread.
 */
private void unLock(){
  try {
synchronized (lock) {
      lock.notify();
    }
  }
 catch (  Exception e) {
    setException(e);
  }
}

Fixed version (ground truth):
/** 
 * Unlocks the thread.
 */
private void unLock(){
  try {
synchronized (lock) {
      lock.notifyAll();
    }
  }
 catch (  Exception e) {
    setException(e);
  }
}
Program: 29377
Project: 29377
Buggy source:
/** 
 * @see java.io.Externalizable
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  moduleName=in.readUTF();
  wm=WorkManagerFactoryImpl.retrieveWorkManager(moduleName);
  _logger=LogDomains.getLogger(WorkManagerProxy.class,LogDomains.RSR_LOGGER);
}

Fixed version (ground truth):
/** 
 * @see java.io.Externalizable
 */
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  moduleName=in.readUTF();
  wm=WorkManagerFactoryImpl.retrieveWorkManager(moduleName);
}
Program: 29378
Project: 29378
Buggy source:
protected static Logger getLogger(){
  if (logger == null) {
    logger=LogDomains.getLogger(ConnectionManagerImpl.class,LogDomains.RSR_LOGGER);
  }
  return logger;
}

Fixed version (ground truth):
protected static Logger getLogger(){
  if (logger == null) {
synchronized (ConnectionManagerImpl.class) {
      if (logger == null) {
        logger=LogDomains.getLogger(ConnectionManagerImpl.class,LogDomains.RSR_LOGGER);
      }
    }
  }
  return logger;
}
Program: 29379
Project: 29379
Buggy source:
private static StringManager getLocalStrings(){
  if (localStrings == null) {
    localStrings=StringManager.getManager(ConnectionManagerImpl.class);
  }
  return localStrings;
}

Fixed version (ground truth):
private static StringManager getLocalStrings(){
  if (localStrings == null) {
synchronized (ConnectionManagerImpl.class) {
      if (localStrings == null) {
        localStrings=StringManager.getManager(ConnectionManagerImpl.class);
      }
    }
  }
  return localStrings;
}
Program: 29381
Project: 29381
Buggy source:
public static void main(String[] args){
  Map m=ConnectionDefinitionUtils.getConnectionDefinitionPropertiesAndDefaults("String_Node_Str","String_Node_Str");
  Set<String> keys=m.keySet();
  for (  String element : keys) {
    System.out.println(element + "String_Node_Str" + m.get(element));
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Map m=ConnectionDefinitionUtils.getConnectionDefinitionPropertiesAndDefaults("String_Node_Str","String_Node_Str");
  Set<Map.Entry> elements=m.entrySet();
  for (  Map.Entry element : elements) {
    System.out.println(element.getKey() + "String_Node_Str" + element.getValue());
  }
}
Program: 29382
Project: 29382
Buggy source:
/** 
 * Initializes this singleton with the given parent class loader if not already created.
 * @param parent parent class loader
 * @return the instance
 */
public static ConnectorClassLoader getInstance(final ClassLoader parent){
  if (classLoader == null) {
synchronized (ConnectorClassLoader.class) {
      classLoader=AccessController.doPrivileged(new PrivilegedAction<ConnectorClassLoader>(){
        public ConnectorClassLoader run(){
          return new ConnectorClassLoader(parent);
        }
      }
);
    }
  }
  return classLoader;
}

Fixed version (ground truth):
/** 
 * Initializes this singleton with the given parent class loader if not already created.
 * @param parent parent class loader
 * @return the instance
 */
public static ConnectorClassLoader getInstance(final ClassLoader parent){
  if (classLoader == null) {
synchronized (ConnectorClassLoader.class) {
      if (classLoader == null) {
        classLoader=AccessController.doPrivileged(new PrivilegedAction<ConnectorClassLoader>(){
          public ConnectorClassLoader run(){
            return new ConnectorClassLoader(parent);
          }
        }
);
      }
    }
  }
  return classLoader;
}
Program: 29383
Project: 29383
Buggy source:
public static final ConnectorTimerProxy getProxy(){
synchronized (ConnectorTimerProxy.class) {
    if (connectorTimer == null) {
      connectorTimer=new ConnectorTimerProxy(true);
    }
  }
  return connectorTimer;
}

Fixed version (ground truth):
public static final ConnectorTimerProxy getProxy(){
  if (connectorTimer == null) {
synchronized (ConnectorTimerProxy.class) {
      if (connectorTimer == null) {
        connectorTimer=new ConnectorTimerProxy(true);
      }
    }
  }
  return connectorTimer;
}
Program: 29384
Project: 29384
Buggy source:
private byte[] getZipEntryContents(ZipEntry ze,ZipInputStream zis) throws IOException {
  int size=(int)ze.getSize();
  byte[] b=null;
  if (size != -1) {
    b=new byte[(int)size];
    int rb=0;
    int chunk=0;
    while (((int)size - rb) > 0) {
      chunk=zis.read(b,rb,(int)size - rb);
      if (chunk == -1) {
        break;
      }
      rb+=chunk;
    }
  }
 else {
    ArrayList al=new ArrayList();
    int c=0;
    while ((c=zis.read()) != -1) {
      al.add(Byte.valueOf((byte)c));
    }
    Byte[] btArr=(Byte[])al.toArray(new Byte[]{});
    b=new byte[btArr.length];
    if (_logger.isLoggable(Level.FINER)) {
      _logger.finer("String_Node_Str" + btArr.length);
    }
    for (int i=0; i < btArr.length; i++) {
      b[i]=btArr[i].byteValue();
    }
  }
  return b;
}

Fixed version (ground truth):
private byte[] getZipEntryContents(ZipEntry ze,ZipInputStream zis) throws IOException {
  int size=(int)ze.getSize();
  byte[] b=null;
  if (size != -1) {
    b=new byte[(int)size];
    int rb=0;
    int chunk=0;
    while (((int)size - rb) > 0) {
      chunk=zis.read(b,rb,(int)size - rb);
      if (chunk == -1) {
        break;
      }
      rb+=chunk;
    }
  }
 else {
    ArrayList al=new ArrayList();
    int c=0;
    while ((c=zis.read()) != -1) {
      al.add(Byte.valueOf((byte)c));
    }
    Byte[] btArr=(Byte[])al.toArray(new Byte[al.size()]);
    b=new byte[btArr.length];
    if (_logger.isLoggable(Level.FINER)) {
      _logger.finer("String_Node_Str" + btArr.length);
    }
    for (int i=0; i < btArr.length; i++) {
      b[i]=btArr[i].byteValue();
    }
  }
  return b;
}
Program: 29385
Project: 29385
Buggy source:
public static ResourcesUtil createInstance(){
  if (resourcesUtil == null) {
    resourcesUtil=new ResourcesUtil();
  }
  return resourcesUtil;
}

Fixed version (ground truth):
public static ResourcesUtil createInstance(){
  if (resourcesUtil == null) {
synchronized (ResourcesUtil.class) {
      if (resourcesUtil == null) {
        resourcesUtil=new ResourcesUtil();
      }
    }
  }
  return resourcesUtil;
}
Program: 29386
Project: 29386
Buggy source:
public static ConnectorRuntime getRuntime(){
  try {
    if (runtime == null) {
      runtime=ConnectorRuntime.getRuntime();
    }
  }
 catch (  Exception e) {
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.log(Level.FINEST,"String_Node_Str" + "String_Node_Str",e);
    }
    runtime=getHabitat().getComponent(ConnectorRuntime.class);
  }
  return runtime;
}

Fixed version (ground truth):
public static ConnectorRuntime getRuntime(){
  try {
    if (runtime == null) {
synchronized (ConnectorNamingUtils.class) {
        if (runtime == null) {
          runtime=ConnectorRuntime.getRuntime();
        }
      }
    }
  }
 catch (  Exception e) {
    if (_logger.isLoggable(Level.FINEST)) {
      _logger.log(Level.FINEST,"String_Node_Str" + "String_Node_Str",e);
    }
    runtime=getHabitat().getComponent(ConnectorRuntime.class);
  }
  return runtime;
}
Program: 29388
Project: 29388
Buggy source:
private String getAppName(long resourceHandleId){
  if (!runtime.isJdbcPoolMonitoringEnabled() && !runtime.isConnectorPoolMonitoringEnabled()) {
    return null;
  }
  String appName=resourceAppAssociationMap.get(resourceHandleId);
  if (appName == null) {
    try {
      if (ic == null) {
        ic=new InitialContext();
      }
      appName=(String)ic.lookup("String_Node_Str");
      resourceAppAssociationMap.put(resourceHandleId,appName);
    }
 catch (    NamingException ex) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
      }
    }
  }
  return appName;
}

Fixed version (ground truth):
private String getAppName(long resourceHandleId){
  if (!runtime.isJdbcPoolMonitoringEnabled() && !runtime.isConnectorPoolMonitoringEnabled()) {
    return null;
  }
  String appName=resourceAppAssociationMap.get(resourceHandleId);
  if (appName == null) {
    try {
      if (ic == null) {
synchronized (ConnectionPoolEmitterImpl.class) {
          if (ic == null) {
            ic=new InitialContext();
          }
        }
      }
      appName=(String)ic.lookup("String_Node_Str");
      resourceAppAssociationMap.put(resourceHandleId,appName);
    }
 catch (    NamingException ex) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,"String_Node_Str" + "String_Node_Str");
      }
    }
  }
  return appName;
}
Program: 29389
Project: 29389
Buggy source:
/** 
 * Constructor
 * @param poolInfo connection pool on whose behalf this emitter emits pool relatedprobe events
 * @param provider
 */
public ConnectionPoolEmitterImpl(PoolInfo poolInfo,ConnectionPoolProbeProvider provider){
  this.poolInfo=poolInfo;
  this.poolName=poolInfo.getName();
  this.appName=poolInfo.getApplicationName();
  this.moduleName=poolInfo.getModuleName();
  this.poolProbeProvider=provider;
  this.ccPoolAppStatsProviders=new ArrayList<ConnectorConnPoolAppStatsProvider>();
  this.appStatsMap=new HashMap<PoolInfo,Map<String,ConnectionPoolAppEmitterImpl>>();
  this.resourceAppAssociationMap=new HashMap<Long,String>();
  runtime=ConnectorRuntime.getRuntime();
  if (ic == null) {
    try {
      ic=new InitialContext();
    }
 catch (    NamingException e) {
    }
  }
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param poolInfo connection pool on whose behalf this emitter emits pool relatedprobe events
 * @param provider
 */
public ConnectionPoolEmitterImpl(PoolInfo poolInfo,ConnectionPoolProbeProvider provider){
  this.poolInfo=poolInfo;
  this.poolName=poolInfo.getName();
  this.appName=poolInfo.getApplicationName();
  this.moduleName=poolInfo.getModuleName();
  this.poolProbeProvider=provider;
  this.ccPoolAppStatsProviders=new ArrayList<ConnectorConnPoolAppStatsProvider>();
  this.appStatsMap=new HashMap<PoolInfo,Map<String,ConnectionPoolAppEmitterImpl>>();
  this.resourceAppAssociationMap=new HashMap<Long,String>();
  runtime=ConnectorRuntime.getRuntime();
  if (ic == null) {
synchronized (ConnectionPoolEmitterImpl.class) {
      if (ic == null) {
        try {
          ic=new InitialContext();
        }
 catch (        NamingException e) {
        }
      }
    }
  }
}