GWT 2.7.0

com.google.gwt.core.server
Class StackTraceDeobfuscator

java.lang.Object
  extended by com.google.gwt.core.server.StackTraceDeobfuscator
Direct Known Subclasses:
StackTraceDeobfuscator

public abstract 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 browsers that don't support sourcemaps or <set-property name="compiler.useSourceMaps" value="true"/> for browsers that support it (e.g. Chrome), and moved your symbol map files to a location accessible by your server-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/.


Constructor Summary
StackTraceDeobfuscator()
           
 
Method Summary
 void deobfuscateStackTrace(java.lang.Throwable throwable, java.lang.String strongName)
          Replaces the stack traces in the given Throwable and its causes with deobfuscated stack traces wherever possible.
static StackTraceDeobfuscator fromFileSystem(java.lang.String symbolMapsDirectory)
          Creates a deobfuscator that loads symbol and source map files from the given directory.
static StackTraceDeobfuscator fromResource(java.lang.String symbolMapsPath)
          Creates a deobfuscator that loads symbol and source map files under given resource path.
static StackTraceDeobfuscator fromUrl(java.net.URL urlPath)
          Creates a deobfuscator that loads symbol and source map files beneath the given URL.
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.
protected abstract  java.io.InputStream openInputStream(java.lang.String fileName)
          Opens a new InputStream for a symbol or source map file.
 java.lang.StackTraceElement[] resymbolize(java.lang.StackTraceElement[] st, java.lang.String strongName)
          Convenience method which resymbolizes an entire stack trace to extent possible.
 java.lang.StackTraceElement resymbolize(java.lang.StackTraceElement ste, java.lang.String strongName)
          Best effort resymbolization of a single stack trace element.
 void setLazyLoad(boolean lazyLoad)
          If set to true, only symbols requested to be deobfuscated are cached and the rest is discarded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackTraceDeobfuscator

public StackTraceDeobfuscator()
Method Detail

fromResource

public static StackTraceDeobfuscator fromResource(java.lang.String symbolMapsPath)
Creates a deobfuscator that loads symbol and source map files under given resource path. Uses StackTraceObfuscator's ClassLoader.


fromFileSystem

public static StackTraceDeobfuscator fromFileSystem(java.lang.String symbolMapsDirectory)
Creates a deobfuscator that loads symbol and source map files from the given directory.


fromUrl

public static StackTraceDeobfuscator fromUrl(java.net.URL urlPath)
Creates a deobfuscator that loads symbol and source map files beneath the given URL.


setLazyLoad

public void setLazyLoad(boolean lazyLoad)
If set to true, only symbols requested to be deobfuscated are cached and the rest is discarded. This provides a large memory savings at the expense of occasional extra disk reads. Note that, this will only have effect on symbol maps that haven't been fully loaded yet.


deobfuscateStackTrace

public final void deobfuscateStackTrace(java.lang.Throwable throwable,
                                        java.lang.String strongName)
Replaces the stack traces in the given Throwable and its causes with deobfuscated stack traces wherever possible.

Parameters:
throwable - the Throwable that needs its stack trace to be deobfuscated
strongName - the GWT permutation strong name

resymbolize

public final java.lang.StackTraceElement[] resymbolize(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

resymbolize

public final 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

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.

Parameters:
permutationStrongName - the GWT permutation strong name
Returns:
a new InputStream
Throws:
java.io.IOException

openInputStream

protected abstract java.io.InputStream openInputStream(java.lang.String fileName)
                                                throws java.io.IOException
Opens a new InputStream for a symbol or source map file.

Parameters:
fileName - name of the symbol or source map file
Returns:
an input stream for reading the file (doesn't need to be buffered).
Throws:
java.io.IOException - if an I/O error occurs while creating the input stream.

GWT 2.7.0