Program: 152932
Project: 152932
Buggy source:
public void serviceChanged(ServiceEvent event){
  ClassLoader tccl=Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(classLoader);
    ServiceReference ref=event.getServiceReference();
    long serviceId=((Long)ref.getProperty(Constants.SERVICE_ID)).longValue();
    Integer rank=(Integer)ref.getProperty(Constants.SERVICE_RANKING);
    int ranking=(rank == null ? 0 : rank.intValue());
    boolean debug=log.isDebugEnabled();
switch (event.getType()) {
case (ServiceEvent.REGISTERED):
case (ServiceEvent.MODIFIED):
{
        if (updateWrapperIfNecessary(ref,serviceId,ranking)) {
          OsgiServiceBindingUtils.callListenersBind(bundleContext,proxy,ref,listeners);
          if (mandatoryListeners != null) {
            for (int i=0; i < mandatoryListeners.size(); i++) {
              if (debug)               log.debug("String_Node_Str");
              ((MandatoryDependencyListener)mandatoryListeners.get(i)).mandatoryDependencySatisfied(new MandatoryDependencyEvent(serviceImporter));
            }
          }
        }
        break;
      }
case (ServiceEvent.UNREGISTERING):
{
      boolean serviceRemoved=false;
synchronized (ServiceDynamicInterceptor.this) {
        if (wrapper != null) {
          if (serviceId == wrapper.getServiceId()) {
            serviceRemoved=true;
            wrapper.cleanup();
          }
        }
      }
      ServiceReference newReference=OsgiServiceReferenceUtils.getServiceReference(bundleContext,(filter == null ? null : filter.toString()));
      if (newReference != null) {
        serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED,newReference));
      }
 else {
        if (serviceRemoved) {
          if (mandatoryListeners != null) {
            for (int i=0; i < mandatoryListeners.size(); i++) {
              if (debug)               log.debug("String_Node_Str");
              ((MandatoryDependencyListener)mandatoryListeners.get(i)).mandatoryDependencyUnsatisfied(new MandatoryDependencyEvent(serviceImporter));
            }
          }
          OsgiServiceBindingUtils.callListenersUnbind(bundleContext,proxy,ref,listeners);
          if (debug) {
            String message="String_Node_Str" + ref + "String_Node_Str";
            if (serviceRemoved) {
              message+="String_Node_Str";
            }
 else {
              message+="String_Node_Str";
            }
            log.debug(message);
          }
        }
      }
      break;
    }
default :
  throw new IllegalArgumentException("String_Node_Str");
}
}
 catch (Throwable e) {
log.fatal("String_Node_Str",e);
}
 finally {
Thread.currentThread().setContextClassLoader(tccl);
}
}

Fixed version (ground truth):
public void serviceChanged(ServiceEvent event){
  ClassLoader tccl=Thread.currentThread().getContextClassLoader();
  try {
    Thread.currentThread().setContextClassLoader(classLoader);
    ServiceReference ref=event.getServiceReference();
    long serviceId=((Long)ref.getProperty(Constants.SERVICE_ID)).longValue();
    Integer rank=(Integer)ref.getProperty(Constants.SERVICE_RANKING);
    int ranking=(rank == null ? 0 : rank.intValue());
    boolean debug=log.isDebugEnabled();
switch (event.getType()) {
case (ServiceEvent.REGISTERED):
case (ServiceEvent.MODIFIED):
{
        if (updateWrapperIfNecessary(ref,serviceId,ranking)) {
          OsgiServiceBindingUtils.callListenersBind(bundleContext,proxy,ref,listeners);
          if (mandatoryListeners != null) {
            for (int i=0; i < mandatoryListeners.size(); i++) {
              if (debug)               log.debug("String_Node_Str");
              ((MandatoryDependencyListener)mandatoryListeners.get(i)).mandatoryDependencySatisfied(new MandatoryDependencyEvent(serviceImporter));
            }
          }
        }
        break;
      }
case (ServiceEvent.UNREGISTERING):
{
      boolean serviceRemoved=false;
      ServiceWrapper oldWrapper=wrapper;
synchronized (ServiceDynamicInterceptor.this) {
        if (wrapper != null) {
          if (serviceId == wrapper.getServiceId()) {
            serviceRemoved=true;
            wrapper=null;
          }
        }
      }
      ServiceReference newReference=OsgiServiceReferenceUtils.getServiceReference(bundleContext,(filter == null ? null : filter.toString()));
      if (newReference != null) {
        serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED,newReference));
      }
 else {
        if (serviceRemoved) {
          wrapper=oldWrapper;
          if (mandatoryListeners != null) {
            for (int i=0; i < mandatoryListeners.size(); i++) {
              if (debug)               log.debug("String_Node_Str");
              ((MandatoryDependencyListener)mandatoryListeners.get(i)).mandatoryDependencyUnsatisfied(new MandatoryDependencyEvent(serviceImporter));
            }
          }
          OsgiServiceBindingUtils.callListenersUnbind(bundleContext,proxy,ref,listeners);
          wrapper=null;
          if (debug) {
            String message="String_Node_Str" + ref + "String_Node_Str";
            if (serviceRemoved) {
              message+="String_Node_Str";
            }
 else {
              message+="String_Node_Str";
            }
            log.debug(message);
          }
        }
      }
      break;
    }
default :
  throw new IllegalArgumentException("String_Node_Str");
}
}
 catch (Throwable e) {
log.fatal("String_Node_Str",e);
}
 finally {
Thread.currentThread().setContextClassLoader(tccl);
}
}