Package xcrash

Class TombstoneManager


  • public class TombstoneManager
    extends java.lang.Object
    Tombstone (crash) log file manager.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean appendSection​(java.lang.String logPath, java.lang.String key, java.lang.String content)
      Append a customs section (a key-content pair) to the crash log file.
      static boolean clearAllTombstones()
      Delete all Java exception, native crash and ANR log files.
      static boolean clearAnrTombstones()
      Delete all ANR log files.
      static boolean clearJavaTombstones()
      Delete all Java exception log files.
      static boolean clearNativeTombstones()
      Delete all native crash log files.
      static boolean deleteTombstone​(java.io.File file)
      Delete the tombstone file.
      static boolean deleteTombstone​(java.lang.String path)
      Delete the tombstone file.
      static java.io.File[] getAllTombstones()
      Get all Java exception, native crash and ANR log files.
      static java.io.File[] getAnrTombstones()
      Get all ANR log files.
      static java.io.File[] getJavaTombstones()
      Get all Java exception log files.
      static java.io.File[] getNativeTombstones()
      Get all native crash log files.
      static boolean isAnr​(java.io.File log)
      Determines if the current log file recorded an ANR.
      static boolean isJavaCrash​(java.io.File log)
      Determines if the current log file recorded a Java exception.
      static boolean isNativeCrash​(java.io.File log)
      Determines if the current log file recorded a native crash.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • appendSection

        public static boolean appendSection​(java.lang.String logPath,
                                            java.lang.String key,
                                            java.lang.String content)
        Append a customs section (a key-content pair) to the crash log file. After parsing the crash log file by TombstoneParser, you can retrieve the content with the key specified here.

        Note: This method is generally used in ICrashCallback.onCrash(String, String).

        Warning: Do NOT include multiple consecutive newline characters ("\n\n") in the content string. This will break the parsing rules.

        Parameters:
        logPath - Absolute path of the crash log file.
        key - Section key.
        content - Section content.
        Returns:
        Return true if successful, false otherwise.
      • isJavaCrash

        public static boolean isJavaCrash​(java.io.File log)
        Determines if the current log file recorded a Java exception.
        Parameters:
        log - Object of the log file.
        Returns:
        Return true if YES, false otherwise.
      • isNativeCrash

        public static boolean isNativeCrash​(java.io.File log)
        Determines if the current log file recorded a native crash.
        Parameters:
        log - Object of the log file.
        Returns:
        Return true if YES, false otherwise.
      • isAnr

        public static boolean isAnr​(java.io.File log)
        Determines if the current log file recorded an ANR.
        Parameters:
        log - Object of the log file.
        Returns:
        Return true if YES, false otherwise.
      • getJavaTombstones

        public static java.io.File[] getJavaTombstones()
        Get all Java exception log files.
        Returns:
        An array of File objects of the Java exception log files.
      • getNativeTombstones

        public static java.io.File[] getNativeTombstones()
        Get all native crash log files.
        Returns:
        An array of File objects of the native crash log files.
      • getAnrTombstones

        public static java.io.File[] getAnrTombstones()
        Get all ANR log files.
        Returns:
        An array of File objects of the ANR log files.
      • getAllTombstones

        public static java.io.File[] getAllTombstones()
        Get all Java exception, native crash and ANR log files.
        Returns:
        An array of File objects of the Java exception, native crash and ANR log files.
      • deleteTombstone

        public static boolean deleteTombstone​(java.io.File file)
        Delete the tombstone file.

        Note: When you use the placeholder file feature by XCrash.InitParameters.setPlaceholderCountMax(int), please always use this method to delete tombstone files.

        Parameters:
        file - The tombstone file object.
        Returns:
        Return true if successful, false otherwise.
      • deleteTombstone

        public static boolean deleteTombstone​(java.lang.String path)
        Delete the tombstone file.

        Note: When you use the placeholder file feature by XCrash.InitParameters.setPlaceholderCountMax(int), please always use this method to delete tombstone files.

        Parameters:
        path - The path of the tombstone file.
        Returns:
        Return true if successful, false otherwise.
      • clearJavaTombstones

        public static boolean clearJavaTombstones()
        Delete all Java exception log files.
        Returns:
        Return true if successful, false otherwise.
      • clearNativeTombstones

        public static boolean clearNativeTombstones()
        Delete all native crash log files.
        Returns:
        Return true if successful, false otherwise.
      • clearAnrTombstones

        public static boolean clearAnrTombstones()
        Delete all ANR log files.
        Returns:
        Return true if successful, false otherwise.
      • clearAllTombstones

        public static boolean clearAllTombstones()
        Delete all Java exception, native crash and ANR log files.
        Returns:
        Return true if successful, false otherwise.