com.google.gwt.logging.server

## Class StackTraceDeobfuscator

- java.lang.Object
- - com.google.gwt.logging.server.StackTraceDeobfuscator

-     public class StackTraceDeobfuscator
      extends java.lang.Object

  Deobfuscates stack traces on the server side. This class requires that you have turned on emulated stack traces, via `<set-property name="compiler.stackMode" value="emulated" />` in your `.gwt.xml` module file for non-Chrome browsers or `<set-property name="compiler.useSourceMaps" value="true"/>` for Chrome, and moved your symbol map files to a location accessible by your server sever side code. You can use the GWT compiler `-deploy` command line argument to specify the location of the folder into which the generated `symbolMaps` directory is written. By default, the final `symbolMaps` directory is `war/WEB-INF/deploy/yourmodulename/symbolMaps/`. Pass the resulting directory location into this class' `symbolMapsDirectory` constructor or `setSymbolMapsDirectory(String)` setter method. TODO(unnurg): Combine this code with similar code in JUnitHostImpl

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) java.util.regex.Pattern` | `fragmentIdPattern`
    `protected java.io.File` | `symbolMapsDirectory`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StackTraceDeobfuscator(java.lang.String symbolMapsDirectory)` Creates a deobfuscator that loads symbol map files from the given directory.
    `StackTraceDeobfuscator(java.lang.String symbolMapsDirectory, boolean lazyLoad)` Creates a deobfuscator that loads symbol map files from the given directory.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.logging.LogRecord` | `deobfuscateLogRecord(java.util.logging.LogRecord lr, java.lang.String strongName)` Best effort resymbolization of a log record's stack trace.
    `java.lang.StackTraceElement[]` | `deobfuscateStackTrace(java.lang.StackTraceElement[] st, java.lang.String strongName)` Convenience method which resymbolizes an entire stack trace to extent possible.
    `java.lang.Throwable` | `deobfuscateThrowable(java.lang.Throwable old, java.lang.String strongName)`
    `protected java.io.InputStream` | `getSourceMapInputStream(java.lang.String permutationStrongName, int fragmentNumber)`
    `protected java.io.InputStream` | `getSymbolMapInputStream(java.lang.String permutationStrongName)` Retrieves a new `InputStream` for the given permutation strong name.
    `java.lang.StackTraceElement` | `resymbolize(java.lang.StackTraceElement ste, java.lang.String strongName)` Best effort resymbolization of a single stack trace element.
    `void` | `setSymbolMapsDirectory(java.lang.String symbolMapsDirectory)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### fragmentIdPattern

          final java.util.regex.Pattern fragmentIdPattern

    - #### symbolMapsDirectory

          protected java.io.File symbolMapsDirectory

  - ### Constructor Detail

    - #### StackTraceDeobfuscator

          public StackTraceDeobfuscator(java.lang.String symbolMapsDirectory)

      Creates a deobfuscator that loads symbol map files from the given directory. Symbol maps are generated into the location specified by the GWT compiler `-deploy` command line argument.
      Parameters:
        `symbolMapsDirectory` - the `symbolMaps` directory, with or without trailing directory separator character

    - #### StackTraceDeobfuscator

          public StackTraceDeobfuscator(java.lang.String symbolMapsDirectory,
                                boolean lazyLoad)

      Creates a deobfuscator that loads symbol map files from the given directory. Symbol maps are generated into the location specified by the GWT compiler `-deploy` command line argument.
      Parameters:
        `symbolMapsDirectory` - the `symbolMaps` directory, with or without trailing directory separator character
        `lazyLoad` - if true, only symbols requested to be deobfuscated are cached. This provides a large memory savings at the expense of occasional extra disk reads.

  - ### Method Detail

    - #### deobfuscateLogRecord

          public java.util.logging.LogRecord deobfuscateLogRecord(java.util.logging.LogRecord lr,
                                                         java.lang.String strongName)

      Best effort resymbolization of a log record's stack trace.
      Parameters:
        `lr` - the log record to resymbolize
        `strongName` - the GWT permutation strong name
      Returns:
        the best effort resymbolized log record

    - #### deobfuscateStackTrace

          public java.lang.StackTraceElement[] deobfuscateStackTrace(java.lang.StackTraceElement[] st,
                                                            java.lang.String strongName)

      Convenience method which resymbolizes an entire stack trace to extent possible.
      Parameters:
        `st` - the stack trace to resymbolize
        `strongName` - the GWT permutation strong name
      Returns:
        a best effort resymbolized stack trace

    - #### deobfuscateThrowable

          public java.lang.Throwable deobfuscateThrowable(java.lang.Throwable old,
                                                 java.lang.String strongName)

    - #### resymbolize

          public java.lang.StackTraceElement resymbolize(java.lang.StackTraceElement ste,
                                                java.lang.String strongName)

      Best effort resymbolization of a single stack trace element.
      Parameters:
        `ste` - the stack trace element to resymbolize
        `strongName` - the GWT permutation strong name
      Returns:
        the best effort resymbolized stack trace element

    - #### setSymbolMapsDirectory

          public void setSymbolMapsDirectory(java.lang.String symbolMapsDirectory)

    - #### getSourceMapInputStream

          protected java.io.InputStream getSourceMapInputStream(java.lang.String permutationStrongName,
                                                    int fragmentNumber)
                                                         throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getSymbolMapInputStream

          protected java.io.InputStream getSymbolMapInputStream(java.lang.String permutationStrongName)
                                                         throws java.io.IOException

      Retrieves a new `InputStream` for the given permutation strong name. This implementation, which subclasses may override, returns a `InputStream` for the `permutation-strong-name.symbolMap` file in the `symbolMaps` directory.
      Parameters:
        `permutationStrongName` - the GWT permutation strong name
      Returns:
        a new `InputStream`
      Throws:
        `java.io.IOException`