nus-yam/ex-repair huggingface dataset:
Program: 28159
Project: 28159
Buggy source:
private void addWebContainerIfRequested(Map<?,?> properties,GlassFishProperties props) throws EJBException {
  String http_port=(properties == null) ? null : (String)properties.get(GF_WEB_HTTP_PORT);
  if (http_port != null) {
    int port=8080;
    try {
      port=Integer.valueOf(http_port);
    }
 catch (    NumberFormatException e) {
      System.err.println("String_Node_Str");
    }
    props.setPort("String_Node_Str",port);
  }
}

Fixed version (ground truth):
private void addWebContainerIfRequested(Map<?,?> properties,GlassFishProperties props) throws EJBException {
  String http_port=(properties == null) ? null : (String)properties.get(GF_WEB_HTTP_PORT);
  if (http_port != null) {
    int port=8080;
    try {
      port=Integer.parseInt(http_port);
    }
 catch (    NumberFormatException e) {
      System.err.println("String_Node_Str");
    }
    props.setPort("String_Node_Str",port);
  }
}
Program: 28160
Project: 28160
Buggy source:
@Override protected org.glassfish.grizzly.http.HttpServerFilter createHttpServerCodecFilter(final Http http,final boolean isChunkedEnabled,final int headerBufferLengthBytes,final String defaultResponseType,final KeepAlive keepAlive,final DelayedExecutor delayedExecutor,final int maxRequestHeaders,final int maxResponseHeaders){
  return new GlassfishHttpCodecFilter(http == null || Boolean.parseBoolean(http.getXpoweredBy()),http == null || Boolean.parseBoolean(http.getServerHeader()),isChunkedEnabled,headerBufferLengthBytes,defaultResponseType,keepAlive,delayedExecutor,maxRequestHeaders,maxResponseHeaders);
}

Fixed version (ground truth):
@Override protected org.glassfish.grizzly.http.HttpServerFilter createHttpServerCodecFilter(final Http http,final boolean isChunkedEnabled,final int headerBufferLengthBytes,final String defaultResponseType,final KeepAlive keepAlive,final DelayedExecutor delayedExecutor,final int maxRequestHeaders,final int maxResponseHeaders){
  final org.glassfish.grizzly.http.HttpServerFilter httpCodecFilter=new GlassfishHttpCodecFilter(http == null || Boolean.parseBoolean(http.getXpoweredBy()),http == null || Boolean.parseBoolean(http.getServerHeader()),isChunkedEnabled,headerBufferLengthBytes,defaultResponseType,keepAlive,delayedExecutor,maxRequestHeaders,maxResponseHeaders);
  if (http != null) {
    httpCodecFilter.setMaxPayloadRemainderToSkip(Integer.parseInt(http.getMaxSwallowingInputBytes()));
    httpCodecFilter.setAllowPayloadForUndefinedHttpMethods(Boolean.parseBoolean(http.getAllowPayloadForUndefinedHttpMethods()));
  }
  return httpCodecFilter;
}
Program: 28161
Project: 28161
Buggy source:
/** 
 * Links the policy contexts of the application
 * @param app
 * @param webs
 */
private void linkPolicies(Application app,Collection<WebBundleDescriptor> webs) throws DeploymentException {
  try {
    String linkName=null;
    boolean lastInService=false;
    for (    WebBundleDescriptor wbd : webs) {
      String name=SecurityUtil.getContextID(wbd);
      lastInService=SecurityUtil.linkPolicyFile(name,linkName,lastInService);
      linkName=name;
    }
    Set<EjbBundleDescriptor> ejbs=app.getBundleDescriptors(EjbBundleDescriptor.class);
    for (    EjbBundleDescriptor ejbd : ejbs) {
      String name=SecurityUtil.getContextID(ejbd);
      lastInService=SecurityUtil.linkPolicyFile(name,linkName,lastInService);
      linkName=name;
    }
  }
 catch (  IASSecurityException se) {
    String msg="String_Node_Str" + app.getRegistrationName();
    throw new DeploymentException(msg,se);
  }
}

Fixed version (ground truth):
/** 
 * Links the policy contexts of the application
 * @param app
 * @param webs
 */
private void linkPolicies(Application app,Collection<WebBundleDescriptor> webs) throws DeploymentException {
  try {
    String linkName=null;
    boolean lastInService=false;
    for (    WebBundleDescriptor wbd : webs) {
      String name=SecurityUtil.getContextID(wbd);
      lastInService=SecurityUtil.linkPolicyFile(name,linkName,lastInService);
      linkName=name;
    }
    linkName=null;
    Set<EjbBundleDescriptor> ejbs=app.getBundleDescriptors(EjbBundleDescriptor.class);
    for (    EjbBundleDescriptor ejbd : ejbs) {
      String name=SecurityUtil.getContextID(ejbd);
      lastInService=SecurityUtil.linkPolicyFile(name,linkName,lastInService);
      linkName=name;
    }
  }
 catch (  IASSecurityException se) {
    String msg="String_Node_Str" + app.getRegistrationName();
    throw new DeploymentException(msg,se);
  }
}
Program: 28163
Project: 28163
Buggy source:
private CompositeMetadata createCompositeMetadata(ModifiedAttributeHASession modAttrSession){
  byte[] trunkState=null;
  if (!modAttrSession.isNew()) {
    try {
      trunkState=this.getByteArray(modAttrSession);
    }
 catch (    IOException ex) {
    }
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + trunkState);
  }
  List<SessionAttributeMetadata> entries=new ArrayList<SessionAttributeMetadata>();
  List<String> addedAttrs=modAttrSession.getAddedAttributes();
  List<String> modifiedAttrs=modAttrSession.getModifiedAttributes();
  List<String> deletedAttrs=modAttrSession.getDeletedAttributes();
  printAttrList("String_Node_Str",addedAttrs);
  printAttrList("String_Node_Str",modifiedAttrs);
  printAttrList("String_Node_Str",deletedAttrs);
  addToEntries(modAttrSession,entries,SessionAttributeMetadata.Operation.ADD,addedAttrs);
  addToEntries(modAttrSession,entries,SessionAttributeMetadata.Operation.UPDATE,modifiedAttrs);
  addToEntries(modAttrSession,entries,SessionAttributeMetadata.Operation.DELETE,deletedAttrs);
  CompositeMetadata result=new CompositeMetadata(modAttrSession.getVersion(),modAttrSession.getLastAccessedTimeInternal(),modAttrSession.getMaxInactiveInterval() * 1000L,entries,trunkState,null);
  return result;
}

