Class ErrorHandler.Report

Object
Report
Enclosing interface:
ErrorHandler

public static class ErrorHandler.Report extends Object
Information about errors that occurred while reading or writing tiles in an image. A single Report may be generated for failures in more than one tiles.

Multi-threading

This class is safe for use in multi-threading. The synchronization lock is this. However the Log­Record instance returned by get­Description() is not thread-safe. Operations applied on the Log­Record should be inside a block synchronized on the Report​.this lock.
  • Constructor Details

    • Report

      public Report()
      Creates an initially empty report. Error reports can be added by calls to add(…).
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns true if no error has been reported. This is true only if the add(…) method has never been invoked.
      Returns:
      whether this report is empty.
    • add

      public boolean add(Point tile, Throwable error, Supplier<LogRecord> record)
      Reports an error that occurred while computing an image tile. This method can be invoked many times on the same Report instance.

      Logging information

      Report creates a Log­Record the first time that this add(…) method is invoked. The log record is created using the given supplier if non-null. That supplier should set the log level, message, source class name, source method name and logger name. The exception property will be set by this method.
      Parameters:
      tile - column (x) and row (y) indices of the tile where the error occurred, or null if unknown.
      error - the error that occurred.
      record - the record supplier, invoked only when this method is invoked for the first time. If null, a default Log­Record will be created.
      Returns:
      true if this is the first time that an error is reported (in which case a Log­Record instance has been created), or false if a Log­Record already exists.
    • getTileIndices

      public Point[] getTileIndices()
      Returns indices of all tiles where an error has been reported.
      Returns:
      indices of all tiles in error, or an empty array if none.
    • getDescription

      public LogRecord getDescription()
      Returns a description of the first error as a log record. The exception can be obtained by Log­Record​.get­Thrown(). If more than one error occurred, the other errors are reported as suppressed exceptions. The return value is never null unless this report is empty.
      Returns:
      errors description, or null if this report is empty.