Program: 185068
Project: 185068
Buggy source:
public String cachedXPathGetString(String xpath,String prefixMappings) throws Docx4JException {
  if (cachedXPathAPI == null) {
    cachedXPathAPI=new CachedXPathAPI();
    cachedXPathAPI.getXPathContext().setNamespaceContext(getNamespaceContext());
  }
  if (cachedPrefixMappings == null && prefixMappings != null) {
    cachedPrefixMappings=prefixMappings;
    getNamespaceContext().registerPrefixMappings(prefixMappings);
  }
  if (prefixMappings != null && !prefixMappings.equals(cachedPrefixMappings)) {
    getNamespaceContext().registerPrefixMappings(prefixMappings);
  }
  try {
    if (xpath.contains("String_Node_Str") || xpath.startsWith("String_Node_Str")) {
      XObject xo=cachedXPathAPI.eval(doc,xpath);
      if (xo.bool(cachedXPathAPI.getXPathContext())) {
        return "String_Node_Str";
      }
 else {
        return "String_Node_Str";
      }
    }
    try {
      Node result=cachedXPathAPI.selectSingleNode(doc,xpath);
      return result.getTextContent();
    }
 catch (    org.apache.xpath.XPathException e) {
      if (e.getMessage().contains("String_Node_Str")) {
        log.debug("String_Node_Str" + xpath);
        XObject xo=cachedXPathAPI.eval(doc,xpath);
        if (xo.bool(cachedXPathAPI.getXPathContext())) {
          return "String_Node_Str";
        }
 else {
          return "String_Node_Str";
        }
      }
 else {
        log.warn("String_Node_Str" + xpath);
        throw e;
      }
    }
  }
 catch (  TransformerException e) {
    throw new Docx4JException("String_Node_Str" + xpath,e);
  }
}

Fixed version (ground truth):
public String cachedXPathGetString(String xpath,String prefixMappings) throws Docx4JException {
  if (cachedXPathAPI == null) {
    cachedXPathAPI=new CachedXPathAPI();
    cachedXPathAPI.getXPathContext().setNamespaceContext(getNamespaceContext());
  }
  if (cachedPrefixMappings == null && prefixMappings != null) {
    cachedPrefixMappings=prefixMappings;
    getNamespaceContext().registerPrefixMappings(prefixMappings);
  }
  if (prefixMappings != null && !prefixMappings.equals(cachedPrefixMappings)) {
    getNamespaceContext().registerPrefixMappings(prefixMappings);
  }
  try {
    if (xpath.contains("String_Node_Str") || xpath.trim().startsWith("String_Node_Str")) {
      XObject xo=cachedXPathAPI.eval(doc,xpath);
      if (xo.bool(cachedXPathAPI.getXPathContext())) {
        return "String_Node_Str";
      }
 else {
        return "String_Node_Str";
      }
    }
 else     if (xpath.trim().startsWith("String_Node_Str")) {
      XObject xo=cachedXPathAPI.eval(doc,xpath);
      double d=xo.num(cachedXPathAPI.getXPathContext());
      return "String_Node_Str" + Math.round(d);
    }
    try {
      Node result=cachedXPathAPI.selectSingleNode(doc,xpath);
      return result.getTextContent();
    }
 catch (    org.apache.xpath.XPathException e) {
      if (e.getMessage().contains("String_Node_Str")) {
        log.debug("String_Node_Str" + xpath);
        XObject xo=cachedXPathAPI.eval(doc,xpath);
        if (xo.bool(cachedXPathAPI.getXPathContext())) {
          return "String_Node_Str";
        }
 else {
          return "String_Node_Str";
        }
      }
 else       if (e.getMessage().contains("String_Node_Str")) {
        log.debug("String_Node_Str" + xpath);
        XObject xo=cachedXPathAPI.eval(doc,xpath);
        double d=xo.num(cachedXPathAPI.getXPathContext());
        return "String_Node_Str" + d;
      }
 else {
        log.warn("String_Node_Str" + xpath);
        throw e;
      }
    }
  }
 catch (  TransformerException e) {
    throw new Docx4JException("String_Node_Str" + xpath,e);
  }
}