Program: 96614
Project: 96614
Buggy source:
@Override public void lazyStartup(){
  try {
    final IContainer container=getContainer();
    final IDiscoveryLocator adapter=(IDiscoveryLocator)getContainer().getAdapter(IDiscoveryLocator.class);
    adapter.addServiceListener(new IServiceListener(){
      public void serviceDiscovered(      IServiceEvent anEvent){
        IServiceInfo serviceInfo=anEvent.getServiceInfo();
        IServiceID serviceId=serviceInfo.getServiceID();
        IServiceTypeID serviceTypeId=serviceId.getServiceTypeID();
        if (serviceTypeId.getName().equals(HUDSON_MDNS_ID)) {
          IServiceProperties properties=serviceInfo.getServiceProperties();
          try {
            if (properties.getProperty(HUDSON_URL_PROPERTY_ID) == null) {
              notifyMessage(Messages.HudsonDiscovery_MessageTitle,NLS.bind(Messages.HudsonDiscovery_MissingURL,new Object[]{serviceInfo.getLocation().getHost()}));
            }
 else {
              String id=(String)properties.getProperty(JENKINS_SERVER_PROPERTY_ID);
              if (id == null) {
                id=UUID.randomUUID().toString();
              }
              URI uri=new URI(properties.getProperty(HUDSON_URL_PROPERTY_ID).toString());
              if (isNew(uri,id)) {
                notifyMessage(Messages.HudsonDiscovery_MessageTitle,NLS.bind(Messages.HudsonDiscovery_MessageText,new Object[]{uri,Messages.HudsonDiscovery_ServerName,uri.toString(),id}));
              }
            }
          }
 catch (          URISyntaxException e) {
            StatusHandler.log(new Status(IStatus.ERROR,HudsonConnectorUi.ID_PLUGIN,NLS.bind(Messages.HudsonDiscovery_IncorrectURI,new Object[]{properties.getProperty(HUDSON_URL_PROPERTY_ID).toString()}),e));
          }
        }
      }
      public void serviceUndiscovered(      IServiceEvent anEvent){
      }
    }
);
    container.connect(null,null);
  }
 catch (  ContainerCreateException e) {
    StatusHandler.log(new Status(IStatus.WARNING,HudsonConnectorUi.ID_PLUGIN,Messages.HudsonDiscovery_CouldNotStartService,e));
  }
catch (  ContainerConnectException e) {
    StatusHandler.log(new Status(IStatus.WARNING,HudsonConnectorUi.ID_PLUGIN,Messages.HudsonDiscovery_CouldNotStartService,e));
  }
}

Fixed version (ground truth):
@Override public void lazyStartup(){
  try {
    final IContainer container=getContainer();
    final IDiscoveryLocator adapter=(IDiscoveryLocator)getContainer().getAdapter(IDiscoveryLocator.class);
    adapter.addServiceListener(new IServiceListener(){
      public void serviceDiscovered(      IServiceEvent anEvent){
        IServiceInfo serviceInfo=anEvent.getServiceInfo();
        IServiceID serviceId=serviceInfo.getServiceID();
        IServiceTypeID serviceTypeId=serviceId.getServiceTypeID();
        if (serviceTypeId.getName().equals(JENKINS_MDNS_ID)) {
          IServiceProperties properties=serviceInfo.getServiceProperties();
          try {
            if (properties.getProperty(URL_PROPERTY) == null) {
              notifyMessage(Messages.JenkinsDiscovery_MessageTitle,NLS.bind(Messages.JenkinsDiscovery_MissingURL,new Object[]{serviceInfo.getLocation().getHost()}));
            }
 else {
              issueJenkinsNotification(properties);
            }
          }
 catch (          URISyntaxException e) {
            StatusHandler.log(new Status(IStatus.ERROR,HudsonConnectorUi.ID_PLUGIN,NLS.bind(Messages.Discovery_IncorrectURI,new Object[]{properties.getProperty(URL_PROPERTY).toString()}),e));
          }
        }
        if (serviceTypeId.getName().equals(HUDSON_MDNS_ID)) {
          IServiceProperties properties=serviceInfo.getServiceProperties();
          try {
            if (properties.getProperty(URL_PROPERTY) == null) {
              notifyMessage(Messages.HudsonDiscovery_MessageTitle,NLS.bind(Messages.HudsonDiscovery_MissingURL,new Object[]{serviceInfo.getLocation().getHost()}));
            }
 else {
              issueHudsonNotification(properties);
            }
          }
 catch (          URISyntaxException e) {
            StatusHandler.log(new Status(IStatus.ERROR,HudsonConnectorUi.ID_PLUGIN,NLS.bind(Messages.Discovery_IncorrectURI,new Object[]{properties.getProperty(URL_PROPERTY).toString()}),e));
          }
        }
      }
      public void serviceUndiscovered(      IServiceEvent anEvent){
      }
    }
);
    container.connect(null,null);
  }
 catch (  ContainerCreateException e) {
    StatusHandler.log(new Status(IStatus.WARNING,HudsonConnectorUi.ID_PLUGIN,Messages.Discovery_CouldNotStartService,e));
  }
catch (  ContainerConnectException e) {
    StatusHandler.log(new Status(IStatus.WARNING,HudsonConnectorUi.ID_PLUGIN,Messages.Discovery_CouldNotStartService,e));
  }
}