Skip to content

Commit 7e8b717

Browse files
committed
% simplify
1 parent 8732ae1 commit 7e8b717

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

src/main/java/com/gargoylesoftware/css/dom/CSSRuleListImpl.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,12 @@
3030
*/
3131
public class CSSRuleListImpl implements CSSRuleList, Serializable {
3232

33-
private List<CSSRule> rules_;
33+
private List<CSSRule> rules_ = new ArrayList<CSSRule>();
3434

3535
public List<CSSRule> getRules() {
36-
if (rules_ == null) {
37-
rules_ = new ArrayList<CSSRule>();
38-
}
3936
return rules_;
4037
}
4138

42-
public void setRules(final List<CSSRule> rules) {
43-
rules_ = rules;
44-
}
45-
4639
public CSSRuleListImpl() {
4740
super();
4841
}

src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import org.w3c.dom.DOMException;
2121
import org.w3c.dom.css.CSSRule;
2222
import org.w3c.dom.css.CSSStyleDeclaration;
23-
import org.w3c.dom.css.CSSStyleSheet;
2423
import org.w3c.dom.css.CSSValue;
2524

2625
import com.gargoylesoftware.css.dom.CSSCharsetRuleImpl;
@@ -68,14 +67,14 @@ public void setErrorHandler(final CSSErrorHandler eh) {
6867
* @return the CSSOM style sheet
6968
* @throws IOException if the underlying SAC parser throws an IOException
7069
*/
71-
public CSSStyleSheet parseStyleSheet(final InputSource source, final String href) throws IOException {
70+
public CSSStyleSheetImpl parseStyleSheet(final InputSource source, final String href) throws IOException {
7271
final CSSOMHandler handler = new CSSOMHandler();
7372
handler.setHref(href);
7473
parser_.setDocumentHandler(handler);
7574
parser_.parseStyleSheet(source);
7675
final Object o = handler.getRoot();
77-
if (o instanceof CSSStyleSheet) {
78-
return (CSSStyleSheet) o;
76+
if (o instanceof CSSStyleSheetImpl) {
77+
return (CSSStyleSheetImpl) o;
7978
}
8079
return null;
8180
}

0 commit comments

Comments
 (0)