Package com.google.gwt.core.server
Class StackTraceDeobfuscator
java.lang.Object
com.google.gwt.core.server.StackTraceDeobfuscator
- Direct Known Subclasses:
StackTraceDeobfuscator
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voiddeobfuscateStackTrace(Throwable throwable, String strongName) Replaces the stack traces in the given Throwable and its causes with deobfuscated stack traces wherever possible.static StackTraceDeobfuscatorfromFileSystem(String symbolMapsDirectory) Creates a deobfuscator that loads symbol and source map files from the given directory.static StackTraceDeobfuscatorfromResource(String symbolMapsPath) Creates a deobfuscator that loads symbol and source map files under given resource path.static StackTraceDeobfuscatorCreates a deobfuscator that loads symbol and source map files beneath the given URL.protected InputStreamgetSourceMapInputStream(String permutationStrongName, int fragmentNumber) protected InputStreamgetSymbolMapInputStream(String permutationStrongName) Retrieves a newInputStreamfor the given permutation strong name.protected abstract InputStreamopenInputStream(String fileName) Opens a newInputStreamfor a symbol or source map file.final StackTraceElement[]resymbolize(StackTraceElement[] st, String strongName) Convenience method which resymbolizes an entire stack trace to extent possible.final StackTraceElementresymbolize(StackTraceElement ste, String strongName) Best effort resymbolization of a single stack trace element.voidsetLazyLoad(boolean lazyLoad) If set totrue, only symbols requested to be deobfuscated are cached and the rest is discarded.
-
Constructor Details
-
StackTraceDeobfuscator
public StackTraceDeobfuscator()
-
-
Method Details
-
fromResource
Creates a deobfuscator that loads symbol and source map files under given resource path. Uses StackTraceObfuscator'sClassLoader. -
fromFileSystem
Creates a deobfuscator that loads symbol and source map files from the given directory. -
fromUrl
Creates a deobfuscator that loads symbol and source map files beneath the given URL. -
setLazyLoad
public void setLazyLoad(boolean lazyLoad) If set totrue, 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
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 deobfuscatedstrongName- the GWT permutation strong name
-
resymbolize
Convenience method which resymbolizes an entire stack trace to extent possible.- Parameters:
st- the stack trace to resymbolizestrongName- the GWT permutation strong name- Returns:
- a best effort resymbolized stack trace
-
resymbolize
Best effort resymbolization of a single stack trace element.- Parameters:
ste- the stack trace element to resymbolizestrongName- the GWT permutation strong name- Returns:
- the best effort resymbolized stack trace element
-
getSourceMapInputStream
protected InputStream getSourceMapInputStream(String permutationStrongName, int fragmentNumber) throws IOException - Throws:
IOException
-
getSymbolMapInputStream
Retrieves a newInputStreamfor the given permutation strong name. This implementation, which subclasses may override, returns aInputStreamfor thepermutation-strong-name.symbolMapfile.- Parameters:
permutationStrongName- the GWT permutation strong name- Returns:
- a new
InputStream - Throws:
IOException
-
openInputStream
Opens a newInputStreamfor 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:
IOException- if an I/O error occurs while creating the input stream.
-