public class GrailsUtil extends java.lang.Object
Grails utility methods for command line and GUI applications.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static java.lang.Throwable |
deepSanitize(java.lang.Throwable t) |
|
public static void |
deprecated(java.lang.Class<?> clazz, java.lang.String methodOrPropName)Logs warning message about deprecation of specified property or method of some class. |
|
public static void |
deprecated(java.lang.Class<?> clazz, java.lang.String methodOrPropName, java.lang.String version)Logs warning message about deprecation of specified property or method of some class. |
|
public static void |
deprecated(java.lang.String message)Logs warning message about some deprecation and code style related hints. |
|
public static java.lang.Throwable |
extractRootCause(java.lang.Throwable t) |
|
public static java.lang.String |
getGrailsVersion() |
|
public static void |
initializeStackFilterer(StackTraceFilterer filterer)Installs the given StackTraceFilterer, replacing the default fallback, so that request-time callers of the static sanitize/deepSanitize methods see the
configured instance. |
|
public static boolean |
isDevelopmentEnv()Retrieves whether the current execution environment is the development one. |
|
public static void |
printSanitizedStackTrace(java.lang.Throwable t, java.io.PrintWriter p) |
|
public static void |
printSanitizedStackTrace(java.lang.Throwable t, java.io.PrintWriter p, StackTraceFilterer stackTraceFilterer) |
|
public static void |
printSanitizedStackTrace(java.lang.Throwable t) |
|
public static java.lang.Throwable |
sanitizeRootCause(java.lang.Throwable t) |
|
public static void |
warn(java.lang.String message)Logs warning message to grails.util.GrailsUtil logger which is turned on in development mode. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Sanitize the exception and ALL nested causes
This will MODIFY the stacktrace of the exception instance and all its causes irreversibly
Logs warning message about deprecation of specified property or method of some class.
clazz - A classmethodOrPropName - Name of deprecated property or methodLogs warning message about deprecation of specified property or method of some class.
clazz - A classmethodOrPropName - Name of deprecated property or methodversion - Version of Grails release in which property or method were deprecatedLogs warning message about some deprecation and code style related hints.
message - Message to display
Extracts the root cause of the exception, no matter how nested it is
Installs the given StackTraceFilterer, replacing the default fallback, so that
request-time callers of the static sanitize/deepSanitize methods see the
configured instance. Called by GrailsBootstrapRegistryInitializer
once the config-resolved filterer is available — before the ApplicationContext
refreshes, so every app type (web or not) is covered, not just apps that wire a
GrailsExceptionResolver bean.
GrailsUtil intentionally has no dependency on GrailsApplication or Spring's
Environment here — the caller is responsible for resolving the configured class and
logFullStackTraceOnFilter flag and handing over a ready-to-use instance.
No-ops when filterer is null. Safe to call more than once — the last call wins.
The installed filterer is JVM-global rather than per-context, so in a JVM hosting more than
one application context the last one booted supplies the filterer for all of them.
Retrieves whether the current execution environment is the development one.
Get the root cause of an exception and sanitize it for display to the user
This will MODIFY the stacktrace of the root cause exception object and return it
Logs warning message to grails.util.GrailsUtil logger which is turned on in development mode.
message - Message to display