Program: 114864
Project: 114864
Buggy source:
/** 
 * This method generates swagger v2 doc using swagger 1.2 doc
 * @param tenant          Tenant
 * @param swagger12location the location of swagger 1.2 doc
 * @return JSON string of swagger v2 doc
 * @throws java.net.MalformedURLException
 * @throws org.json.simple.parser.ParseException
 * @throws org.wso2.carbon.registry.core.exceptions.RegistryException
 */
private String getSwagger2docUsingSwagger12RegistryResources(Tenant tenant,String swagger12location,API api) throws MalformedURLException, ParseException, RegistryException, UserStoreException {
  log.debug("String_Node_Str");
  JSONParser parser=new JSONParser();
  String swagger12BasePath=null;
  try {
    Object rawResource=registryService.getGovernanceRegistryResource(swagger12location + APIConstants.API_DOC_1_2_RESOURCE_NAME);
    String swaggerRes=ResourceUtil.getResourceContent(rawResource);
    JSONObject swagger12doc=(JSONObject)parser.parse(swaggerRes);
    Map<String,JSONArray> apiDefPaths=new HashMap<String,JSONArray>();
    String[] apiDefinitions=(String[])registryService.getGovernanceRegistryResource(swagger12location);
    for (    String apiDefinition : apiDefinitions) {
      String resourceName=apiDefinition.substring(apiDefinition.lastIndexOf('/'));
      if (APIConstants.API_DOC_1_2_RESOURCE_NAME.equals(resourceName)) {
        continue;
      }
      Object resource=registryService.getGovernanceRegistryResource(apiDefinition);
      String swaggerDocContent;
      if (resource instanceof String[]) {
        swaggerDocContent=Arrays.toString((String[])resource);
      }
 else {
        swaggerDocContent=new String((byte[])resource,"String_Node_Str");
      }
      log.debug("String_Node_Str" + swaggerDocContent);
      JSONObject apiDef=(JSONObject)parser.parse(swaggerDocContent);
      swagger12BasePath=(String)apiDef.get("String_Node_Str");
      if (apiDef.containsKey("String_Node_Str")) {
        JSONArray apiArray=(JSONArray)apiDef.get("String_Node_Str");
        for (        Object anApiArray : apiArray) {
          JSONObject apiObject=(JSONObject)anApiArray;
          String path=(String)apiObject.get("String_Node_Str");
          JSONArray operations=(JSONArray)apiObject.get("String_Node_Str");
          apiDefPaths.put(path,operations);
        }
      }
 else {
        log.error("String_Node_Str");
      }
    }
    JSONObject swagger2Doc=generateSwagger2Document(swagger12doc,apiDefPaths,api);
    return swagger2Doc.toJSONString();
  }
 catch (  UnsupportedEncodingException e) {
    log.error("String_Node_Str",e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * This method generates swagger v2 doc using swagger 1.2 doc
 * @param tenant          Tenant
 * @param swagger12location the location of swagger 1.2 doc
 * @return JSON string of swagger v2 doc
 * @throws java.net.MalformedURLException
 * @throws org.json.simple.parser.ParseException
 * @throws org.wso2.carbon.registry.core.exceptions.RegistryException
 */
private String getSwagger2docUsingSwagger12RegistryResources(Tenant tenant,String swagger12location,API api) throws MalformedURLException, ParseException, RegistryException, UserStoreException {
  log.debug("String_Node_Str");
  JSONParser parser=new JSONParser();
  String swagger12BasePath=null;
  Object rawResource=registryService.getGovernanceRegistryResource(swagger12location + APIConstants.API_DOC_1_2_RESOURCE_NAME);
  String swaggerRes=ResourceUtil.getResourceContent(rawResource);
  JSONObject swagger12doc=(JSONObject)parser.parse(swaggerRes);
  Map<String,JSONArray> apiDefPaths=new HashMap<String,JSONArray>();
  JSONArray pathConfigs=(JSONArray)swagger12doc.get(APIConstants.API_ARRAY_NAME);
  for (  Object pathConfig : pathConfigs) {
    JSONObject jsonObjPathConfig=(JSONObject)pathConfig;
    String pathName=(String)jsonObjPathConfig.get(APIConstants.DOCUMENTATION_SEARCH_PATH_FIELD);
    pathName=pathName.startsWith("String_Node_Str") ? pathName : ("String_Node_Str" + pathName);
    Object pathResource=registryService.getGovernanceRegistryResource(swagger12location + pathName);
    String swaggerDocContent=ResourceUtil.getResourceContent(pathResource);
    log.debug("String_Node_Str" + swaggerDocContent);
    JSONObject apiDef=(JSONObject)parser.parse(swaggerDocContent);
    swagger12BasePath=(String)apiDef.get("String_Node_Str");
    if (apiDef.containsKey("String_Node_Str")) {
      JSONArray apiArray=(JSONArray)apiDef.get("String_Node_Str");
      for (      Object anApiArray : apiArray) {
        JSONObject apiObject=(JSONObject)anApiArray;
        String path=(String)apiObject.get("String_Node_Str");
        JSONArray operations=(JSONArray)apiObject.get("String_Node_Str");
        apiDefPaths.put(path,operations);
      }
    }
 else {
      log.error("String_Node_Str");
    }
  }
  JSONObject swagger2Doc=generateSwagger2Document(swagger12doc,apiDefPaths,api);
  return swagger2Doc.toJSONString();
}