Fixed version (ground truth):
private CompositeMetadata createCompositeMetadata(ModifiedAttributeHASession modAttrSession) throws IOException {
  byte[] trunkState=null;
  if (!modAttrSession.isNew()) {
    try {
      trunkState=this.getByteArray(modAttrSession);
    }
 catch (    IOException ex) {
      if (ex instanceof NotSerializableException) {
        throw ex;
      }
    }
  }
  if (_logger.isLoggable(Level.FINE)) {
    _logger.fine("String_Node_Str" + trunkState);
  }
  List<SessionAttributeMetadata> entries=new ArrayList<SessionAttributeMetadata>();
  List<String> addedAttrs=modAttrSession.getAddedAttributes();
  List<String> modifiedAttrs=modAttrSession.getModifiedAttributes();
  List<String> deletedAttrs=modAttrSession.getDeletedAttributes();
  printAttrList("String_Node_Str",addedAttrs);
  printAttrList("String_Node_Str",modifiedAttrs);
  printAttrList("String_Node_Str",deletedAttrs);
  addToEntries(modAttrSession,entries,SessionAttributeMetadata.Operation.ADD,addedAttrs);
  addToEntries(modAttrSession,entries,SessionAttributeMetadata.Operation.UPDATE,modifiedAttrs);
  addToEntries(modAttrSession,entries,SessionAttributeMetadata.Operation.DELETE,deletedAttrs);
  CompositeMetadata result=new CompositeMetadata(modAttrSession.getVersion(),modAttrSession.getLastAccessedTimeInternal(),modAttrSession.getMaxInactiveInterval() * 1000L,entries,trunkState,null);
  return result;
}
Program: 28165
Project: 28165
Buggy source:
@Reset public void reset(){
  this.requestProcessTime.reset();
  this.count200.reset();
  this.count2xx.reset();
  this.count302.reset();
  this.count304.reset();
  this.count3xx.reset();
  this.count400.reset();
  this.count401.reset();
  this.count403.reset();
  this.count404.reset();
  this.count4xx.reset();
  this.count503.reset();
  this.count5xx.reset();
  this.countOther.reset();
  this.errorCount.reset();
  this.maxTime.reset();
  this.processingTime.reset();
  this.countBytesReceived.reset();
  this.countBytesTransmitted.reset();
  this.countOpenConnections.reset();
  this.countRequests.reset();
  this.maxOpenConnections.reset();
  this.method.reset();
  this.uri.reset();
}

Fixed version (ground truth):
@Reset public void reset(){
  this.requestProcessTime.reset();
  this.count200.reset();
  this.count2xx.reset();
  this.count302.reset();
  this.count304.reset();
  this.count3xx.reset();
  this.count400.reset();
  this.count401.reset();
  this.count403.reset();
  this.count404.reset();
  this.count4xx.reset();
  this.count503.reset();
  this.count5xx.reset();
  this.countOther.reset();
  this.errorCount.reset();
  this.maxTime.reset();
  this.processingTime.reset();
  this.countBytesReceived.reset();
  this.countBytesTransmitted.reset();
  this.countOpenConnections.reset();
  this.countRequests.reset();
  this.maxOpenConnections.reset();
  this.method.reset();
  this.uri.reset();
  countOpenConnections.increment(getInitialOpenConnections());
}
Program: 28167
Project: 28167
Buggy source:
/** 
 * Method to validate jndi name for app namespace
 * @param myVector
 * @return
 */
