Class StackTraceCompacter

java.lang.Object
com.tridion.util.exceptions.compacter.impl.StackTraceCompacter

public class StackTraceCompacter extends Object
This class may compact given stacktrace into short form by removing similar rows and replacing them into single one. For instance for spring framework + hibernate stacktrace usually more that 100 lines, mostly all of them are from those frameworks. After compacting stacktrace may turn into 5 lines only.
  • Constructor Details

    • StackTraceCompacter

      public StackTraceCompacter()
    • StackTraceCompacter

      public StackTraceCompacter(Throwable currentException)
  • Method Details

    • init

      public void init(Throwable throwable)
      Tou have to use this method as starting point. Then call generateString() to get the magic.
      Parameters:
      throwable - given exception to be compacted.
    • addRuleToCollapse

      public void addRuleToCollapse(String compactedName, String[] rule)
      Allows to add user defined rule for compacting rows.
      Parameters:
      compactedName - name of rule - will be visible in stacktrace.
      rule - in fact array of texts, you do not want to see expanded in stacktrace.
    • addRuleToBeLeftExpanded

      public void addRuleToBeLeftExpanded(String ruleName, String[] rule)
      Allows to add rules which will always be expanded. Usually it's not necessary, but it can help processing faster.
      Parameters:
      ruleName - just name of rule, it's not used anywhere.
      rule - in fact array of texts, you want to see expanded in stacktracea.
    • getAllRules

      public List<com.tridion.util.exceptions.compacter.impl.StackTraceCompacter.ProcessorRule> getAllRules()
    • generateString

      public String generateString()
      This method is providing compacted stacktrace in printable format.
      Returns: