Program: 134779
Project: 134779
Buggy source:
/** 
 * Internal method for requesting default components.
 * @param requestor	requestor of the component.
 * @param typr		type of the component
 * @return	componentInfo	<code>ComponentInfo</code> of requested default component.
 */
private ComponentInfo internalRequestDefaultComponent(int requestor,String type) throws NoDefaultComponentException {
  String defaultComponentName=null;
  ComponentInfo defaultComponentInfo=null;
synchronized (defaultComponents) {
    defaultComponentInfo=(ComponentInfo)defaultComponents.get(type);
  }
  if (defaultComponentInfo != null)   defaultComponentName=defaultComponentInfo.getName();
  if (defaultComponentName == null) {
    DAOProxy componentsDAO=getComponentsDAOProxy();
    if (componentsDAO != null) {
      try {
        componentsDAO.get_field_data("String_Node_Str");
        String[] ids=getComponentsList();
        for (int i=0; i < ids.length; i++) {
          String name=ids[i];
          if (name == null) {
            logger.log(Level.WARNING,"String_Node_Str" + ids[i] + "String_Node_Str");
            continue;
          }
          if (!name.equals(ComponentSpec.COMPSPEC_ANY)) {
            String componentType=readStringCharacteristics(componentsDAO,ids[i] + "String_Node_Str");
            if (type == null) {
              logger.log(Level.WARNING,"String_Node_Str" + name + "String_Node_Str");
              continue;
            }
            final String TRUE_STRING="String_Node_Str";
            if (type.equals(componentType)) {
              String isDefault=readStringCharacteristics(componentsDAO,ids[i] + "String_Node_Str",true);
              if (isDefault == null || !isDefault.equalsIgnoreCase(TRUE_STRING))               continue;
              defaultComponentName=name;
              break;
            }
          }
        }
      }
 catch (      Throwable ex) {
        CoreException ce=new CoreException("String_Node_Str",ex);
        reportException(ce);
      }
    }
  }
  if (defaultComponentInfo != null) {
    try {
      StatusHolder status=new StatusHolder();
      ContainerInfo containerInfo=getContainerInfo(defaultComponentInfo.getContainer());
      if (containerInfo == null) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str"+ HandleHelper.toString(defaultComponentInfo.getContainer())+ "String_Node_Str");
        reportException(huse);
        return null;
      }
      ComponentInfo componentInfo=internalRequestComponent(requestor,defaultComponentInfo.getName(),defaultComponentInfo.getType(),defaultComponentInfo.getCode(),containerInfo.getName(),RELEASE_IMMEDIATELY,status,true);
      if (componentInfo == null || status.getStatus() != ComponentStatus.COMPONENT_ACTIVATED) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str");
        reportException(huse);
        return null;
      }
      return componentInfo;
    }
 catch (    Throwable t) {
      CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str",t);
      reportException(huse);
      return null;
    }
  }
 else   if (defaultComponentName != null) {
    URI curl=null;
    try {
      curl=CURLHelper.createURI(defaultComponentName);
    }
 catch (    URISyntaxException use) {
      CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str",use);
      reportException(huse);
      return null;
    }
    try {
      StatusHolder status=new StatusHolder();
      Component component=internalRequestComponent(requestor,curl,status,true);
      if (component == null || status.getStatus() != ComponentStatus.COMPONENT_ACTIVATED) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str");
        reportException(huse);
        return null;
      }
      ComponentInfo[] componentInfo=getComponentInfo(requestor,new int[0],defaultComponentName,type,true);
      if (componentInfo == null || componentInfo.length != 1) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str");
        reportException(huse);
        return null;
      }
 else       return componentInfo[0];
    }
 catch (    Throwable t) {
      CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str",t);
      reportException(huse);
      return null;
    }
  }
  NoDefaultComponentException ndce=new NoDefaultComponentException("String_Node_Str" + type + "String_Node_Str");
  throw ndce;
}

