@Test(timeout = 30000) public void testFormatBackTraceEvil() { LogRecord record = new LogRecord(Level.SEVERE, ""); record.setThrown(createEvilThrowable()); CompactFormatter cf = new CompactFormatter(); cf.formatBackTrace(record); }
public String formatBackTrace(LogRecord record) { String site = ""; final Throwable t = record.getThrown(); if (t != null) { final Throwable root = apply(t); if (root != null) { site = findAndFormat(root.getStackTrace()); if (isNullOrSpaces(site)) { int limit = 0; for (Throwable c = t; c != null; c = c.getCause()) { site = findAndFormat(c.getStackTrace()); if (!isNullOrSpaces(site)) { break; } if (++limit == (1 << 16)) { break; } } } } } return site; }
CompactFormatter extends java.util.logging.Formatter { public String formatBackTrace(LogRecord record) { String site = ""; final Throwable t = record.getThrown(); if (t != null) { final Throwable root = apply(t); if (root != null) { site = findAndFormat(root.getStackTrace()); if (isNullOrSpaces(site)) { int limit = 0; for (Throwable c = t; c != null; c = c.getCause()) { site = findAndFormat(c.getStackTrace()); if (!isNullOrSpaces(site)) { break; } if (++limit == (1 << 16)) { break; } } } } } return site; } }
CompactFormatter extends java.util.logging.Formatter { public String formatBackTrace(LogRecord record) { String site = ""; final Throwable t = record.getThrown(); if (t != null) { final Throwable root = apply(t); if (root != null) { site = findAndFormat(root.getStackTrace()); if (isNullOrSpaces(site)) { int limit = 0; for (Throwable c = t; c != null; c = c.getCause()) { site = findAndFormat(c.getStackTrace()); if (!isNullOrSpaces(site)) { break; } if (++limit == (1 << 16)) { break; } } } } } return site; } CompactFormatter();  CompactFormatter(final String format); }
CompactFormatter extends java.util.logging.Formatter { public String formatBackTrace(LogRecord record) { String site = ""; final Throwable t = record.getThrown(); if (t != null) { final Throwable root = apply(t); if (root != null) { site = findAndFormat(root.getStackTrace()); if (isNullOrSpaces(site)) { int limit = 0; for (Throwable c = t; c != null; c = c.getCause()) { site = findAndFormat(c.getStackTrace()); if (!isNullOrSpaces(site)) { break; } if (++limit == (1 << 16)) { break; } } } } } return site; } CompactFormatter();  CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRecord record); String formatMessage(final Throwable t); String formatLevel(final LogRecord record); String formatSource(final LogRecord record); String formatLoggerName(final LogRecord record); String formatThrown(final LogRecord record); String formatBackTrace(LogRecord record); }
CompactFormatter extends java.util.logging.Formatter { public String formatBackTrace(LogRecord record) { String site = ""; final Throwable t = record.getThrown(); if (t != null) { final Throwable root = apply(t); if (root != null) { site = findAndFormat(root.getStackTrace()); if (isNullOrSpaces(site)) { int limit = 0; for (Throwable c = t; c != null; c = c.getCause()) { site = findAndFormat(c.getStackTrace()); if (!isNullOrSpaces(site)) { break; } if (++limit == (1 << 16)) { break; } } } } } return site; } CompactFormatter();  CompactFormatter(final String format); @Override String format(final LogRecord record); @Override String formatMessage(final LogRecord record); String formatMessage(final Throwable t); String formatLevel(final LogRecord record); String formatSource(final LogRecord record); String formatLoggerName(final LogRecord record); String formatThrown(final LogRecord record); String formatBackTrace(LogRecord record);  }