test_class.declarator: contents =
          "<ns2:ImportantQuestion>" +
          "Camel rules as cigarettes as well.  Do Apache Indians smoke it?" +
          "</ns2:ImportantQuestion>"
test_class.modifier: private final
test_class.original_string: private final String contents =
          "<ns2:ImportantQuestion>" +
          "Camel rules as cigarettes as well.  Do Apache Indians smoke it?" +
          "</ns2:ImportantQuestion>";
test_class.type: String
test_class.var_name: contents
test_class.declarator: envelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body>" +
          contents +
          "</soap:Body></soap:Envelope>"
test_class.modifier: private final
test_class.original_string: private final String envelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body>" +
          contents +
          "</soap:Body></soap:Envelope>";
test_class.type: String
test_class.var_name: envelopeWithNamespacePrefixes
test_class.declarator: envelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body>" +
          contents +
          "</Body></Envelope>"
test_class.modifier: private final
test_class.original_string: private final String envelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body>" +
          contents +
          "</Body></Envelope>";
test_class.type: String
test_class.var_name: envelopeWithoutNamespacePrefixes
test_class.declarator: emptyEnvelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body xmlns:prefix=\"uri\"></soap:Body></soap:Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithNamespacePrefixes =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body xmlns:prefix=\"uri\"></soap:Body></soap:Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithNamespacePrefixes
test_class.declarator: emptyEnvelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body></Body></Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithoutNamespacePrefixes =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body></Body></Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithoutNamespacePrefixes
test_class.declarator: emptyEnvelopeWithNamespacePrefixesShort =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body attrib=\"value\" /></soap:Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithNamespacePrefixesShort =
          "<soap:Envelope><soap:Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></soap:Header>" +
          "    <soap:Body attrib=\"value\" /></soap:Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithNamespacePrefixesShort
test_class.declarator: emptyEnvelopeWithoutNamespacePrefixesShort =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body /></Envelope>"
test_class.modifier: private final
test_class.original_string: private final String emptyEnvelopeWithoutNamespacePrefixesShort =
          "<Envelope><Header>" +
          "    <thirdns:header value=\"12345\">some text</thirdns:header></Header>" +
          "    <Body /></Envelope>";
test_class.type: String
test_class.var_name: emptyEnvelopeWithoutNamespacePrefixesShort
test_class.declarator: totallyBad = "12345"
test_class.modifier: private final
test_class.original_string: private final String totallyBad = "12345";
test_class.type: String
test_class.var_name: totallyBad
test_class.file: commons/ihe/ws/src/test/java/org/openehealth/ipf/commons/ihe/ws/utils/TestSoapUtils.java
test_class.identifier: TestSoapUtils
test_case.body: @Test
      public void testExtractNamedElement() {
          final String elementName = "ImportantQuestion";
          
          assertEquals(contents, extractNonEmptyElement(envelopeWithNamespacePrefixes, elementName));
          assertEquals(contents, extractNonEmptyElement(envelopeWithoutNamespacePrefixes, elementName));
  
          assertEquals(null, extractNonEmptyElement(emptyEnvelopeWithNamespacePrefixes, elementName));
          assertEquals(null, extractNonEmptyElement(emptyEnvelopeWithoutNamespacePrefixes, elementName));
          assertEquals(null, extractNonEmptyElement(emptyEnvelopeWithNamespacePrefixesShort, elementName));
          assertEquals(null, extractNonEmptyElement(emptyEnvelopeWithoutNamespacePrefixesShort, elementName));
  
          Assert.assertNull(extractNonEmptyElement(null, elementName));
          Assert.assertNull(extractNonEmptyElement(totallyBad, elementName));
      }
