Package com.google.gwt.core.server
Class StackTraceDeobfuscator
- java.lang.Object
-
- com.google.gwt.core.server.StackTraceDeobfuscator
-
- Direct Known Subclasses:
StackTraceDeobfuscator
public abstract class StackTraceDeobfuscator extends java.lang.ObjectDeobfuscates 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.xmlmodule 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-deploycommand line argument to specify the location of the folder into which the generatedsymbolMapsdirectory is written. By default, the finalsymbolMapsdirectory iswar/WEB-INF/deploy/yourmodulename/symbolMaps/.
-
-
Constructor Summary
Constructors Constructor Description StackTraceDeobfuscator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddeobfuscateStackTrace(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 StackTraceDeobfuscatorfromFileSystem(java.lang.String symbolMapsDirectory)Creates a deobfuscator that loads symbol and source map files from the given directory.static StackTraceDeobfuscatorfromResource(java.lang.String symbolMapsPath)Creates a deobfuscator that loads symbol and source map files under given resource path.static StackTraceDeobfuscatorfromUrl(java.net.URL urlPath)Creates a deobfuscator that loads symbol and source map files beneath the given URL.protected java.io.InputStreamgetSourceMapInputStream(java.lang.String permutationStrongName, int fragmentNumber)protected java.io.InputStreamgetSymbolMapInputStream(java.lang.String permutationStrongName)Retrieves a newInputStreamfor the given permutation strong name.protected abstract java.io.InputStreamopenInputStream(java.lang.String fileName)Opens a newInputStreamfor 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.StackTraceElementresymbolize(java.lang.StackTraceElement ste, java.lang.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.
-
-
-
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'sClassLoader.
-
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 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
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 deobfuscatedstrongName- 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 resymbolizestrongName- 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 resymbolizestrongName- 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.IOExceptionRetrieves 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:
java.io.IOException
-
openInputStream
protected abstract java.io.InputStream openInputStream(java.lang.String fileName) throws java.io.IOExceptionOpens 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:
java.io.IOException- if an I/O error occurs while creating the input stream.
-
-