test_class.declarator: expectedException = ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException expectedException = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: expectedException
test_class.declarator: CSV_INJECTION_ERROR_MSG = "One or more schema column fields start with a prohibited character."
test_class.modifier: private static final
test_class.original_string: private static final String CSV_INJECTION_ERROR_MSG = "One or more schema column fields start with a prohibited character.";
test_class.type: String
test_class.var_name: CSV_INJECTION_ERROR_MSG
test_class.file: herd-code/herd-core/src/test/java/org/finra/herd/core/HerdStringUtilsTest.java
test_class.identifier: HerdStringUtilsTest
test_class.superclass: extends AbstractCoreTest
test_case.body: @Test
      public void testStripHtmlDirtyFragmentWithPartialTags()
      {
          String result = HerdStringUtils.stripHtml("fragment<li><b> with no</b> html<l");
          assertEquals("fragment with no html", result);
      }
test_case.class_method_signature: HerdStringUtilsTest.testStripHtmlDirtyFragmentWithPartialTags()
test_case.full_signature: @Test public void testStripHtmlDirtyFragmentWithPartialTags()
test_case.identifier: testStripHtmlDirtyFragmentWithPartialTags
test_case.invocations: stripHtml assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testStripHtmlDirtyFragmentWithPartialTags()
focal_class.declarator: CSV_INJECTION_REGEX = "^[+=@-].*"
focal_class.modifier: private static final
focal_class.original_string: private static final String CSV_INJECTION_REGEX = "^[+=@-].*";
focal_class.type: String
focal_class.var_name: CSV_INJECTION_REGEX
focal_class.declarator: HIDDEN_TEXT = "hidden"
focal_class.modifier: public static final
focal_class.original_string: public static final String HIDDEN_TEXT = "hidden";
focal_class.type: String
focal_class.var_name: HIDDEN_TEXT
focal_class.declarator: REGEX_JSON_PASSWORD =
          Pattern.compile("(\\\\?\"?password\\\\?\":\\\\?\")[\\w\\p{Punct}&&[^&]]*?(\\\\?\")", Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static
focal_class.original_string: private static Pattern REGEX_JSON_PASSWORD =
          Pattern.compile("(\\\\?\"?password\\\\?\":\\\\?\")[\\w\\p{Punct}&&[^&]]*?(\\\\?\")", Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: REGEX_JSON_PASSWORD
focal_class.declarator: REGEX_JSON_PASSWORD2 =
          Pattern.compile("(\"name\": \".*?password\", \"value\": \")[\\w\\p{Punct}&&[^&]]*?\"", Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static
focal_class.original_string: private static Pattern REGEX_JSON_PASSWORD2 =
          Pattern.compile("(\"name\": \".*?password\", \"value\": \")[\\w\\p{Punct}&&[^&]]*?\"", Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: REGEX_JSON_PASSWORD2
focal_class.declarator: REGEX_XML_PASSWORD = Pattern.compile("(<.*?password>)[\\w\\p{Punct}&&[^&]]*?<", Pattern.CASE_INSENSITIVE)
focal_class.modifier: private static
focal_class.original_string: private static Pattern REGEX_XML_PASSWORD = Pattern.compile("(<.*?password>)[\\w\\p{Punct}&&[^&]]*?<", Pattern.CASE_INSENSITIVE);
focal_class.type: Pattern
focal_class.var_name: REGEX_XML_PASSWORD
focal_class.file: herd-code/herd-core/src/main/java/org/finra/herd/core/HerdStringUtils.java
focal_class.identifier: HerdStringUtils
focal_class.class_method_signature: HerdStringUtils.decodeBase64(String base64EncodedText)
focal_class.full_signature: public static String decodeBase64(String base64EncodedText)
focal_class.identifier: decodeBase64
focal_class.modifiers: public static
focal_class.parameters: (String base64EncodedText)
focal_class.return: String
focal_class.signature: String decodeBase64(String base64EncodedText)
focal_class.class_method_signature: HerdStringUtils.getShortDescription(String description, Integer shortDescMaxLength)
focal_class.full_signature: public static String getShortDescription(String description, Integer shortDescMaxLength)
focal_class.identifier: getShortDescription
focal_class.modifiers: public static
focal_class.parameters: (String description, Integer shortDescMaxLength)
focal_class.return: String
focal_class.signature: String getShortDescription(String description, Integer shortDescMaxLength)
focal_class.class_method_signature: HerdStringUtils.stripHtml(String fragment, String... whitelistTags)
focal_class.full_signature: public static String stripHtml(String fragment, String... whitelistTags)
focal_class.identifier: stripHtml
focal_class.modifiers: public static
focal_class.parameters: (String fragment, String... whitelistTags)
focal_class.return: String
focal_class.signature: String stripHtml(String fragment, String... whitelistTags)
focal_class.class_method_signature: HerdStringUtils.checkCsvInjection(String text, String errorMessage)
focal_class.full_signature: public static void checkCsvInjection(String text, String errorMessage)
focal_class.identifier: checkCsvInjection
focal_class.modifiers: public static
focal_class.parameters: (String text, String errorMessage)
focal_class.return: void
focal_class.signature: void checkCsvInjection(String text, String errorMessage)
focal_class.class_method_signature: HerdStringUtils.convertStringToInteger(final String stringValue, final Integer defaultValue)
focal_class.full_signature: public static Integer convertStringToInteger(final String stringValue, final Integer defaultValue)
focal_class.identifier: convertStringToInteger
focal_class.modifiers: public static
focal_class.parameters: (final String stringValue, final Integer defaultValue)
focal_class.return: Integer
focal_class.signature: Integer convertStringToInteger(final String stringValue, final Integer defaultValue)
focal_class.class_method_signature: HerdStringUtils.sanitizeLogText(String loggingText)
focal_class.full_signature: public static String sanitizeLogText(String loggingText)
focal_class.identifier: sanitizeLogText
focal_class.modifiers: public static
focal_class.parameters: (String loggingText)
focal_class.return: String
focal_class.signature: String sanitizeLogText(String loggingText)
focal_method.body: public static String stripHtml(String fragment, String... whitelistTags)
      {
          // Unescape HTML.
          String unEscapedFragment = StringEscapeUtils.unescapeHtml4(fragment);
  
          // Parse out html tags except those from a given list of whitelist tags
          Document dirty = Jsoup.parseBodyFragment(unEscapedFragment);
  
          Whitelist whitelist = new Whitelist();
  
          for (String whitelistTag : whitelistTags)
          {
              // Get the actual tag name from the whitelist tag
              // this is vulnerable in general to complex tags but will suffice for our simple needs
              whitelistTag = StringUtils.removePattern(whitelistTag, "[^\\{IsAlphabetic}]");
  
              // Add all specified tags to the whitelist while preserving inline css
              whitelist.addTags(whitelistTag).addAttributes(whitelistTag, "class");
          }
  
          Cleaner cleaner = new Cleaner(whitelist);
          Document clean = cleaner.clean(dirty);
          // Set character encoding to UTF-8 and make sure no line-breaks are added
          clean.outputSettings().escapeMode(Entities.EscapeMode.base).charset(StandardCharsets.UTF_8).prettyPrint(false);
  
          // return 'cleaned' html body
          return clean.body().html();
      }
focal_method.class_method_signature: HerdStringUtils.stripHtml(String fragment, String... whitelistTags)
focal_method.full_signature: public static String stripHtml(String fragment, String... whitelistTags)
focal_method.identifier: stripHtml
focal_method.invocations: unescapeHtml4 parseBodyFragment removePattern addAttributes addTags clean prettyPrint charset escapeMode outputSettings html body
focal_method.modifiers: public static
focal_method.parameters: (String fragment, String... whitelistTags)
focal_method.return: String
focal_method.signature: String stripHtml(String fragment, String... whitelistTags)