Program: 94169
Project: 94169
Buggy source:
private void postEvent(RemoteServiceAdminEvent event,EndpointDescription endpointDescription){
  int eventType=event.getType();
  String eventTypeName=null;
  String registrationTypeName=null;
switch (eventType) {
case (RemoteServiceAdminEvent.EXPORT_REGISTRATION):
    eventTypeName="String_Node_Str";
  registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.EXPORT_ERROR):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.EXPORT_UNREGISTRATION):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.EXPORT_WARNING):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_REGISTRATION):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_ERROR):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_UNREGISTRATION):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_WARNING):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
}
if (eventTypeName == null) {
logError("String_Node_Str","String_Node_Str" + eventType + "String_Node_Str"+ event+ "String_Node_Str");
return;
}
final String topic="String_Node_Str" + eventTypeName;
Bundle rsaBundle=getRSABundle();
if (rsaBundle == null) {
logError("String_Node_Str","String_Node_Str" + event);
return;
}
final Dictionary eventProperties=new Properties();
eventProperties.put("String_Node_Str",rsaBundle);
eventProperties.put("String_Node_Str",new Long(rsaBundle.getBundleId()));
eventProperties.put("String_Node_Str",rsaBundle.getSymbolicName());
eventProperties.put("String_Node_Str",rsaBundle.getVersion());
List<String> result=new ArrayList<String>();
Map signers1=clientBundle.getSignerCertificates(Bundle.SIGNERS_ALL);
for (Iterator i=signers1.keySet().iterator(); i.hasNext(); ) result.add(i.next().toString());
String[] signers=(String[])result.toArray(new String[result.size()]);
if (signers != null && signers.length > 0) eventProperties.put("String_Node_Str",signers);
Throwable t=event.getException();
if (t != null) {
eventProperties.put("String_Node_Str",t);
eventProperties.put("String_Node_Str",t);
eventProperties.put("String_Node_Str",t.getClass().getName());
String exceptionMessage=t.getMessage();
if (exceptionMessage != null) eventProperties.put("String_Node_Str",exceptionMessage);
}
long serviceId=endpointDescription.getServiceId();
if (serviceId != 0) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID,new Long(serviceId));
String frameworkUUID=endpointDescription.getFrameworkUUID();
if (frameworkUUID != null) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID,frameworkUUID);
String endpointId=endpointDescription.getId();
if (endpointId != null) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID,endpointId);
List<String> interfaces=endpointDescription.getInterfaces();
if (interfaces != null && interfaces.size() > 0) eventProperties.put(org.osgi.framework.Constants.OBJECTCLASS,interfaces.toArray(new String[interfaces.size()]));
List<String> importedConfigs=endpointDescription.getConfigurationTypes();
if (importedConfigs != null && importedConfigs.size() > 0) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,importedConfigs.toArray(new String[importedConfigs.size()]));
eventProperties.put("String_Node_Str",new Long(new Date().getTime()));
eventProperties.put("String_Node_Str",event);
if (registrationTypeName != null) eventProperties.put(registrationTypeName,endpointDescription);
final EventAdmin eventAdmin=AccessController.doPrivileged(new PrivilegedAction<EventAdmin>(){
public EventAdmin run(){
synchronized (eventAdminTrackerLock) {
eventAdminTracker=new ServiceTracker(getRSABundleContext(),EventAdmin.class.getName(),null);
eventAdminTracker.open();
}
return (EventAdmin)eventAdminTracker.getService();
}
}
);
if (eventAdmin == null) {
logError("String_Node_Str","String_Node_Str" + topic + "String_Node_Str"+ eventProperties);
return;
}
AccessController.doPrivileged(new PrivilegedAction<Object>(){
public Object run(){
eventAdmin.postEvent(new Event(topic,eventProperties));
return null;
}
}
);
}