Fixed version (ground truth):
/** 
 * Internal method for requesting default components.
 * @param requestor	requestor of the component.
 * @param typr		type of the component
 * @return	componentInfo	<code>ComponentInfo</code> of requested default component.
 */
private ComponentInfo internalRequestDefaultComponent(int requestor,String type) throws NoDefaultComponentException {
  String defaultComponentName=null;
  ComponentInfo defaultComponentInfo=null;
synchronized (defaultComponents) {
    defaultComponentInfo=defaultComponents.get(type);
  }
  if (defaultComponentInfo != null)   defaultComponentName=defaultComponentInfo.getName();
  if (defaultComponentName == null) {
    DAOProxy componentsDAO=getComponentsDAOProxy();
    if (componentsDAO != null) {
      try {
        componentsDAO.get_field_data("String_Node_Str");
        String[] ids=getComponentsList();
        for (int i=0; i < ids.length; i++) {
          String name=ids[i];
          if (name == null) {
            logger.log(Level.WARNING,"String_Node_Str" + ids[i] + "String_Node_Str");
            continue;
          }
          if (!name.equals(ComponentSpec.COMPSPEC_ANY)) {
            String componentType=readStringCharacteristics(componentsDAO,ids[i] + "String_Node_Str");
            if (type == null) {
              logger.log(Level.WARNING,"String_Node_Str" + name + "String_Node_Str");
              continue;
            }
            final String TRUE_STRING="String_Node_Str";
            if (type.equals(componentType)) {
              String isDefault=readStringCharacteristics(componentsDAO,ids[i] + "String_Node_Str",true);
              if (isDefault == null || !isDefault.equalsIgnoreCase(TRUE_STRING))               continue;
              defaultComponentName=name;
              break;
            }
          }
        }
      }
 catch (      Throwable ex) {
        CoreException ce=new CoreException("String_Node_Str",ex);
        reportException(ce);
      }
    }
  }
  if (defaultComponentInfo != null) {
    try {
      StatusHolder status=new StatusHolder();
      ContainerInfo containerInfo=getContainerInfo(defaultComponentInfo.getContainer());
      if (containerInfo == null) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str"+ HandleHelper.toString(defaultComponentInfo.getContainer())+ "String_Node_Str");
        reportException(huse);
        return null;
      }
      ComponentInfo componentInfo=internalRequestComponent(requestor,defaultComponentInfo.getName(),defaultComponentInfo.getType(),defaultComponentInfo.getCode(),containerInfo.getName(),RELEASE_IMMEDIATELY,status,true);
      if (componentInfo == null || status.getStatus() != ComponentStatus.COMPONENT_ACTIVATED) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str");
        reportException(huse);
        return null;
      }
      return componentInfo;
    }
 catch (    Throwable t) {
      CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str",t);
      reportException(huse);
      return null;
    }
  }
 else   if (defaultComponentName != null) {
    URI curl=null;
    try {
      curl=CURLHelper.createURI(defaultComponentName);
    }
 catch (    URISyntaxException use) {
      CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str",use);
      reportException(huse);
      return null;
    }
    try {
      StatusHolder status=new StatusHolder();
      Component component=internalRequestComponent(requestor,curl,status,true);
      if (component == null || status.getStatus() != ComponentStatus.COMPONENT_ACTIVATED) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str");
        reportException(huse);
        return null;
      }
      ComponentInfo[] componentInfo=getComponentInfo(requestor,new int[0],defaultComponentName,type,true);
      if (componentInfo == null || componentInfo.length != 1) {
        CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str");
        reportException(huse);
        return null;
      }
 else       return componentInfo[0];
    }
 catch (    Throwable t) {
      CoreException huse=new CoreException("String_Node_Str" + defaultComponentName + "String_Node_Str",t);
      reportException(huse);
      return null;
    }
  }
  NoDefaultComponentException ndce=new NoDefaultComponentException("String_Node_Str" + type + "String_Node_Str");
  throw ndce;
}