public abstract class StackTraceDeobfuscator extends Object
<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 and Description |
---|
StackTraceDeobfuscator() |
Modifier and Type | Method and Description |
---|---|
void |
deobfuscateStackTrace(Throwable throwable,
String strongName)
Replaces the stack traces in the given Throwable and its causes with deobfuscated stack traces
wherever possible.
|
static StackTraceDeobfuscator |
fromFileSystem(String symbolMapsDirectory)
Creates a deobfuscator that loads symbol and source map files from the given directory.
|
static StackTraceDeobfuscator |
fromResource(String symbolMapsPath)
Creates a deobfuscator that loads symbol and source map files under given resource path.
|
static StackTraceDeobfuscator |
fromUrl(URL urlPath)
Creates a deobfuscator that loads symbol and source map files beneath the given URL.
|
protected InputStream |
getSourceMapInputStream(String permutationStrongName,
int fragmentNumber) |
protected InputStream |
getSymbolMapInputStream(String permutationStrongName)
Retrieves a new
InputStream for the given permutation strong name. |
protected abstract InputStream |
openInputStream(String fileName)
Opens a new
InputStream for a symbol or source map file. |
StackTraceElement[] |
resymbolize(StackTraceElement[] st,
String strongName)
Convenience method which resymbolizes an entire stack trace to extent possible.
|
StackTraceElement |
resymbolize(StackTraceElement ste,
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. |
public static StackTraceDeobfuscator fromResource(String symbolMapsPath)
ClassLoader
.public static StackTraceDeobfuscator fromFileSystem(String symbolMapsDirectory)
public static StackTraceDeobfuscator fromUrl(URL urlPath)
public void setLazyLoad(boolean lazyLoad)
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.public final void deobfuscateStackTrace(Throwable throwable, String strongName)
throwable
- the Throwable that needs its stack trace to be deobfuscatedstrongName
- the GWT permutation strong namepublic final StackTraceElement[] resymbolize(StackTraceElement[] st, String strongName)
st
- the stack trace to resymbolizestrongName
- the GWT permutation strong namepublic final StackTraceElement resymbolize(StackTraceElement ste, String strongName)
ste
- the stack trace element to resymbolizestrongName
- the GWT permutation strong nameprotected InputStream getSourceMapInputStream(String permutationStrongName, int fragmentNumber) throws IOException
IOException
protected InputStream getSymbolMapInputStream(String permutationStrongName) throws IOException
InputStream
for the given permutation strong name. This implementation,
which subclasses may override, returns a InputStream
for the
permutation-strong-name.symbolMap
file.permutationStrongName
- the GWT permutation strong nameInputStream
IOException
protected abstract InputStream openInputStream(String fileName) throws IOException
InputStream
for a symbol or source map file.fileName
- name of the symbol or source map fileIOException
- if an I/O error occurs while creating the input stream.Copyright © 2018. All rights reserved.