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 testLoggingPasswordMasked()
      {
          String message = "\"hive.server2.keystore.name\":\"testname1\"," + "\"hive.server2.keystore.PASSWORD\":\"test-123\"," +
              "\"hive.server3.keystore.password\":\"TEST$2!1\"," + "\"hive.server2.keystore.name\":\"testname1\"";
          String expectedMessage =
              "\"hive.server2.keystore.name\":\"testname1\"," + "\"hive.server2.keystore.PASSWORD\":\"" + HerdStringUtils.HIDDEN_TEXT + "\"," +
                  "\"hive.server3.keystore.password\":\"" + HerdStringUtils.HIDDEN_TEXT + "\"," + "\"hive.server2.keystore.name\":\"testname1\"";
          String sanitizedMessage = HerdStringUtils.sanitizeLogText(message);
          assertEquals(expectedMessage, sanitizedMessage);
  
          String messsage2 = "{\"name\": \"jdbc.user\", \"value\": \"user\"}," +
              "{\"name\": \"hive.server2.keystore.password\", \"value\": \"!This-is-password\"}, {\"name\": \"password\", \"value\": \"pass\"}\", {\"name\": \"jdbc.url\", \"value\": \"AURL\"}";
          String expectedMessage2 =
              "{\"name\": \"jdbc.user\", \"value\": \"user\"}," + "{\"name\": \"hive.server2.keystore.password\", \"value\": \"" + HerdStringUtils.HIDDEN_TEXT +
                  "\"}, {\"name\": \"password\", \"value\": \"" + HerdStringUtils.HIDDEN_TEXT + "\"}\", {\"name\": \"jdbc.url\", \"value\": \"AURL\"}";
          String sanitizedMessage2 = HerdStringUtils.sanitizeLogText(messsage2);
          assertEquals(expectedMessage2, sanitizedMessage2);
  
          String message3 = "<username>tester</username><password>@!pass_dd</password><url>a url</url>";
          String expectedMessage3 = "<username>tester</username><password>" + HerdStringUtils.HIDDEN_TEXT + "</password><url>a url</url>";
          String sanitizedMessage3 = HerdStringUtils.sanitizeLogText(message3);
          assertEquals(expectedMessage3, sanitizedMessage3);
  
          String message4 = "<hive.password>hive!pass</hive.password><username>tester</username><jdbc.password>@!pass_dd</jdbc.password><url>a url</url>";
          String expectedMessage4 =
              "<hive.password>" + HerdStringUtils.HIDDEN_TEXT + "</hive.password><username>tester</username>" + "<jdbc.password>" + HerdStringUtils.HIDDEN_TEXT +
                  "</jdbc.password><url>a url</url>";
          String sanitizedMessage4 = HerdStringUtils.sanitizeLogText(message4);
          assertEquals(expectedMessage4, sanitizedMessage4);
  
          String message5 = "\\\"jdbc.password\\\":\\\"pass!word\\\",\\\"username\\\":\\\"user1\\\",\\\"password\\\":\\\"pass!word\\\",\\\"databaseType\\\":\\\"POSTGRES\\\"";
          String expectedMessage5 = "\\\"jdbc.password\\\":\\\"" + HerdStringUtils.HIDDEN_TEXT + "\\\",\\\"username\\\":\\\"user1\\\",\\\"password\\\":\\\"" +  HerdStringUtils.HIDDEN_TEXT + "\\\",\\\"databaseType\\\":\\\"POSTGRES\\\"";
          String sanitizedMessage5 = HerdStringUtils.sanitizeLogText(message5);
          assertEquals(expectedMessage5, sanitizedMessage5);
  
          String message6 = "&quot;username&quot;:&quot;user1&quot;,&quot;password&quot;:&quot;pass!word&quot;,&quot;databaseType&quot;:&quot;POSTGRES&quot;";
          String expectedMessage6 = "\"username\":\"user1\",\"password\":\"hidden\",\"databaseType\":\"POSTGRES\"";
          String sanitizedMessage6 = HerdStringUtils.sanitizeLogText(message6);
          assertEquals(expectedMessage6, sanitizedMessage6);
  
          String message7 = null;
          String expectedMessage7 = "";
          String sanitizedMessage7 = HerdStringUtils.sanitizeLogText(message7);
          assertEquals(expectedMessage7, sanitizedMessage7);
  
          String otherText =
              "To become registered, securities professionals are required to pass qualification exams to demonstrate competence in their particular securities " +
                  "activities. The information below can help guide you through the membership and registration process.";
          StringBuilder messageSB =
              new StringBuilder(message).append(" ").append(messsage2).append(" ").append(message3).append(" ").append(message4).append(otherText);
          String message8 = messageSB.toString();
          StringBuilder expectedMessageSB =
              new StringBuilder(expectedMessage).append(" ").append(expectedMessage2).append(" ").append(expectedMessage3).append(" ").append(expectedMessage4)
                  .append(otherText);
          String expectedMessage8 = expectedMessageSB.toString();
          String sanitizedMessage8 = HerdStringUtils.sanitizeLogText(message8);
          assertEquals(expectedMessage8, sanitizedMessage8);
      }
test_case.class_method_signature: HerdStringUtilsTest.testLoggingPasswordMasked()
test_case.full_signature: @Test public void testLoggingPasswordMasked()
test_case.identifier: testLoggingPasswordMasked
test_case.invocations: sanitizeLogText assertEquals sanitizeLogText assertEquals sanitizeLogText assertEquals sanitizeLogText assertEquals sanitizeLogText assertEquals sanitizeLogText assertEquals sanitizeLogText assertEquals append append append append append append append toString append append append append append append append toString sanitizeLogText assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testLoggingPasswordMasked()
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 sanitizeLogText(String loggingText)
      {
          String sanitizedText = (loggingText != null) ? loggingText : "";
          sanitizedText = sanitizedText.replaceAll("&quot;", "\"");
          sanitizedText = REGEX_JSON_PASSWORD.matcher(sanitizedText).replaceAll("$1" + HIDDEN_TEXT + "$2");
          sanitizedText = REGEX_JSON_PASSWORD2.matcher(sanitizedText).replaceAll("$1" + HIDDEN_TEXT + "\"");
          sanitizedText = REGEX_XML_PASSWORD.matcher(sanitizedText).replaceAll("$1" + HIDDEN_TEXT + "<");
  
          return sanitizedText;
      }
focal_method.class_method_signature: HerdStringUtils.sanitizeLogText(String loggingText)
focal_method.full_signature: public static String sanitizeLogText(String loggingText)
focal_method.identifier: sanitizeLogText
focal_method.invocations: replaceAll replaceAll matcher replaceAll matcher replaceAll matcher
focal_method.modifiers: public static
focal_method.parameters: (String loggingText)
focal_method.return: String
focal_method.signature: String sanitizeLogText(String loggingText)