private boolean compareVectorForApp(Vector myVector,String jndiName){
  for (int j=0; j < myVector.size(); j++) {
    String firstElement=(String)myVector.get(j);
    if (firstElement.contains("String_Node_Str")) {
      firstElement=firstElement.substring(0,firstElement.indexOf("String_Node_Str"));
    }
    for (int i=j + 1; i < myVector.size(); i++) {
      String otherElements=(String)myVector.get(i);
      if (otherElements.contains("String_Node_Str")) {
        otherElements=otherElements.substring(0,otherElements.indexOf("String_Node_Str"));
      }
      if (firstElement.equals(otherElements)) {
        inValidJndiName=jndiName;
        DOLUtils.getDefaultLogger().log(Level.SEVERE,"String_Node_Str",new Object[]{jndiName,application.getAppName()});
      }
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Method to validate jndi name for app namespace
 * @param myVector
 * @return
 */
private boolean compareVectorForApp(Vector myVector,String jndiName){
  for (int j=0; j < myVector.size(); j++) {
    String firstElement=(String)myVector.get(j);
    if (firstElement.contains("String_Node_Str")) {
      firstElement=firstElement.substring(0,firstElement.indexOf("String_Node_Str"));
    }
    for (int i=j + 1; i < myVector.size(); i++) {
      String otherElements=(String)myVector.get(i);
      if (otherElements.contains("String_Node_Str")) {
        otherElements=otherElements.substring(0,otherElements.indexOf("String_Node_Str"));
      }
      if (firstElement.equals(otherElements)) {
        boolean fail=!firstElement.startsWith(EJB_LEVEL);
        inValidJndiName=jndiName;
        DOLUtils.getDefaultLogger().log(fail ? Level.SEVERE : Level.FINE,"String_Node_Str",new Object[]{jndiName,application.getAppName()});
        if (fail) {
          return false;
        }
      }
    }
  }
  return true;
}
Program: 28170
Project: 28170
Buggy source:
@Override protected void postAnnotationProcess(WebBundleDescriptorImpl descriptor,ReadableArchive archive) throws IOException {
  super.postAnnotationProcess(descriptor,archive);
  List<WebFragmentDescriptor> wfList=readStandardFragments(descriptor,archive);
  if (isProcessAnnotation(descriptor)) {
    Map<ExtensionsArchivist,RootDeploymentDescriptor> localExtensions=new HashMap<ExtensionsArchivist,RootDeploymentDescriptor>();
    for (    WebFragmentDescriptor wfDesc : wfList) {
      super.readAnnotations(archive,wfDesc,localExtensions);
    }
    ModuleScanner scanner=getScanner();
    if (scanner instanceof WarScanner) {
      ((WarScanner)scanner).setScanOtherLibraries(true);
      readAnnotations(archive,descriptor,localExtensions,scanner);
    }
  }
  WebFragmentDescriptor mergedWebFragment=null;
  for (  WebFragmentDescriptor wf : wfList) {
    if (mergedWebFragment == null) {
      if (wf.isExists()) {
        mergedWebFragment=wf;
      }
    }
 else {
      mergedWebFragment.addWebBundleDescriptor(wf);
    }
  }
  if (mergedWebFragment != null) {
    descriptor.addWebBundleDescriptor(mergedWebFragment);
  }
  WebBundleDescriptorImpl defaultWebBundleDescriptor=getPlainDefaultWebXmlBundleDescriptor();
  descriptor.addDefaultWebBundleDescriptor(defaultWebBundleDescriptor);
}

Fixed version (ground truth):
@Override protected void postAnnotationProcess(WebBundleDescriptorImpl descriptor,ReadableArchive archive) throws IOException {
  super.postAnnotationProcess(descriptor,archive);
  List<WebFragmentDescriptor> wfList=readStandardFragments(descriptor,archive);
  if (isProcessAnnotation(descriptor)) {
    Map<ExtensionsArchivist,RootDeploymentDescriptor> localExtensions=new HashMap<ExtensionsArchivist,RootDeploymentDescriptor>();
    for (    WebFragmentDescriptor wfDesc : wfList) {
      super.readAnnotations(archive,wfDesc,localExtensions);
    }
    ModuleScanner scanner=getScanner();
    if (scanner instanceof WarScanner) {
      ((WarScanner)scanner).setScanOtherLibraries(true);
      readAnnotations(archive,descriptor,localExtensions,scanner);
    }
  }
  WebFragmentDescriptor mergedWebFragment=null;
  for (  WebFragmentDescriptor wf : wfList) {
    if (mergedWebFragment == null) {
      mergedWebFragment=wf;
    }
 else {
      if (wf.isExists() && wf.isDistributable() == null) {
        wf.setDistributable(false);
      }
      mergedWebFragment.addWebBundleDescriptor(wf);
    }
  }
  if (mergedWebFragment != null) {
    mergedWebFragment.setExists(true);
    if (descriptor.isDistributable() == null) {
      descriptor.setDistributable(false);
    }
    descriptor.addWebBundleDescriptor(mergedWebFragment);
  }
  WebBundleDescriptorImpl defaultWebBundleDescriptor=getPlainDefaultWebXmlBundleDescriptor();
  descriptor.addDefaultWebBundleDescriptor(defaultWebBundleDescriptor);
}
Program: 28172
Project: 28172
Buggy source:
public boolean isExists(){
  return exists;
}

Fixed version (ground truth):
@Override public boolean isExists(){
  return exists;
}
Program: 28173
Project: 28173
Buggy source:
@Override protected void postAnnotationProcess(WebBundleDescriptorImpl descriptor,ReadableArchive archive) throws IOException {
  super.postAnnotationProcess(descriptor,archive);
  List<WebFragmentDescriptor> wfList=readStandardFragments(descriptor,archive);
  if (isProcessAnnotation(descriptor)) {
    Map<ExtensionsArchivist,RootDeploymentDescriptor> localExtensions=new HashMap<ExtensionsArchivist,RootDeploymentDescriptor>();
    for (    WebFragmentDescriptor wfDesc : wfList) {
      super.readAnnotations(archive,wfDesc,localExtensions);
    }
    ModuleScanner scanner=getScanner();
    if (scanner instanceof WarScanner) {
      ((WarScanner)scanner).setScanOtherLibraries(true);
      readAnnotations(archive,descriptor,localExtensions,scanner);
    }
  }
  WebFragmentDescriptor mergedWebFragment=null;
  for (  WebFragmentDescriptor wf : wfList) {
    if (mergedWebFragment == null) {
      mergedWebFragment=wf;
    }
 else {
      mergedWebFragment.addWebBundleDescriptor(wf);
    }
  }
  if (mergedWebFragment != null) {
    descriptor.addWebBundleDescriptor(mergedWebFragment);
  }
  WebBundleDescriptorImpl defaultWebBundleDescriptor=getPlainDefaultWebXmlBundleDescriptor();
  descriptor.addDefaultWebBundleDescriptor(defaultWebBundleDescriptor);
}

Fixed version (ground truth):
@Override protected void postAnnotationProcess(WebBundleDescriptorImpl descriptor,ReadableArchive archive) throws IOException {
  super.postAnnotationProcess(descriptor,archive);
  List<WebFragmentDescriptor> wfList=readStandardFragments(descriptor,archive);
  if (isProcessAnnotation(descriptor)) {
    Map<ExtensionsArchivist,RootDeploymentDescriptor> localExtensions=new HashMap<ExtensionsArchivist,RootDeploymentDescriptor>();
    for (    WebFragmentDescriptor wfDesc : wfList) {
      super.readAnnotations(archive,wfDesc,localExtensions);
    }
    ModuleScanner scanner=getScanner();
    if (scanner instanceof WarScanner) {
      ((WarScanner)scanner).setScanOtherLibraries(true);
      readAnnotations(archive,descriptor,localExtensions,scanner);
    }
  }
  WebFragmentDescriptor mergedWebFragment=null;
  for (  WebFragmentDescriptor wf : wfList) {
    if (mergedWebFragment == null) {
      if (wf.isExists()) {
        mergedWebFragment=wf;
      }
    }
 else {
      mergedWebFragment.addWebBundleDescriptor(wf);
    }
  }
  if (mergedWebFragment != null) {
    descriptor.addWebBundleDescriptor(mergedWebFragment);
  }
  WebBundleDescriptorImpl defaultWebBundleDescriptor=getPlainDefaultWebXmlBundleDescriptor();
  descriptor.addDefaultWebBundleDescriptor(defaultWebBundleDescriptor);
}
Program: 28176
Project: 28176
Buggy source:
/** 
 * Entry point from the framework into the command execution
 * @param context context for the command.
 */
public void execute(AdminCommandContext context){
  final ActionReport report=context.getActionReport();
  ActionReport.MessagePart part=report.getTopMessagePart();
  ApplicationInfo appInfo=appRegistry.get(appname);
  if (appInfo != null) {
    Application app=appInfo.getMetaData(Application.class);
    if (app != null) {
      BundleDescriptor bundleDesc=app.getModuleByUri(modulename);
      if (bundleDesc != null && bundleDesc instanceof WebBundleDescriptor) {
        String contextRoot=((WebBundleDescriptor)bundleDesc).getContextRoot();
        part.addProperty(DeploymentProperties.CONTEXT_ROOT,contextRoot);
        part.setMessage(contextRoot);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Entry point from the framework into the command execution
 * @param context context for the command.
 */
public void execute(AdminCommandContext context){
  final ActionReport report=context.getActionReport();
  ActionReport.MessagePart part=report.getTopMessagePart();
  ApplicationInfo appInfo=appRegistry.get(appname);
  if (appInfo != null) {
    Application app=appInfo.getMetaData(Application.class);
    if (app != null) {
      int versionSuffix=modulename.indexOf(':');
      String versionLessModuleName=versionSuffix > 0 ? modulename.substring(0,versionSuffix) : modulename;
      BundleDescriptor bundleDesc=app.getModuleByUri(versionLessModuleName);
      if (bundleDesc != null && bundleDesc instanceof WebBundleDescriptor) {
        String contextRoot=((WebBundleDescriptor)bundleDesc).getContextRoot();
        part.addProperty(DeploymentProperties.CONTEXT_ROOT,contextRoot);
        part.setMessage(contextRoot);
      }
    }
  }
}
Program: 28182
Project: 28182
Buggy source:
@Override public void undeploy(String appName,String... params) throws GlassFishException {
  String[] newParams=new String[params.length + 1];
  System.arraycopy(params,0,newParams,0,params.length);
  newParams[params.length]=appName;
  CommandExecutorImpl executer=habitat.getService(CommandExecutorImpl.class);
  try {
    ActionReport actionReport=executer.executeCommand("String_Node_Str",newParams);
    actionReport.writeReport(System.out);
  }
 catch (  CommandException e) {
    throw new GlassFishException(e);
  }
catch (  IOException e) {
    throw new GlassFishException(e);
  }
}

Fixed version (ground truth):
@Override public void undeploy(String appName,String... params) throws GlassFishException {
  String[] newParams=new String[params.length + 1];
  System.arraycopy(params,0,newParams,0,params.length);
  newParams[params.length]=appName;
  CommandExecutorImpl executer=habitat.getService(CommandExecutorImpl.class);
  try {
    ActionReport actionReport=executer.executeCommand("String_Node_Str",newParams);
    if (actionReport.hasSuccesses()) {
      logger.log(Level.INFO,"String_Node_Str",appName);
    }
  }
 catch (  CommandException e) {
    throw new GlassFishException(e);
  }
}
Program: 28194
Project: 28194
Buggy source:
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  SQLTraceRecord record=new SQLTraceRecord();
  record.setMethodName(method.getName());
  record.setParams(args);
  record.setClassName(actualObject.getClass().getName());
  record.setThreadName(Thread.currentThread().getName());
  record.setThreadID(Thread.currentThread().getId());
  record.setTimeStamp(System.currentTimeMillis());
  sqlTraceDelegator.sqlTrace(record);
  return method.invoke(actualObject,args);
}

Fixed version (ground truth):
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  SQLTraceRecord record=new SQLTraceRecord();
  record.setMethodName(method.getName());
  record.setParams(args);
  record.setClassName(actualObject.getClass().getName());
  record.setThreadName(Thread.currentThread().getName());
  record.setThreadID(Thread.currentThread().getId());
  record.setTimeStamp(System.currentTimeMillis());
  sqlTraceDelegator.sqlTrace(record);
  try {
    return method.invoke(actualObject,args);
  }
 catch (  InvocationTargetException ex) {
    Throwable cause=ex.getCause();
    if (cause != null) {
      throw cause;
    }
 else {
      throw ex;
    }
  }
}
Program: 28195
Project: 28195
Buggy source:
private <T>T getProxyObject(final Object actualObject,Class<T>[] ifaces) throws Exception {
  T result;
  InvocationHandler ih=new InvocationHandler(){
    public Object invoke(    Object proxy,    Method method,    Object[] args) throws Throwable {
      SQLTraceRecord record=new SQLTraceRecord();
      record.setMethodName(method.getName());
      record.setParams(args);
      record.setClassName(actualObject.getClass().getName());
      record.setThreadName(Thread.currentThread().getName());
      record.setThreadID(Thread.currentThread().getId());
      record.setTimeStamp(System.currentTimeMillis());
      sqlTraceDelegator.sqlTrace(record);
      return method.invoke(actualObject,args);
    }
  }
;
  result=(T)Proxy.newProxyInstance(actualObject.getClass().getClassLoader(),ifaces,ih);
  return result;
}

Fixed version (ground truth):
private <T>T getProxyObject(final Object actualObject,Class<T>[] ifaces) throws Exception {
  T result;
  InvocationHandler ih=new InvocationHandler(){
    public Object invoke(    Object proxy,    Method method,    Object[] args) throws Throwable {
      SQLTraceRecord record=new SQLTraceRecord();
      record.setMethodName(method.getName());
      record.setParams(args);
      record.setClassName(actualObject.getClass().getName());
      record.setThreadName(Thread.currentThread().getName());
      record.setThreadID(Thread.currentThread().getId());
      record.setTimeStamp(System.currentTimeMillis());
      sqlTraceDelegator.sqlTrace(record);
      try {
        return method.invoke(actualObject,args);
      }
 catch (      InvocationTargetException ex) {
        Throwable cause=ex.getCause();
        if (cause != null) {
          throw cause;
        }
 else {
          throw ex;
        }
      }
    }
  }
;
  result=(T)Proxy.newProxyInstance(actualObject.getClass().getClassLoader(),ifaces,ih);
  return result;
}
Program: 28196
Project: 28196
Buggy source:
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  SQLTraceRecord record=new SQLTraceRecord();
  record.setMethodName(method.getName());
  record.setParams(args);
  record.setClassName(actualObject.getClass().getName());
  record.setThreadName(Thread.currentThread().getName());
  record.setThreadID(Thread.currentThread().getId());
  record.setTimeStamp(System.currentTimeMillis());
  sqlTraceDelegator.sqlTrace(record);
  return method.invoke(actualObject,args);
}

Fixed version (ground truth):
public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  SQLTraceRecord record=new SQLTraceRecord();
  record.setMethodName(method.getName());
  record.setParams(args);
  record.setClassName(actualObject.getClass().getName());
  record.setThreadName(Thread.currentThread().getName());
  record.setThreadID(Thread.currentThread().getId());
  record.setTimeStamp(System.currentTimeMillis());
  sqlTraceDelegator.sqlTrace(record);
  try {
    return method.invoke(actualObject,args);
  }
 catch (  InvocationTargetException ex) {
    Throwable cause=ex.getCause();
    if (cause != null) {
      throw cause;
    }
 else {
      throw ex;
    }
  }
}
Program: 28197
Project: 28197
Buggy source:
private <T>T getProxyObject(final Object actualObject,Class<T>[] ifaces) throws Exception {
  T result;
  InvocationHandler ih=new InvocationHandler(){
    public Object invoke(    Object proxy,    Method method,    Object[] args) throws Throwable {
      SQLTraceRecord record=new SQLTraceRecord();
      record.setMethodName(method.getName());
      record.setParams(args);
      record.setClassName(actualObject.getClass().getName());
      record.setThreadName(Thread.currentThread().getName());
      record.setThreadID(Thread.currentThread().getId());
      record.setTimeStamp(System.currentTimeMillis());
      sqlTraceDelegator.sqlTrace(record);
      return method.invoke(actualObject,args);
    }
  }
;
  result=(T)Proxy.newProxyInstance(actualObject.getClass().getClassLoader(),ifaces,ih);
  return result;
}

Fixed version (ground truth):
private <T>T getProxyObject(final Object actualObject,Class<T>[] ifaces) throws Exception {
  T result;
  InvocationHandler ih=new InvocationHandler(){
    public Object invoke(    Object proxy,    Method method,    Object[] args) throws Throwable {
      SQLTraceRecord record=new SQLTraceRecord();
      record.setMethodName(method.getName());
      record.setParams(args);
      record.setClassName(actualObject.getClass().getName());
      record.setThreadName(Thread.currentThread().getName());
      record.setThreadID(Thread.currentThread().getId());
      record.setTimeStamp(System.currentTimeMillis());
      sqlTraceDelegator.sqlTrace(record);
      try {
        return method.invoke(actualObject,args);
      }
 catch (      InvocationTargetException ex) {
        Throwable cause=ex.getCause();
        if (cause != null) {
          throw cause;
        }
 else {
          throw ex;
        }
      }
    }
  }
;
  result=(T)Proxy.newProxyInstance(actualObject.getClass().getClassLoader(),ifaces,ih);
  return result;
}
Program: 28198
Project: 28198
Buggy source:
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  int length=in.readInt();
  data=new byte[length];
  in.read(data,0,length);
}

Fixed version (ground truth):
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
  int length=in.readInt();
  data=new byte[length];
  in.readFully(data,0,length);
}
Program: 28199
Project: 28199
Buggy source:
@Override public boolean isActive(){
  try {
    if (getTransactionSynchronizationRegistry() != null) {
      return true;
    }
  }
 catch (  ContextNotActiveException ignore) {
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean isActive(){
  try {
    getTransactionSynchronizationRegistry();
    return true;
  }
 catch (  ContextNotActiveException ignore) {
  }
  return false;
}
Program: 28200
Project: 28200
Buggy source:
private HandlerProcessingResult processAnnotations(ProcessingContext ctx,AnnotatedElement element) throws AnnotationProcessorException {
  HandlerProcessingResultImpl result=new HandlerProcessingResultImpl();
  try {
    for (    Annotation annotation : element.getAnnotations()) {
      AnnotationInfo subElement=new AnnotationInfo(ctx,element,annotation,getTopElementType());
      if (!result.processedAnnotations().containsKey(annotation.annotationType())) {
        process(ctx,subElement,result);
      }
 else {
        if (AnnotationUtils.shouldLog("String_Node_Str")) {
          logger.finer("String_Node_Str" + annotation.annotationType() + "String_Node_Str");
        }
      }
    }
  }
 catch (  Exception tnpe) {
    logger.info("String_Node_Str" + element + "String_Node_Str"+ tnpe.toString()+ "String_Node_Str");
    logger.log(Level.FINE,"String_Node_Str",tnpe);
  }
  return result;
}

Fixed version (ground truth):
private HandlerProcessingResult processAnnotations(ProcessingContext ctx,AnnotatedElement element) throws AnnotationProcessorException {
  HandlerProcessingResultImpl result=new HandlerProcessingResultImpl();
  try {
    for (    Annotation annotation : element.getAnnotations()) {
      AnnotationInfo subElement=new AnnotationInfo(ctx,element,annotation,getTopElementType());
      if (!result.processedAnnotations().containsKey(annotation.annotationType())) {
        process(ctx,subElement,result);
      }
 else {
        if (AnnotationUtils.shouldLog("String_Node_Str")) {
          logger.finer("String_Node_Str" + annotation.annotationType() + "String_Node_Str");
        }
      }
    }
  }
 catch (  ArrayStoreException e) {
    logger.info("String_Node_Str" + e.toString() + "String_Node_Str"+ element+ "String_Node_Str"+ e.getMessage()+ "String_Node_Str");
  }
  return result;
}
Program: 28201
Project: 28201
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnAcquired(){
  return numConnAcquired.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnAcquired(){
  return numConnAcquired;
}
Program: 28202
Project: 28202
Buggy source:
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getNumConnUsed(){
  return numConnUsed.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getNumConnUsed(){
  return numConnUsed;
}
Program: 28203
Project: 28203
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnReleased(){
  return numConnReleased.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnReleased(){
  return numConnReleased;
}
Program: 28204
Project: 28204
Buggy source:
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getNumConnUsed(){
  return numConnUsed.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getNumConnUsed(){
  return numConnUsed;
}
Program: 28205
Project: 28205
Buggy source:
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getConnRequestWaitTime(){
  return connRequestWaitTime.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getConnRequestWaitTime(){
  return connRequestWaitTime;
}
Program: 28206
Project: 28206
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnAcquired(){
  return numConnAcquired.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnAcquired(){
  return numConnAcquired;
}
Program: 28207
Project: 28207
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnReleased(){
  return numConnReleased.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnReleased(){
  return numConnReleased;
}
Program: 28208
Project: 28208
Buggy source:
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getNumConnFree(){
  return numConnFree.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public RangeStatistic getNumConnFree(){
  return numConnFree;
}
Program: 28209
Project: 28209
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnCreated(){
  return numConnCreated.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnCreated(){
  return numConnCreated;
}
Program: 28210
Project: 28210
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnDestroyed(){
  return numConnDestroyed.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnDestroyed(){
  return numConnDestroyed;
}
Program: 28211
Project: 28211
Buggy source:
/** 
 * When a connection leak is observed, the monitoring statistics are displayed to the server.log. This method helps in segregating the statistics based on LOW/HIGH monitoring levels and displaying them.
 * @param poolName
 * @param stackTrace
 */
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumPotentialConnLeakCount(){
  return numPotentialConnLeak.getStatistic();
}

Fixed version (ground truth):
/** 
 * When a connection leak is observed, the monitoring statistics are displayed to the server.log. This method helps in segregating the statistics based on LOW/HIGH monitoring levels and displaying them.
 * @param poolName
 * @param stackTrace
 */
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumPotentialConnLeakCount(){
  return numPotentialConnLeak;
}
Program: 28212
Project: 28212
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnTimedOut(){
  return numConnTimedOut.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnTimedOut(){
  return numConnTimedOut;
}
Program: 28213
Project: 28213
Buggy source:
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnFailedValidation(){
  return numConnFailedValidation.getStatistic();
}

Fixed version (ground truth):
@ManagedAttribute(id="String_Node_Str") public CountStatistic getNumConnFailedValidation(){
  return numConnFailedValidation;
}
Program: 28214
Project: 28214
Buggy source:
/** 
 * Set the default schema JBATCH or the schema defined in batch-config on the connection object.
 * @param connection
 * @throws SQLException
 */
protected void setSchemaOnConnection(Connection connection) throws SQLException {
  logger.finest("String_Node_Str" + CLASSNAME + "String_Node_Str");
  PreparedStatement ps=null;
  ps=connection.prepareStatement(queryStrings.get(Q_SET_SCHEMA));
  ps.setString(1,schema);
  ps.executeUpdate();
  ps.close();
  logger.finest("String_Node_Str" + CLASSNAME + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Set the default schema JBATCH or the schema defined in batch-config on the connection object.
 * @param connection
 * @throws SQLException
 */
protected void setSchemaOnConnection(Connection connection) throws SQLException {
  logger.finest("String_Node_Str" + CLASSNAME + "String_Node_Str");
  String productname=connection.getMetaData().getDatabaseProductName();
  if (!(productname.contains("String_Node_Str"))) {
    PreparedStatement ps=null;
    ps=connection.prepareStatement(queryStrings.get(Q_SET_SCHEMA));
    ps.setString(1,schema);
    ps.executeUpdate();
    ps.close();
  }
  logger.finest("String_Node_Str" + CLASSNAME + "String_Node_Str");
}
Program: 28215
Project: 28215
Buggy source:
@Override public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
  logger.config("String_Node_Str" + batchConfig);
  this.batchConfig=batchConfig;
  schema=batchConfig.getDatabaseConfigurationBean().getSchema();
  jndiName=batchConfig.getDatabaseConfigurationBean().getJndiName();
  tableNames=getTableMap(batchConfig);
  queryStrings=getQueryMap(batchConfig);
  createTableStrings=setCreateTableMap(batchConfig);
  createIndexStrings=setCreateIndexMap(batchConfig);
  logger.config("String_Node_Str" + jndiName);
  if (jndiName == null || jndiName.equals("String_Node_Str")) {
    throw new BatchContainerServiceException("String_Node_Str");
  }
  try {
    Context ctx=new InitialContext();
    dataSource=(DataSource)ctx.lookup(jndiName);
  }
 catch (  NamingException e) {
    logger.severe("String_Node_Str" + jndiName + "String_Node_Str");
    throw new BatchContainerServiceException(e);
  }
  try {
    if (isOracle()) {
      if (!isSchemaValid()) {
        createSchema();
      }
      checkOracleTables();
    }
  }
 catch (  SQLException e) {
    logger.severe(e.getLocalizedMessage());
    throw new BatchContainerServiceException(e);
  }
  logger.config("String_Node_Str");
}

Fixed version (ground truth):
@Override public void init(IBatchConfig batchConfig) throws BatchContainerServiceException {
  logger.config("String_Node_Str" + batchConfig);
  this.batchConfig=batchConfig;
  schema=batchConfig.getDatabaseConfigurationBean().getSchema();
  jndiName=batchConfig.getDatabaseConfigurationBean().getJndiName();
  tableNames=getTableMap(batchConfig);
  queryStrings=getQueryMap(batchConfig);
  logger.config("String_Node_Str" + jndiName);
  if (jndiName == null || jndiName.equals("String_Node_Str")) {
    throw new BatchContainerServiceException("String_Node_Str");
  }
  try {
    Context ctx=new InitialContext();
    dataSource=(DataSource)ctx.lookup(jndiName);
  }
 catch (  NamingException e) {
    logger.severe("String_Node_Str" + jndiName + "String_Node_Str");
    throw new BatchContainerServiceException(e);
  }
  try {
    if (isOracle()) {
      if (!isSchemaValid()) {
        createSchema();
      }
      checkOracleTables();
    }
  }
 catch (  SQLException e) {
    logger.severe(e.getLocalizedMessage());
    throw new BatchContainerServiceException(e);
  }
  logger.config("String_Node_Str");
}
Program: 28217
Project: 28217
Buggy source:
/** 
 * Check if the derby jbatch tables exist, if not create them 
 */
private void checkDerbyTables() throws SQLException {
  createDerbyTableNotExists(tableNames.get(CHECKPOINT_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_CHECKPOINTDATA));
  createDerbyTableNotExists(tableNames.get(JOB_INSTANCE_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_JOBINSTANCEDATA));
  createDerbyTableNotExists(tableNames.get(EXECUTION_INSTANCE_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_EXECUTIONINSTANCEDATA));
  createDerbyTableNotExists(tableNames.get(STEP_EXECUTION_INSTANCE_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_STEPINSTANCEDATA));
  createDerbyTableNotExists(tableNames.get(JOB_STATUS_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_JOBSTATUS));
  createDerbyTableNotExists(tableNames.get(STEP_STATUS_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_STEPSTATUS));
}

Fixed version (ground truth):
/** 
 * Check if the derby jbatch tables exist, if not create them 
 */
private void checkDerbyTables() throws SQLException {
  setCreateDerbyStringsMap(batchConfig);
  createDerbyTableNotExists(tableNames.get(CHECKPOINT_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_CHECKPOINTDATA));
  createDerbyTableNotExists(tableNames.get(JOB_INSTANCE_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_JOBINSTANCEDATA));
  createDerbyTableNotExists(tableNames.get(EXECUTION_INSTANCE_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_EXECUTIONINSTANCEDATA));
  createDerbyTableNotExists(tableNames.get(STEP_EXECUTION_INSTANCE_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_STEPINSTANCEDATA));
  createDerbyTableNotExists(tableNames.get(JOB_STATUS_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_JOBSTATUS));
  createDerbyTableNotExists(tableNames.get(STEP_STATUS_TABLE_KEY),createDerbyStrings.get(DERBY_CREATE_TABLE_STEPSTATUS));
}
Program: 28218
Project: 28218
Buggy source:
@Override public JobInstance createJobInstance(String name,String apptag,String jobXml){
  Connection conn=null;
  PreparedStatement statement=null;
  ResultSet rs=null;
  JobInstanceImpl jobInstance=null;
  try {
    conn=getConnection();
    if (conn.getMetaData().getDatabaseProductName().contains("String_Node_Str")) {
      statement=conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE));
    }
 else     if (conn.getMetaData().getDatabaseProductName().contains("String_Node_Str") || conn.getMetaData().getDatabaseProductName().contains("String_Node_Str")) {
      statement=conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE),new String[]{"String_Node_Str"});
    }
 else     if (conn.getMetaData().getDatabaseProductName().contains("String_Node_Str") || conn.getMetaData().getDatabaseProductName().contains("String_Node_Str")) {
      statement=conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE),new String[]{"String_Node_Str"});
    }
    statement.setString(1,name);
    statement.setString(2,apptag);
    rs=statement.getGeneratedKeys();
    if (rs.next()) {
      long jobInstanceID=rs.getLong(1);
      jobInstance=new JobInstanceImpl(jobInstanceID,jobXml);
      jobInstance.setJobName(name);
    }
  }
 catch (  SQLException e) {
    throw new PersistenceException(e);
  }
 finally {
    cleanupConnection(conn,rs,statement);
  }
  return jobInstance;
}

Fixed version (ground truth):
@Override public JobInstance createJobInstance(String name,String apptag,String jobXml){
  Connection conn=null;
  PreparedStatement statement=null;
  ResultSet rs=null;
  JobInstanceImpl jobInstance=null;
  try {
    conn=getConnection();
    if (conn.getMetaData().getDatabaseProductName().contains("String_Node_Str")) {
      statement=conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE));
    }
 else     if (conn.getMetaData().getDatabaseProductName().contains("String_Node_Str") || conn.getMetaData().getDatabaseProductName().contains("String_Node_Str")) {
      statement=conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE),new String[]{"String_Node_Str"});
    }
 else     if (conn.getMetaData().getDatabaseProductName().contains("String_Node_Str") || conn.getMetaData().getDatabaseProductName().contains("String_Node_Str")) {
      statement=conn.prepareStatement(queryStrings.get(CREATE_JOB_INSTANCE),new String[]{"String_Node_Str"});
    }
    statement.setString(1,name);
    statement.setString(2,apptag);
    statement.executeUpdate();
    rs=statement.getGeneratedKeys();
    if (rs.next()) {
      long jobInstanceID=rs.getLong(1);
      jobInstance=new JobInstanceImpl(jobInstanceID,jobXml);
      jobInstance.setJobName(name);
    }
  }
 catch (  SQLException e) {
    throw new PersistenceException(e);
  }
 finally {
    cleanupConnection(conn,rs,statement);
  }
  return jobInstance;
}
Program: 28220
Project: 28220
Buggy source:
private Handler(final MBeanServer mbs,final boolean isInstance,final BootAMX bootAMX){
  this.mBeanServer=mbs;
  this.isInstance=isInstance;
  this.bootAMX=bootAMX;
}

Fixed version (ground truth):
private Handler(final MBeanServer mbs,final boolean isInstance){
  this.mBeanServer=mbs;
  this.isInstance=isInstance;
}
Program: 28221
Project: 28221
Buggy source:
/** 
 * Returns an MBeanServer that will check security and then forward requests to the real MBeanServer.
 * @param mbs the real MBeanServer to which to delegate
 * @return the security-checking wrapper around the MBeanServer
 */
public static MBeanServerForwarder newInstance(final MBeanServer mbs,final boolean isInstance,final BootAMX bootAMX){
  final AdminAuthorizedMBeanServer.Handler handler=new AdminAuthorizedMBeanServer.Handler(mbs,isInstance,bootAMX);
  return (MBeanServerForwarder)Proxy.newProxyInstance(MBeanServerForwarder.class.getClassLoader(),new Class[]{MBeanServerForwarder.class},handler);
}

Fixed version (ground truth):
/** 
 * Returns an MBeanServer that will check security and then forward requests to the real MBeanServer.
 * @param mbs the real MBeanServer to which to delegate
 * @return the security-checking wrapper around the MBeanServer
 */
public static MBeanServerForwarder newInstance(final MBeanServer mbs,final boolean isInstance,final BootAMX bootAMX){
  final AdminAuthorizedMBeanServer.Handler handler=new AdminAuthorizedMBeanServer.Handler(mbs,isInstance);
  return (MBeanServerForwarder)Proxy.newProxyInstance(MBeanServerForwarder.class.getClassLoader(),new Class[]{MBeanServerForwarder.class},handler);
}
Program: 28222
Project: 28222
Buggy source:
void launchInstance() throws GFLauncherException, MiniXmlParserException {
  if (isFakeLaunch()) {
    return;
  }
  List<String> cmds=null;
  if ((OS.isDarwin() && (!getInfo().isVerboseOrWatchdog()))) {
    cmds=new ArrayList<String>();
    cmds.add("String_Node_Str");
    cmds.addAll(getCommandLine());
  }
 else {
    cmds=getCommandLine();
  }
  ProcessBuilder pb=new ProcessBuilder(cmds);
  try {
    File newDir=getInfo().getConfigDir();
    pb.directory(newDir);
  }
 catch (  Exception e) {
  }
  try {
    closeStandardStreamsMaybe();
    process=pb.start();
    final String name=getInfo().getDomainName();
    if (getInfo().isVerbose()) {
      psd=ProcessStreamDrainer.redirect(name,process);
    }
 else     if (getInfo().isWatchdog()) {
      psd=ProcessStreamDrainer.dispose(name,process);
    }
 else {
      psd=ProcessStreamDrainer.save(name,process);
    }
    writeSecurityTokens(process);
  }
 catch (  Exception e) {
    throw new GFLauncherException("String_Node_Str",e,e);
  }
  if (getInfo().isVerboseOrWatchdog())   wait(process);
}

Fixed version (ground truth):
void launchInstance() throws GFLauncherException, MiniXmlParserException {
  if (isFakeLaunch()) {
    return;
  }
  List<String> cmds=null;
  if ((OS.isDarwin() && (!getInfo().isVerboseOrWatchdog()))) {
    cmds=new ArrayList<String>();
    cmds.add("String_Node_Str");
    cmds.add("String_Node_Str");
    cmds.add("String_Node_Str");
    cmds.addAll(getCommandLine());
  }
 else {
    cmds=getCommandLine();
  }
  ProcessBuilder pb=new ProcessBuilder(cmds);
  try {
    File newDir=getInfo().getConfigDir();
    pb.directory(newDir);
  }
 catch (  Exception e) {
  }
  try {
    closeStandardStreamsMaybe();
    process=pb.start();
    final String name=getInfo().getDomainName();
    if (getInfo().isVerbose()) {
      psd=ProcessStreamDrainer.redirect(name,process);
    }
 else     if (getInfo().isWatchdog()) {
      psd=ProcessStreamDrainer.dispose(name,process);
    }
 else {
      psd=ProcessStreamDrainer.save(name,process);
    }
    writeSecurityTokens(process);
  }
 catch (  Exception e) {
    throw new GFLauncherException("String_Node_Str",e,e);
  }
  if (getInfo().isVerboseOrWatchdog())   wait(process);
}
Program: 28223
Project: 28223
Buggy source:
private TransactedJMSContextManager getTransactedManager(){
  if (transactedManager == null) {
synchronized (this) {
      if (transactedManager != null)       return transactedManager;
      transactedManager=tm.get();
    }
  }
  return transactedManager;
}

Fixed version (ground truth):
private synchronized TransactedJMSContextManager getTransactedManager(){
  if (transactedManager == null)   transactedManager=tm.get();
  return transactedManager;
}
Program: 28224
Project: 28224
Buggy source:
/** 
 * Destroy the contextual instance.
 */
@Override public void afterCompletion(int i){
  try {
    TransactionSynchronizationRegistry transactionSynchronizationRegistry=getTransactionSynchronizationRegistry();
    if (transactionSynchronizationRegistry != null) {
      Set<TransactionScopedBean> transactionScopedBeanSet;
      if (transactionScopedContext != null) {
        if (transactionScopedContext.beansPerTransaction.get(transactionSynchronizationRegistry) != null) {
          transactionScopedBeanSet=transactionScopedContext.beansPerTransaction.get(transactionSynchronizationRegistry);
          if (transactionScopedBeanSet.contains(this)) {
            transactionScopedBeanSet.remove(this);
          }
          if (transactionScopedBeanSet.size() == 0) {
            TransactionScopedCDIUtil.fireEvent(TransactionScopedCDIUtil.DESTORYED_EVENT);
            transactionScopedContext.beansPerTransaction.remove(transactionSynchronizationRegistry);
          }
 else {
            transactionScopedContext.beansPerTransaction.put(transactionSynchronizationRegistry,transactionScopedBeanSet);
          }
        }
      }
    }
  }
 catch (  NamingException ne) {
    TransactionScopedCDIUtil.log("String_Node_Str");
    ne.printStackTrace();
  }
 finally {
    contextual.destroy(contextualInstance,creationalContext);
  }
}

Fixed version (ground truth):
/** 
 * Destroy the contextual instance.
 */
@Override public void afterCompletion(int i){
  try {
    TransactionSynchronizationRegistry transactionSynchronizationRegistry=getTransactionSynchronizationRegistry();
    if (transactionSynchronizationRegistry != null) {
      if (transactionScopedContext != null) {
        Set<TransactionScopedBean> transactionScopedBeanSet=transactionScopedContext.beansPerTransaction.get(transactionSynchronizationRegistry);
        if (transactionScopedBeanSet != null) {
          if (transactionScopedBeanSet.contains(this)) {
            transactionScopedBeanSet.remove(this);
          }
          if (transactionScopedBeanSet.size() == 0) {
            TransactionScopedCDIUtil.fireEvent(TransactionScopedCDIUtil.DESTORYED_EVENT);
            transactionScopedContext.beansPerTransaction.remove(transactionSynchronizationRegistry);
          }
        }
      }
    }
  }
 catch (  NamingException ne) {
    TransactionScopedCDIUtil.log("String_Node_Str");
    ne.printStackTrace();
  }
 finally {
    contextual.destroy(contextualInstance,creationalContext);
  }
}