Class DefaultErrorHandler

java.lang.Object
io.sf.carte.doc.style.css.om.DefaultErrorHandler
All Implemented Interfaces:
ErrorHandler

public abstract class DefaultErrorHandler extends Object
  • Constructor Details

    • DefaultErrorHandler

      public DefaultErrorHandler()
  • Method Details

    • hasErrors

      public boolean hasErrors()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed any non-transient error.

      I/O errors are not taken into account by this method.

      Specified by:
      hasErrors in interface ErrorHandler
      Returns:
      true if this handler processed any non-transient errors.
    • linkedStyleError

      public void linkedStyleError(Node node, String message)
      Description copied from interface: ErrorHandler
      Report an error related to linked style, where it was not possible to create the style sheet linked from node due to an issue with the given node or other node in the document (as opposed to an issue with the linked style sheet itself).
      Parameters:
      node - the node where the error happened.
      message - a message describing the error.
    • linkedSheetError

      public void linkedSheetError(Exception e, CSSStyleSheet sheet)
      Description copied from interface: ErrorHandler
      Report an error associated to a LinkStyle style sheet (i.e. LINK or STYLE elements), that caused an exception to be thrown.
      Parameters:
      e - the exception describing the problem.
      sheet - the linked or embedded style sheet.
    • inlineStyleError

      public void inlineStyleError(CSSElement owner, Exception e, String style)
      Description copied from interface: ErrorHandler
      Report a problem with setting an inline style, that caused an exception to be thrown by lower-level parsing (SAC).

      This method is triggered only in two (unlikely) cases:

      1. If a problem appears when instantiating a SAC parser.
      2. When the SAC parser throws a CSSException.

      The NSAC parser does not throw a CSSException if there is an error handler set (and in this implementation there is always one), although other parsers may.

      Parameters:
      owner - the element owning the inline style.
      e - the exception describing the problem.
      style - the inline style.
    • reset

      public void reset()
      Description copied from interface: ErrorHandler
      Reset the error handler.

      After calling this method, ErrorHandler.hasErrors() and ErrorHandler.hasWarnings() must return false;

      Specified by:
      reset in interface ErrorHandler
    • getLinkedStyleErrors

      public LinkedHashMap<Node,String> getLinkedStyleErrors()
    • getInlineStyleErrors

      public LinkedHashMap<Exception,String> getInlineStyleErrors()
    • getLinkedSheetErrors

      public LinkedHashMap<Exception,CSSStyleSheet> getLinkedSheetErrors()
    • getInlineStyleErrorHandler

      public StyleDeclarationErrorHandler getInlineStyleErrorHandler(CSSElement owner)
      Description copied from interface: ErrorHandler
      Get the error handler for the given element's inline style.
      Specified by:
      getInlineStyleErrorHandler in interface ErrorHandler
      Parameters:
      owner - the element that owns the inline style.
      Returns:
      the style's error handler. Implementations are allowed to return null if the element has no inline style.
    • getInlineStyleOwners

      public Set<CSSElement> getInlineStyleOwners()
      Gets the owners of inline styles that have been processed through this handler.
      Returns:
      the owners of the inline styles with error handlers, or null if this handler has not processed any inline style.
    • hasInlineErrors

      protected boolean hasInlineErrors()
    • hasInlineWarnings

      protected boolean hasInlineWarnings()
    • policyError

      public void policyError(Node node, String message)
      Description copied from interface: ErrorHandler
      Report a policy error, including possible security issues.
      Specified by:
      policyError in interface ErrorHandler
      Parameters:
      node - the node that caused the policy violation, or where it was detected.
      message - a message describing the error.
    • computedStyleError

      public void computedStyleError(CSSElement element, String propertyName, CSSPropertyValueException exception)
      Description copied from interface: ErrorHandler
      Error found in computed style declaration.

      This means that an error could only be found when processing the values for computing the style.

      Specified by:
      computedStyleError in interface ErrorHandler
      Parameters:
      element - the element for which the style was computed.
      propertyName - the name of the property involved in error.
      exception - the exception describing the error.
    • mediaQueryError

      public void mediaQueryError(Node ownerNode, CSSMediaException exception)
      Description copied from interface: ErrorHandler
      Report a media query error.
      Specified by:
      mediaQueryError in interface ErrorHandler
      Parameters:
      ownerNode - the node that ultimately owns the sheet or rule where the media query appears (even if it is inside a nested sheet/rule, the node responsible is the one that owns the top-most style sheet).
      exception - the exception describing the error.
    • ruleIOError

      @Deprecated public void ruleIOError(String uri, IOException exception)
      Deprecated.
      Description copied from interface: ErrorHandler
      A I/O error was produced when retrieving a resource while processing a rule, generally an @import or @font-face rule.
      Specified by:
      ruleIOError in interface ErrorHandler
      Parameters:
      uri - the uri for the resource.
      exception - the exception describing the problem.
      See Also:
    • ioError

      public void ioError(String uri, IOException exception)
      Description copied from interface: ErrorHandler
      A I/O error was found when retrieving a resource while processing an attribute (usually href) or a rule, generally an @import or @font-face rule.
      Specified by:
      ioError in interface ErrorHandler
      Parameters:
      uri - the uri for the resource.
      exception - the exception describing the problem.
    • hasPolicyErrors

      public boolean hasPolicyErrors()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed any policy errors.
      Specified by:
      hasPolicyErrors in interface ErrorHandler
      Returns:
      true if this handler processed any policy errors.
    • hasIOErrors

      public boolean hasIOErrors()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed any I/O errors.
      Specified by:
      hasIOErrors in interface ErrorHandler
      Returns:
      true if this handler processed any I/O errors.
    • hasComputedStyleErrors

      public boolean hasComputedStyleErrors()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed computed style errors.

      Presentational hint errors are included in this category, as they are found during style computation.

      Specified by:
      hasComputedStyleErrors in interface ErrorHandler
      Returns:
      true if this handler processed computed style errors.
    • hasComputedStyleErrors

      public boolean hasComputedStyleErrors(CSSElement element)
      Description copied from interface: ErrorHandler
      Check whether this handler has processed computed style errors for the given element.

      Presentational hint errors are included in this category, as they are found during style computation.

      Specified by:
      hasComputedStyleErrors in interface ErrorHandler
      Parameters:
      element - the element.
      Returns:
      true if this handler processed computed style errors.
    • hasMediaErrors

      public boolean hasMediaErrors()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed any media-related errors.
      Specified by:
      hasMediaErrors in interface ErrorHandler
      Returns:
      true if this handler processed any media-related errors.
    • hasWarnings

      public boolean hasWarnings()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed any warnings.
      Specified by:
      hasWarnings in interface ErrorHandler
      Returns:
      true if this handler processed any warnings.
    • hasMediaWarnings

      public boolean hasMediaWarnings()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed any media-related warnings.
      Specified by:
      hasMediaWarnings in interface ErrorHandler
      Returns:
      true if this handler processed any media-related warnings.
    • hasComputedStyleWarnings

      public boolean hasComputedStyleWarnings()
      Description copied from interface: ErrorHandler
      Check whether this handler has processed computed style warnings.
      Specified by:
      hasComputedStyleWarnings in interface ErrorHandler
      Returns:
      true if this handler processed computed style warnings.
    • hasComputedStyleWarnings

      public boolean hasComputedStyleWarnings(CSSElement element)
      Description copied from interface: ErrorHandler
      Check whether this handler has processed computed style warnings for the given element.
      Specified by:
      hasComputedStyleWarnings in interface ErrorHandler
      Parameters:
      element - the element.
      Returns:
      true if this handler processed computed style warnings.
    • computedStyleWarning

      public void computedStyleWarning(CSSElement element, String propertyName, CSSPropertyValueException exception)
      Description copied from interface: ErrorHandler
      Error found in computed style declaration.

      This means that an error could only be found when processing the values for computing the style.

      Specified by:
      computedStyleWarning in interface ErrorHandler
      Parameters:
      element - the element for which the style was computed.
      propertyName - the property name.
      exception - the exception describing the error.
    • mediaQueryWarning

      public void mediaQueryWarning(Node ownerNode, CSSMediaException exception)
      Description copied from interface: ErrorHandler
      Report a media query warning.
      Specified by:
      mediaQueryWarning in interface ErrorHandler
      Parameters:
      ownerNode - the node that ultimately owns the sheet or rule where the media query appears (even if it is inside a nested sheet/rule, the node responsible is the one that owns the top-most style sheet).
      exception - the exception describing the issue.
    • getPolicyError

      public String getPolicyError(Node node)
    • getComputedStyleErrors

      public HashMap<String,CSSPropertyValueException> getComputedStyleErrors(CSSElement element)
    • getHintErrors

      public List<DOMException> getHintErrors(CSSElement element)
    • getComputedStyleWarnings

      public HashMap<String,CSSPropertyValueException> getComputedStyleWarnings(CSSElement element)
    • getPolicyErrors

      public HashMap<Node,String> getPolicyErrors()
    • getMediaErrors

      public HashMap<Node,CSSMediaException> getMediaErrors()
    • getRuleIOErrors

      @Deprecated public HashMap<String,IOException> getRuleIOErrors()
      Deprecated.
    • getIOErrors

      public HashMap<String,IOException> getIOErrors()
    • resetComputedStyleErrors

      public void resetComputedStyleErrors(CSSElement element)
      Description copied from interface: ErrorHandler
      Reset the error state about computed styles and presentational hints for the given element.
      Specified by:
      resetComputedStyleErrors in interface ErrorHandler
    • resetComputedStyleErrors

      public void resetComputedStyleErrors()
      Description copied from interface: ErrorHandler
      Reset the error state about computed styles and presentational hints.
      Specified by:
      resetComputedStyleErrors in interface ErrorHandler
    • presentationalHintError

      public void presentationalHintError(CSSElement elm, DOMException ex)
      Description copied from interface: ErrorHandler
      While computing a style, an error was found when processing the presentational hints of an element.
      Specified by:
      presentationalHintError in interface ErrorHandler
      Parameters:
      elm - the element.
      ex - the exception describing the error found.
    • getStyleSheetFactory

      protected abstract AbstractCSSStyleSheetFactory getStyleSheetFactory()