Program: 79629
Project: 79629
Buggy source:
@Override public Promise<ResourceResponse,ResourceException> readInstance(Context serverContext,ReadRequest readRequest){
  Map<String,String> uriVariables=getUriTemplateVariables(serverContext);
  final String tabName=getTabName(uriVariables);
  if (tabName == null) {
    return new BadRequestException("String_Node_Str").asPromise();
  }
  final String serverName=getServerName(uriVariables);
  if (serverName == null) {
    return new BadRequestException("String_Node_Str").asPromise();
  }
  try {
    ServiceConfigManager scm=getServiceConfigManager(serverContext);
    ServiceConfig serverConfigs=getServerConfigs(scm);
    Properties defaultAttributes=getAttributes(serverConfigs.getSubConfig(SERVER_DEFAULT_NAME));
    final ServiceConfig serverConfig=serverConfigs.getSubConfig(serverName);
    if (serverConfig == null) {
      return new BadRequestException("String_Node_Str" + serverName).asPromise();
    }
    Properties serverSpecificAttributes=getAttributes(serverConfig);
    Map<String,Object> defaultSection=new HashMap<>();
    JsonValue result=json(object());
    final boolean isServerDefault=serverName.equalsIgnoreCase(SERVER_DEFAULT_NAME);
    if (!isServerDefault) {
      result.put("String_Node_Str",defaultSection);
    }
    List<String> attributeNamesForTab;
    if (tabName.equalsIgnoreCase(DIRECTORY_CONFIGURATION_TAB_NAME)) {
      final String serverConfigXml=getServerConfigXml(serverConfig);
      if (serverConfigXml != null) {
        InputStream resourceStream=new StringInputStream(serverConfigXml);
        Document serverXml=dBuilder.parse(resourceStream);
        XPath xPath=XPathFactory.newInstance().newXPath();
        final String baseExpression="String_Node_Str";
        String minConnections=(String)xPath.compile(baseExpression + "String_Node_Str" + DSConfigMgr.MIN_CONN_POOL).evaluate(serverXml,XPathConstants.STRING);
        String maxConnections=(String)xPath.compile(baseExpression + "String_Node_Str" + DSConfigMgr.MAX_CONN_POOL).evaluate(serverXml,XPathConstants.STRING);
        String dirDN=(String)xPath.compile(baseExpression + "String_Node_Str").evaluate(serverXml,XPathConstants.STRING);
        String directoryPassword=(String)xPath.compile(baseExpression + "String_Node_Str").evaluate(serverXml,XPathConstants.STRING);
        result.put("String_Node_Str",minConnections);
        result.put("String_Node_Str",maxConnections);
        result.put("String_Node_Str",dirDN);
        result.put("String_Node_Str",directoryPassword);
        NodeList serverNames=(NodeList)xPath.compile(baseExpression + "String_Node_Str").evaluate(serverXml,XPathConstants.NODESET);
        for (int i=0; i < serverNames.getLength(); i++) {
          final String directoryServerName=serverNames.item(i).getNodeValue();
          final String serverExpression=baseExpression + "String_Node_Str" + directoryServerName+ "String_Node_Str";
          String hostExpression=serverExpression + "String_Node_Str";
          String portExpression=serverExpression + "String_Node_Str";
          String typeExpression=serverExpression + "String_Node_Str";
          NodeList serverAttributes=(NodeList)xPath.compile(hostExpression + "String_Node_Str" + portExpression+ "String_Node_Str"+ typeExpression).evaluate(serverXml,XPathConstants.NODESET);
          for (int a=0; a < serverAttributes.getLength(); a++) {
            final Node serverAttribute=serverAttributes.item(a);
            result.addPermissive(new JsonPointer("String_Node_Str" + directoryServerName + "String_Node_Str"+ serverAttribute.getNodeName()),serverAttribute.getNodeValue());
          }
        }
      }
    }
 else {
      if (tabName.equalsIgnoreCase(ADVANCED_TAB_NAME)) {
        attributeNamesForTab=getAdvancedTabAttributeNames(serverConfig);
      }
 else {
        attributeNamesForTab=getDefaultValueNames(tabName);
      }
      Map<String,String> attributeNamesToSections=getAttributeNamesToSections(tabName);
      for (      String attributeName : attributeNamesForTab) {
        final Object defaultAttribute=getValue(defaultAttributes,attributeName);
        final String sectionName=attributeNamesToSections.get(attributeName);
        if (defaultAttribute != null) {
          defaultSection.put(sectionName + "String_Node_Str" + attributeName,defaultAttribute);
        }
        final Object serverSpecificAttribute=getValue(serverSpecificAttributes,attributeName);
        if (serverSpecificAttribute != null) {
          result.putPermissive(new JsonPointer(sectionName + "String_Node_Str" + attributeName),serverSpecificAttribute);
        }
      }
    }
    return newResultPromise(newResourceResponse(serverName + "String_Node_Str" + tabName,String.valueOf(result.hashCode()),result));
  }
 catch (  SMSException|SSOException|ParserConfigurationException|SAXException|IOException|XPathExpressionException e) {
    logger.error("String_Node_Str" + tabName,e);
  }
  return new BadRequestException("String_Node_Str" + tabName).asPromise();
}

