- All Implemented Interfaces:
ErrorHandler
ErrorHandler
that uses SLF4J logging.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
computedStyleError
(CSSElement element, String propertyName, CSSPropertyValueException exception) Error found in computed style declaration.void
computedStyleWarning
(CSSElement element, String propertyName, CSSPropertyValueException exception) Error found in computed style declaration.getComputedStyleErrors
(CSSElement element) getComputedStyleWarnings
(CSSElement element) getHintErrors
(CSSElement element) Get the error handler for the given element's inline style.Gets the owners of inline styles that have been processed through this handler.getPolicyError
(Node node) Deprecated.protected abstract AbstractCSSStyleSheetFactory
boolean
Check whether this handler has processed computed style errors.boolean
hasComputedStyleErrors
(CSSElement element) Check whether this handler has processed computed style errors for the given element.boolean
Check whether this handler has processed computed style warnings.boolean
hasComputedStyleWarnings
(CSSElement element) Check whether this handler has processed computed style warnings for the given element.boolean
Check whether this handler has processed any non-transient error.protected boolean
protected boolean
boolean
Check whether this handler has processed any I/O errors.boolean
Check whether this handler has processed any media-related errors.boolean
Check whether this handler has processed any media-related warnings.boolean
Check whether this handler has processed any policy errors.boolean
Check whether this handler has processed any warnings.void
inlineStyleError
(CSSElement owner, Exception e, String context) Report a problem with setting an inline style, that caused an exception to be thrown by lower-level parsing (SAC).void
ioError
(String uri, IOException exception) A I/O error was found when retrieving a resource while processing an attribute (usuallyhref
) or a rule, generally an @import or @font-face rule.void
linkedSheetError
(Exception e, CSSStyleSheet sheet) Report an error associated to aLinkStyle
style sheet (i.e.void
linkedStyleError
(Node node, String message) Report an error related to linked style, where it was not possible to create the style sheet linked fromnode
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).void
mediaQueryError
(Node node, CSSMediaException exception) Report a media query error.void
mediaQueryWarning
(Node ownerNode, CSSMediaException exception) Report a media query warning.void
policyError
(Node node, String message) Report a policy error, including possible security issues.void
While computing a style, an error was found when processing the presentational hints of an element.void
reset()
Reset the error handler.void
Reset the error state about computed styles and presentational hints.void
resetComputedStyleErrors
(CSSElement element) Reset the error state about computed styles and presentational hints for the given element.void
ruleIOError
(String uri, IOException exception) Deprecated.
-
Constructor Details
-
LogErrorHandler
public LogErrorHandler()
-
-
Method Details
-
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 interfaceErrorHandler
- Returns:
true
if this handler processed computed style errors.
-
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 interfaceErrorHandler
- Returns:
true
if this handler processed any non-transient errors.
-
hasWarnings
public boolean hasWarnings()Description copied from interface:ErrorHandler
Check whether this handler has processed any warnings.- Specified by:
hasWarnings
in interfaceErrorHandler
- Returns:
true
if this handler processed any warnings.
-
linkedStyleError
Description copied from interface:ErrorHandler
Report an error related to linked style, where it was not possible to create the style sheet linked fromnode
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.
-
mediaQueryError
Description copied from interface:ErrorHandler
Report a media query error.- Specified by:
mediaQueryError
in interfaceErrorHandler
- Parameters:
node
- 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.
-
linkedSheetError
Description copied from interface:ErrorHandler
Report an error associated to aLinkStyle
style sheet (i.e.LINK
orSTYLE
elements), that caused an exception to be thrown.- Parameters:
e
- the exception describing the problem.sheet
- the linked or embedded style sheet.
-
inlineStyleError
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:
- If a problem appears when instantiating a SAC parser.
- 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.context
- the inline style.
-
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 interfaceErrorHandler
- 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.
-
presentationalHintError
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 interfaceErrorHandler
- Parameters:
elm
- the element.e
- the exception describing the error found.
-
resetComputedStyleErrors
public void resetComputedStyleErrors()Description copied from interface:ErrorHandler
Reset the error state about computed styles and presentational hints.- Specified by:
resetComputedStyleErrors
in interfaceErrorHandler
-
reset
public void reset()Description copied from interface:ErrorHandler
Reset the error handler.After calling this method,
ErrorHandler.hasErrors()
andErrorHandler.hasWarnings()
must return false;- Specified by:
reset
in interfaceErrorHandler
-
getInlineStyleErrorHandler
Description copied from interface:ErrorHandler
Get the error handler for the given element's inline style.- Specified by:
getInlineStyleErrorHandler
in interfaceErrorHandler
- 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
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
Description copied from interface:ErrorHandler
Report a policy error, including possible security issues.- Specified by:
policyError
in interfaceErrorHandler
- Parameters:
node
- the node that caused the policy violation, or where it was detected.message
- a message describing the error.
-
ruleIOError
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 interfaceErrorHandler
- Parameters:
uri
- the uri for the resource.exception
- the exception describing the problem.- See Also:
-
ioError
Description copied from interface:ErrorHandler
A I/O error was found when retrieving a resource while processing an attribute (usuallyhref
) or a rule, generally an @import or @font-face rule.- Specified by:
ioError
in interfaceErrorHandler
- 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 interfaceErrorHandler
- 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 interfaceErrorHandler
- Returns:
true
if this handler processed any I/O errors.
-
hasComputedStyleErrors
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 interfaceErrorHandler
- 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 interfaceErrorHandler
- Returns:
true
if this handler processed any media-related errors.
-
hasMediaWarnings
public boolean hasMediaWarnings()Description copied from interface:ErrorHandler
Check whether this handler has processed any media-related warnings.- Specified by:
hasMediaWarnings
in interfaceErrorHandler
- 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 interfaceErrorHandler
- Returns:
true
if this handler processed computed style warnings.
-
hasComputedStyleWarnings
Description copied from interface:ErrorHandler
Check whether this handler has processed computed style warnings for the given element.- Specified by:
hasComputedStyleWarnings
in interfaceErrorHandler
- 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 interfaceErrorHandler
- Parameters:
element
- the element for which the style was computed.propertyName
- the property name.exception
- the exception describing the error.
-
mediaQueryWarning
Description copied from interface:ErrorHandler
Report a media query warning.- Specified by:
mediaQueryWarning
in interfaceErrorHandler
- 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
-
getComputedStyleErrors
-
getHintErrors
-
getComputedStyleWarnings
-
getPolicyErrors
-
getMediaErrors
-
getRuleIOErrors
Deprecated. -
getIOErrors
-
resetComputedStyleErrors
Description copied from interface:ErrorHandler
Reset the error state about computed styles and presentational hints for the given element.- Specified by:
resetComputedStyleErrors
in interfaceErrorHandler
-
getStyleSheetFactory
-