@Test public void testGetSafeSystemNewline() { String nl = PrintfMessageParser.getSafeSystemNewline(); assertThat(nl).isAnyOf("\n", "\r", "\r\n"); }
static String getSafeSystemNewline() { try { String unsafeNewline = System.getProperty("line.separator"); if (unsafeNewline.matches(ALLOWED_NEWLINE_PATTERN)) { return unsafeNewline; } } catch (SecurityException e) { } return "\n"; }
PrintfMessageParser extends MessageParser { static String getSafeSystemNewline() { try { String unsafeNewline = System.getProperty("line.separator"); if (unsafeNewline.matches(ALLOWED_NEWLINE_PATTERN)) { return unsafeNewline; } } catch (SecurityException e) { } return "\n"; } }
PrintfMessageParser extends MessageParser { static String getSafeSystemNewline() { try { String unsafeNewline = System.getProperty("line.separator"); if (unsafeNewline.matches(ALLOWED_NEWLINE_PATTERN)) { return unsafeNewline; } } catch (SecurityException e) { } return "\n"; }  }
PrintfMessageParser extends MessageParser { static String getSafeSystemNewline() { try { String unsafeNewline = System.getProperty("line.separator"); if (unsafeNewline.matches(ALLOWED_NEWLINE_PATTERN)) { return unsafeNewline; } } catch (SecurityException e) { } return "\n"; }  @Override final void unescape(StringBuilder out, String message, int start, int end); }
PrintfMessageParser extends MessageParser { static String getSafeSystemNewline() { try { String unsafeNewline = System.getProperty("line.separator"); if (unsafeNewline.matches(ALLOWED_NEWLINE_PATTERN)) { return unsafeNewline; } } catch (SecurityException e) { } return "\n"; }  @Override final void unescape(StringBuilder out, String message, int start, int end);  }