Fixed version (ground truth):
@Override public Promise<ResourceResponse,ResourceException> readInstance(Context serverContext,ReadRequest readRequest){
  Map<String,String> uriVariables=getUriTemplateVariables(serverContext);
  final String tabName=getTabName(uriVariables);
  if (tabName == null) {
    return new BadRequestException("String_Node_Str").asPromise();
  }
  final String serverName=getServerName(uriVariables);
  if (serverName == null) {
    return new BadRequestException("String_Node_Str").asPromise();
  }
  try {
    ServiceConfigManager scm=getServiceConfigManager(serverContext);
    ServiceConfig serverConfigs=getServerConfigs(scm);
    Properties defaultAttributes=getAttributes(serverConfigs.getSubConfig(SERVER_DEFAULT_NAME));
    final ServiceConfig serverConfig=serverConfigs.getSubConfig(serverName);
    if (serverConfig == null) {
      return new BadRequestException("String_Node_Str" + serverName).asPromise();
    }
    Properties serverSpecificAttributes=getAttributes(serverConfig);
    Map<String,Object> defaultSection=new HashMap<>();
    JsonValue result=json(object());
    final boolean isServerDefault=serverName.equalsIgnoreCase(SERVER_DEFAULT_NAME);
    if (!isServerDefault) {
      result.put("String_Node_Str",defaultSection);
    }
    List<String> attributeNamesForTab;
    if (tabName.equalsIgnoreCase(DIRECTORY_CONFIGURATION_TAB_NAME)) {
      final String serverConfigXml=getServerConfigXml(serverConfig);
      if (serverConfigXml != null) {
        InputStream resourceStream=new StringInputStream(serverConfigXml);
        Document serverXml=dBuilder.parse(resourceStream);
        XPath xPath=XPathFactory.newInstance().newXPath();
        final String baseExpression="String_Node_Str";
        String minConnections=(String)xPath.compile(baseExpression + "String_Node_Str" + DSConfigMgr.MIN_CONN_POOL).evaluate(serverXml,XPathConstants.STRING);
        String maxConnections=(String)xPath.compile(baseExpression + "String_Node_Str" + DSConfigMgr.MAX_CONN_POOL).evaluate(serverXml,XPathConstants.STRING);
        String dirDN=(String)xPath.compile(baseExpression + "String_Node_Str").evaluate(serverXml,XPathConstants.STRING);
        String directoryPassword=(String)xPath.compile(baseExpression + "String_Node_Str").evaluate(serverXml,XPathConstants.STRING);
        result.put("String_Node_Str",minConnections);
        result.put("String_Node_Str",maxConnections);
        result.put("String_Node_Str",dirDN);
        result.put("String_Node_Str",directoryPassword);
        NodeList serverNames=(NodeList)xPath.compile(baseExpression + "String_Node_Str").evaluate(serverXml,XPathConstants.NODESET);
        for (int i=0; i < serverNames.getLength(); i++) {
          final String directoryServerName=serverNames.item(i).getNodeValue();
          final String serverExpression=baseExpression + "String_Node_Str" + directoryServerName+ "String_Node_Str";
          String hostExpression=serverExpression + "String_Node_Str";
          String portExpression=serverExpression + "String_Node_Str";
          String typeExpression=serverExpression + "String_Node_Str";
          NodeList serverAttributes=(NodeList)xPath.compile(hostExpression + "String_Node_Str" + portExpression+ "String_Node_Str"+ typeExpression).evaluate(serverXml,XPathConstants.NODESET);
          for (int a=0; a < serverAttributes.getLength(); a++) {
            final Node serverAttribute=serverAttributes.item(a);
            result.addPermissive(new JsonPointer("String_Node_Str" + directoryServerName + "String_Node_Str"+ serverAttribute.getNodeName()),serverAttribute.getNodeValue());
          }
        }
      }
    }
 else {
      if (tabName.equalsIgnoreCase(ADVANCED_TAB_NAME)) {
        attributeNamesForTab=getAdvancedTabAttributeNames(serverConfig);
      }
 else {
        attributeNamesForTab=getDefaultValueNames(tabName);
      }
      Map<String,String> attributeNamesToSections=getAttributeNamesToSections(tabName);
      for (      String attributeName : attributeNamesForTab) {
        final String defaultAttribute=(String)defaultAttributes.get(attributeName);
        final String sectionName=tabName.equals(ADVANCED_TAB_NAME) ? "String_Node_Str" : attributeNamesToSections.get(attributeName);
        String attributePath=sectionName == null ? "String_Node_Str" : sectionName + "String_Node_Str";
        if (defaultAttribute != null) {
          defaultSection.put(attributePath + attributeName,(String)defaultAttributes.get(attributeName));
        }
        final String serverSpecificAttribute=(String)serverSpecificAttributes.get(attributeName);
        if (serverSpecificAttribute != null) {
          result.putPermissive(new JsonPointer(attributePath + attributeName),serverSpecificAttribute);
        }
      }
    }
    return newResultPromise(newResourceResponse(serverName + "String_Node_Str" + tabName,String.valueOf(result.hashCode()),result));
  }
 catch (  SMSException|SSOException|ParserConfigurationException|SAXException|IOException|XPathExpressionException e) {
    logger.error("String_Node_Str" + tabName,e);
  }
  return new BadRequestException("String_Node_Str" + tabName).asPromise();
}