Fixed version (ground truth):
private void postEvent(RemoteServiceAdminEvent event,EndpointDescription endpointDescription){
  int eventType=event.getType();
  String eventTypeName=null;
  String registrationTypeName=null;
switch (eventType) {
case (RemoteServiceAdminEvent.EXPORT_REGISTRATION):
    eventTypeName="String_Node_Str";
  registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.EXPORT_ERROR):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.EXPORT_UNREGISTRATION):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.EXPORT_WARNING):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.EXPORT_UPDATE):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_REGISTRATION):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_ERROR):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_UNREGISTRATION):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_WARNING):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
case (RemoteServiceAdminEvent.IMPORT_UPDATE):
eventTypeName="String_Node_Str";
registrationTypeName="String_Node_Str";
break;
}
if (eventTypeName == null) {
logError("String_Node_Str","String_Node_Str" + eventType + "String_Node_Str"+ event+ "String_Node_Str");
return;
}
final String topic="String_Node_Str" + eventTypeName;
Bundle rsaBundle=getRSABundle();
if (rsaBundle == null) {
logError("String_Node_Str","String_Node_Str" + event);
return;
}
final Dictionary eventProperties=new Properties();
eventProperties.put("String_Node_Str",rsaBundle);
eventProperties.put("String_Node_Str",new Long(rsaBundle.getBundleId()));
eventProperties.put("String_Node_Str",rsaBundle.getSymbolicName());
eventProperties.put("String_Node_Str",rsaBundle.getVersion());
List<String> result=new ArrayList<String>();
Map signers1=clientBundle.getSignerCertificates(Bundle.SIGNERS_ALL);
for (Iterator i=signers1.keySet().iterator(); i.hasNext(); ) result.add(i.next().toString());
String[] signers=(String[])result.toArray(new String[result.size()]);
if (signers != null && signers.length > 0) eventProperties.put("String_Node_Str",signers);
Throwable t=event.getException();
if (t != null) {
eventProperties.put("String_Node_Str",t);
eventProperties.put("String_Node_Str",t);
eventProperties.put("String_Node_Str",t.getClass().getName());
String exceptionMessage=t.getMessage();
if (exceptionMessage != null) eventProperties.put("String_Node_Str",exceptionMessage);
}
long serviceId=endpointDescription.getServiceId();
if (serviceId != 0) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_SERVICE_ID,new Long(serviceId));
String frameworkUUID=endpointDescription.getFrameworkUUID();
if (frameworkUUID != null) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_FRAMEWORK_UUID,frameworkUUID);
String endpointId=endpointDescription.getId();
if (endpointId != null) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.ENDPOINT_ID,endpointId);
List<String> interfaces=endpointDescription.getInterfaces();
if (interfaces != null && interfaces.size() > 0) eventProperties.put(org.osgi.framework.Constants.OBJECTCLASS,interfaces.toArray(new String[interfaces.size()]));
List<String> importedConfigs=endpointDescription.getConfigurationTypes();
if (importedConfigs != null && importedConfigs.size() > 0) eventProperties.put(org.osgi.service.remoteserviceadmin.RemoteConstants.SERVICE_IMPORTED_CONFIGS,importedConfigs.toArray(new String[importedConfigs.size()]));
eventProperties.put("String_Node_Str",new Long(new Date().getTime()));
eventProperties.put("String_Node_Str",event);
if (registrationTypeName != null) eventProperties.put(registrationTypeName,endpointDescription);
final EventAdmin eventAdmin=AccessController.doPrivileged(new PrivilegedAction<EventAdmin>(){
public EventAdmin run(){
synchronized (eventAdminTrackerLock) {
eventAdminTracker=new ServiceTracker(getRSABundleContext(),EventAdmin.class.getName(),null);
eventAdminTracker.open();
}
return (EventAdmin)eventAdminTracker.getService();
}
}
);
if (eventAdmin == null) {
logError("String_Node_Str","String_Node_Str" + topic + "String_Node_Str"+ eventProperties);
return;
}
AccessController.doPrivileged(new PrivilegedAction<Object>(){
public Object run(){
eventAdmin.postEvent(new Event(topic,eventProperties));
return null;
}
}
);
}