File tree Expand file tree Collapse file tree
main/java/com/gargoylesoftware/css/dom
test/java/com/gargoylesoftware/css/dom Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import com .gargoylesoftware .css .parser .CSSException ;
2222import com .gargoylesoftware .css .parser .CSSOMParser ;
2323import com .gargoylesoftware .css .util .LangUtils ;
24+ import com .gargoylesoftware .css .util .ThrowCssExceptionErrorHandler ;
2425
2526/**
2627 * Implementation of CSSPageRule.
@@ -80,6 +81,7 @@ public String getCssText() {
8081 public void setCssText (final String cssText ) throws DOMException {
8182 try {
8283 final CSSOMParser parser = new CSSOMParser ();
84+ parser .setErrorHandler (ThrowCssExceptionErrorHandler .INSTANCE );
8385 final AbstractCSSRuleImpl r = parser .parseRule (cssText );
8486
8587 // The rule must be a page rule
@@ -124,6 +126,7 @@ public String getSelectorText() {
124126 public void setSelectorText (final String selectorText ) throws DOMException {
125127 try {
126128 final CSSOMParser parser = new CSSOMParser ();
129+ parser .setErrorHandler (ThrowCssExceptionErrorHandler .INSTANCE );
127130 final AbstractCSSRuleImpl r = parser .parseRule ("@page " + selectorText + " {}" );
128131
129132 // The rule must be a page rule
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ public void setSelectorTextInvalid() throws Exception {
104104 fail ("DOMException expected" );
105105 }
106106 catch (final DOMException e ) {
107- assertTrue (e .getMessage ().startsWith ("The text does not represent a page rule (null) " ), e .getMessage ());
107+ assertTrue (e .getMessage ().startsWith ("Syntax error " ), e .getMessage ());
108108 }
109109 assertEquals ("" , value .getSelectorText ());
110110 assertEquals ("@page { color: blue; }" , value .getCssText ());
You can’t perform that action at this time.
0 commit comments