test_case.class_method_signature: TestSoapUtils.testExtractNamedElement()
test_case.full_signature: @Test public void testExtractNamedElement()
test_case.identifier: testExtractNamedElement
test_case.invocations: assertEquals extractNonEmptyElement assertEquals extractNonEmptyElement assertEquals extractNonEmptyElement assertEquals extractNonEmptyElement assertEquals extractNonEmptyElement assertEquals extractNonEmptyElement assertNull extractNonEmptyElement assertNull extractNonEmptyElement
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExtractNamedElement()
focal_class.declarator: LOG = LoggerFactory.getLogger(SoapUtils.class)
focal_class.modifier: private static final transient
focal_class.original_string: private static final transient Logger LOG = LoggerFactory.getLogger(SoapUtils.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: WS_ADDRESSING_NS_URIS
focal_class.modifier: public static final
focal_class.original_string: public static final Set<String> WS_ADDRESSING_NS_URIS;
focal_class.type: Set<String>
focal_class.var_name: WS_ADDRESSING_NS_URIS
focal_class.declarator: SOAP_NS_URIS
focal_class.modifier: public static final
focal_class.original_string: public static final Set<String> SOAP_NS_URIS;
focal_class.type: Set<String>
focal_class.var_name: SOAP_NS_URIS
focal_class.file: commons/ihe/ws/src/main/java/org/openehealth/ipf/commons/ihe/ws/utils/SoapUtils.java
focal_class.identifier: SoapUtils
focal_class.class_method_signature: SoapUtils.SoapUtils()
focal_class.full_signature: private  SoapUtils()
focal_class.identifier: SoapUtils
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  SoapUtils()
focal_class.class_method_signature: SoapUtils.getElementNS(
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.full_signature: public static Element getElementNS(
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.identifier: getElementNS
focal_class.modifiers: public static
focal_class.parameters: (
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.return: Element
focal_class.signature: Element getElementNS(
              Element root,
              Set<String> nsUris,
              String wantedLocalName)
focal_class.class_method_signature: SoapUtils.extractSoapBody(String soapEnvelope)
focal_class.full_signature: public static String extractSoapBody(String soapEnvelope)
focal_class.identifier: extractSoapBody
focal_class.modifiers: public static
focal_class.parameters: (String soapEnvelope)
focal_class.return: String
focal_class.signature: String extractSoapBody(String soapEnvelope)
focal_class.class_method_signature: SoapUtils.extractNonEmptyElement(String document, String elementName)
focal_class.full_signature: public static String extractNonEmptyElement(String document, String elementName)
focal_class.identifier: extractNonEmptyElement
focal_class.modifiers: public static
focal_class.parameters: (String document, String elementName)
focal_class.return: String
focal_class.signature: String extractNonEmptyElement(String document, String elementName)
focal_class.class_method_signature: SoapUtils.extractOutgoingException(Exchange exchange)
focal_class.full_signature: public static Exception extractOutgoingException(Exchange exchange)
focal_class.identifier: extractOutgoingException
focal_class.modifiers: public static
focal_class.parameters: (Exchange exchange)
focal_class.return: Exception
focal_class.signature: Exception extractOutgoingException(Exchange exchange)
focal_class.class_method_signature: SoapUtils.extractOutgoingPayload(Exchange exchange)
focal_class.full_signature: public static String extractOutgoingPayload(Exchange exchange)
focal_class.identifier: extractOutgoingPayload
focal_class.modifiers: public static
focal_class.parameters: (Exchange exchange)
focal_class.return: String
focal_class.signature: String extractOutgoingPayload(Exchange exchange)
focal_method.body: public static String extractNonEmptyElement(String document, String elementName) {
  
          // ... <prefix:elementName attr1="abcd"> ... </prefix:elementName> ...
          //     3                                     2        1
  
          try {
              int pos1 = document.lastIndexOf(elementName + '>');
              if (pos1 < 0) {
                  LOG.warn("Cannot find end of the closing tag of {}", elementName);
                  return null;
              }
  
              int pos2 = document.lastIndexOf('<', pos1 - 1);
              if (pos2 < 0) {
                  LOG.warn("Cannot find start of the closing tag of {}", elementName);
                  return null;
              }
  
              StringBuilder sb = new StringBuilder().append('<');
              if (pos1 - pos2 > 2) {
                  sb.append(document, pos2 + 2, pos1 - 1).append(':');
              }
              int pos3 = document.indexOf(sb.append(elementName).toString());
              if (pos3 < 0) {
                  LOG.warn("Cannot find start of the opening tag of {}", elementName);
                  return null;
              }
  
              return document.substring(pos3, pos1 + elementName.length() + 1);
  
          } catch (Exception e) {
              LOG.error("Could not extract element" + elementName, e);
              return null;
          }
      }
focal_method.class_method_signature: SoapUtils.extractNonEmptyElement(String document, String elementName)
focal_method.full_signature: public static String extractNonEmptyElement(String document, String elementName)
focal_method.identifier: extractNonEmptyElement
focal_method.invocations: lastIndexOf warn lastIndexOf warn append append append indexOf toString append warn substring length error
focal_method.modifiers: public static
focal_method.parameters: (String document, String elementName)
focal_method.return: String
focal_method.signature: String extractNonEmptyElement(String document, String elementName)