Program: 63292
Project: 63292
Buggy source:
/** 
 * INTERNAL: Adds a notification listener to the ApplicationRuntimeMBean instance with "ApplicationName" attribute equals to 'mapKey.applicationName'.  The listener will handle application re-deployment. If any errors occur, we will fail silently, i.e. the listener will not be added. This method should only be called when running in an active WLS instance.
 * @param applicationName
 */
private static void addWLSNotificationListener(String applicationName){
  if (getWLSMBeanServer() != null) {
    try {
      ObjectName service=new ObjectName(WLS_SERVICE_KEY);
      ObjectName serverRuntime=(ObjectName)wlsMBeanServer.getAttribute(service,WLS_SERVER_RUNTIME);
      ObjectName[] appRuntimes=(ObjectName[])wlsMBeanServer.getAttribute(serverRuntime,WLS_APP_RUNTIMES);
      for (int i=0; i < appRuntimes.length; i++) {
        try {
          ObjectName appRuntime=appRuntimes[i];
          Object appName=wlsMBeanServer.getAttribute(appRuntime,WLS_APPLICATION_NAME);
          Object appVersion=wlsMBeanServer.getAttribute(appRuntime,WLS_APPLICATION_VERSION);
          String appIdentifier=null;
          if (appName != null) {
            if (appVersion != null) {
              appIdentifier=appName.toString() + "String_Node_Str" + appVersion.toString();
            }
 else {
              appIdentifier=appName.toString();
            }
            if (appIdentifier != null && appIdentifier.equals(applicationName)) {
              wlsMBeanServer.addNotificationListener(appRuntime,new MyNotificationListener(applicationName,WLS_IDENTIFIER),null,null);
              break;
            }
          }
        }
 catch (        Exception ex) {
        }
      }
    }
 catch (    Exception x) {
    }
  }
}

Fixed version (ground truth):
/** 
 * INTERNAL: Adds a notification listener to the ApplicationRuntimeMBean instance with "ApplicationName" attribute equals to 'mapKey.applicationName'.  The listener will handle application re-deployment. If any errors occur, we will fail silently, i.e. the listener will not be added. This method should only be called when running in an active WLS instance.
 * @param applicationName
 */
private static void addWLSNotificationListener(String applicationName){
  try {
    if (getWLSMBeanServer() != null) {
      ObjectName service=new ObjectName(WLS_SERVICE_KEY);
      ObjectName serverRuntime=(ObjectName)wlsMBeanServer.getAttribute(service,WLS_SERVER_RUNTIME);
      ObjectName[] appRuntimes=(ObjectName[])wlsMBeanServer.getAttribute(serverRuntime,WLS_APP_RUNTIMES);
      for (int i=0; i < appRuntimes.length; i++) {
        try {
          ObjectName appRuntime=appRuntimes[i];
          Object appName=wlsMBeanServer.getAttribute(appRuntime,WLS_APPLICATION_NAME);
          Object appVersion=wlsMBeanServer.getAttribute(appRuntime,WLS_APPLICATION_VERSION);
          String appIdentifier=null;
          if (appName != null) {
            if (appVersion != null) {
              appIdentifier=appName.toString() + "String_Node_Str" + appVersion.toString();
            }
 else {
              appIdentifier=appName.toString();
            }
            if (appIdentifier != null && appIdentifier.equals(applicationName)) {
              wlsMBeanServer.addNotificationListener(appRuntime,new MyNotificationListener(applicationName,WLS_IDENTIFIER),null,null);
              break;
            }
          }
        }
 catch (        Exception ex) {
          if (LOGGER.isLoggable(Level.FINE)) {
            LOGGER.fine("String_Node_Str" + appRuntimes[i].toString() + "String_Node_Str"+ ex.getMessage());
          }
        }
      }
    }
  }
 catch (  Exception x) {
    if (LOGGER.isLoggable(Level.WARNING)) {
      LOGGER.warning("String_Node_Str" + applicationName + "String_Node_Str"+ x.getMessage());
    }
  }
}