Program: 34941
Project: 34941
Buggy source:
@Override public void onPrepareProviderResource(BeanCustomizerContext context){
  EndpointInfo endpointInfo=context.getEndpointInfo();
  Set<ProviderResourceInfo> perRequestProviderAndPathInfos=endpointInfo.getPerRequestProviderAndPathInfos();
  Set<ProviderResourceInfo> singletonProviderAndPathInfos=endpointInfo.getSingletonProviderAndPathInfos();
  Map<Class<?>,ManagedObject<?>> resourcesManagedbyCDI=new HashMap<Class<?>,ManagedObject<?>>();
  CXFJaxRsProviderResourceHolder cxfPRHolder=context.getCxfRPHolder();
  for (  ProviderResourceInfo p : perRequestProviderAndPathInfos) {
    if (p.getRuntimeType() != RuntimeType.POJO)     continue;
    Class<?> clazz=p.getProviderResourceClass();
    if (!hasValidConstructor(clazz,false)) {
      continue;
    }
    Bean<?> bean=null;
    try {
      bean=getBeanFromCDI(clazz);
    }
 catch (    Exception e1) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str",e1);
      }
    }
    if (bean != null) {
      String scopeName=bean.getScope().getName();
      p.setRuntimeType(RuntimeType.CDI);
      resourcesManagedbyCDI.put(p.getProviderResourceClass(),null);
      if (p.isJaxRsProvider()) {
        if (validSingletonScopeList.contains(scopeName)) {
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
 else {
          p.setRuntimeType(RuntimeType.POJO);
          resourcesManagedbyCDI.remove(p.getProviderResourceClass());
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
      }
 else {
        if (!validRequestScopeList.contains(scopeName)) {
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),"String_Node_Str",scopeName,"String_Node_Str");
        }
      }
    }
 else {
      if (shouldHandle(clazz,false)) {
        p.setRuntimeType(RuntimeType.IMPLICITBEAN);
        resourcesManagedbyCDI.put(clazz,null);
      }
      continue;
    }
  }
  for (  ProviderResourceInfo o : singletonProviderAndPathInfos) {
    if (o.getRuntimeType() != RuntimeType.POJO)     continue;
    Class<?> clazz=o.getProviderResourceClass();
    if (!hasValidConstructor(clazz,true)) {
      continue;
    }
    Bean<?> bean=null;
    try {
      bean=getBeanFromCDI(clazz);
    }
 catch (    Exception e1) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str",e1);
      }
    }
    if (bean != null) {
      String scopeName=bean.getScope().getName();
      o.setRuntimeType(RuntimeType.CDI);
      resourcesManagedbyCDI.put(o.getProviderResourceClass(),null);
      if (o.isJaxRsProvider()) {
        if (validSingletonScopeList.contains(scopeName)) {
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
 else {
          o.setRuntimeType(RuntimeType.POJO);
          resourcesManagedbyCDI.remove(clazz);
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
      }
 else {
        if (!validSingletonScopeList.contains(scopeName)) {
          cxfPRHolder.removeResouceProvider(clazz);
          cxfPRHolder.addResouceProvider(clazz,new PerRequestResourceProvider(clazz));
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),"String_Node_Str",scopeName,"String_Node_Str");
        }
      }
    }
 else {
      if (shouldHandle(clazz,false)) {
        o.setRuntimeType(RuntimeType.IMPLICITBEAN);
        resourcesManagedbyCDI.put(clazz,null);
      }
      continue;
    }
  }
  context.setContextObject(resourcesManagedbyCDI);
}

Fixed version (ground truth):
@Override public void onPrepareProviderResource(BeanCustomizerContext context){
  EndpointInfo endpointInfo=context.getEndpointInfo();
  Set<ProviderResourceInfo> perRequestProviderAndPathInfos=endpointInfo.getPerRequestProviderAndPathInfos();
  Set<ProviderResourceInfo> singletonProviderAndPathInfos=endpointInfo.getSingletonProviderAndPathInfos();
  Map<Class<?>,ManagedObject<?>> resourcesManagedbyCDI=new ThreadBasedHashMap();
  CXFJaxRsProviderResourceHolder cxfPRHolder=context.getCxfRPHolder();
  for (  ProviderResourceInfo p : perRequestProviderAndPathInfos) {
    if (p.getRuntimeType() != RuntimeType.POJO)     continue;
    Class<?> clazz=p.getProviderResourceClass();
    if (!hasValidConstructor(clazz,false)) {
      continue;
    }
    Bean<?> bean=null;
    try {
      bean=getBeanFromCDI(clazz);
    }
 catch (    Exception e1) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str",e1);
      }
    }
    if (bean != null) {
      String scopeName=bean.getScope().getName();
      p.setRuntimeType(RuntimeType.CDI);
      resourcesManagedbyCDI.put(p.getProviderResourceClass(),null);
      if (p.isJaxRsProvider()) {
        if (validSingletonScopeList.contains(scopeName)) {
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
 else {
          p.setRuntimeType(RuntimeType.POJO);
          resourcesManagedbyCDI.remove(p.getProviderResourceClass());
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
      }
 else {
        if (!validRequestScopeList.contains(scopeName)) {
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),"String_Node_Str",scopeName,"String_Node_Str");
        }
      }
    }
 else {
      if (shouldHandle(clazz,false)) {
        p.setRuntimeType(RuntimeType.IMPLICITBEAN);
        resourcesManagedbyCDI.put(clazz,null);
      }
      continue;
    }
  }
  for (  ProviderResourceInfo o : singletonProviderAndPathInfos) {
    if (o.getRuntimeType() != RuntimeType.POJO)     continue;
    Class<?> clazz=o.getProviderResourceClass();
    if (!hasValidConstructor(clazz,true)) {
      continue;
    }
    Bean<?> bean=null;
    try {
      bean=getBeanFromCDI(clazz);
    }
 catch (    Exception e1) {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
        Tr.debug(tc,"String_Node_Str",e1);
      }
    }
    if (bean != null) {
      String scopeName=bean.getScope().getName();
      o.setRuntimeType(RuntimeType.CDI);
      resourcesManagedbyCDI.put(o.getProviderResourceClass(),null);
      if (o.isJaxRsProvider()) {
        if (validSingletonScopeList.contains(scopeName)) {
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
 else {
          o.setRuntimeType(RuntimeType.POJO);
          resourcesManagedbyCDI.remove(clazz);
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),scopeName,"String_Node_Str");
        }
      }
 else {
        if (!validSingletonScopeList.contains(scopeName)) {
          cxfPRHolder.removeResouceProvider(clazz);
          cxfPRHolder.addResouceProvider(clazz,new PerRequestResourceProvider(clazz));
          Tr.warning(tc,"String_Node_Str",clazz.getSimpleName(),"String_Node_Str",scopeName,"String_Node_Str");
        }
      }
    }
 else {
      if (shouldHandle(clazz,false)) {
        o.setRuntimeType(RuntimeType.IMPLICITBEAN);
        resourcesManagedbyCDI.put(clazz,null);
      }
      continue;
    }
  }
  context.setContextObject(resourcesManagedbyCDI);
}