From 5bc7dda82bd15cb33ae406a7c0f73b6f1e98466f Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 15 Mar 2018 18:15:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-6935=20=E6=89=93=E5=8C=85=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../steadystate/css/parser/CSSOMParser.java | 43 +++++++++---------- .../steadystate/css/parser/SACParserCSS1.java | 7 ++- .../steadystate/css/parser/SACParserCSS2.java | 3 +- .../css/parser/SACParserCSS21.java | 3 +- .../steadystate/css/parser/SACParserCSS3.java | 13 +++--- 5 files changed, 32 insertions(+), 37 deletions(-) diff --git a/fine-cssparser/src/com/fr/third/steadystate/css/parser/CSSOMParser.java b/fine-cssparser/src/com/fr/third/steadystate/css/parser/CSSOMParser.java index 88a7e6516..383e9b74f 100644 --- a/fine-cssparser/src/com/fr/third/steadystate/css/parser/CSSOMParser.java +++ b/fine-cssparser/src/com/fr/third/steadystate/css/parser/CSSOMParser.java @@ -15,14 +15,22 @@ package com.fr.third.steadystate.css.parser; -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Stack; -import java.util.logging.Logger; - +import com.fr.third.steadystate.css.dom.CSSCharsetRuleImpl; +import com.fr.third.steadystate.css.dom.CSSFontFaceRuleImpl; import com.fr.third.steadystate.css.dom.CSSImportRuleImpl; +import com.fr.third.steadystate.css.dom.CSSMediaRuleImpl; +import com.fr.third.steadystate.css.dom.CSSOMObject; +import com.fr.third.steadystate.css.dom.CSSPageRuleImpl; +import com.fr.third.steadystate.css.dom.CSSRuleListImpl; +import com.fr.third.steadystate.css.dom.CSSStyleDeclarationImpl; +import com.fr.third.steadystate.css.dom.CSSStyleRuleImpl; +import com.fr.third.steadystate.css.dom.CSSStyleSheetImpl; +import com.fr.third.steadystate.css.dom.CSSUnknownRuleImpl; +import com.fr.third.steadystate.css.dom.CSSValueImpl; +import com.fr.third.steadystate.css.dom.MediaListImpl; +import com.fr.third.steadystate.css.dom.Property; import com.fr.third.steadystate.css.sac.DocumentHandlerExt; +import com.fr.third.steadystate.css.userdata.UserDataConstants; import org.w3c.css.sac.CSSException; import org.w3c.css.sac.ErrorHandler; import org.w3c.css.sac.InputSource; @@ -39,20 +47,11 @@ import org.w3c.dom.css.CSSStyleDeclaration; import org.w3c.dom.css.CSSStyleSheet; import org.w3c.dom.css.CSSValue; -import com.fr.third.steadystate.css.dom.CSSCharsetRuleImpl; -import com.fr.third.steadystate.css.dom.CSSFontFaceRuleImpl; -import com.fr.third.steadystate.css.dom.CSSMediaRuleImpl; -import com.fr.third.steadystate.css.dom.CSSOMObject; -import com.fr.third.steadystate.css.dom.CSSPageRuleImpl; -import com.fr.third.steadystate.css.dom.CSSRuleListImpl; -import com.fr.third.steadystate.css.dom.CSSStyleDeclarationImpl; -import com.fr.third.steadystate.css.dom.CSSStyleRuleImpl; -import com.fr.third.steadystate.css.dom.CSSStyleSheetImpl; -import com.fr.third.steadystate.css.dom.CSSUnknownRuleImpl; -import com.fr.third.steadystate.css.dom.CSSValueImpl; -import com.fr.third.steadystate.css.dom.MediaListImpl; -import com.fr.third.steadystate.css.dom.Property; -import com.fr.third.steadystate.css.userdata.UserDataConstants; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Stack; +import java.util.logging.Logger; /** * @author David Schweinsberg @@ -60,7 +59,7 @@ import com.fr.third.steadystate.css.userdata.UserDataConstants; public class CSSOMParser { private static final Object LOCK = new Object(); - private static final String DEFAULT_PARSER = "com.steadystate.css.parser.SACParserCSS21"; + private static final String DEFAULT_PARSER = "com.fr.third.steadystate.css.parser.SACParserCSS21"; private static String LastFailed_; @@ -102,7 +101,7 @@ public class CSSOMParser { } } catch (final Exception e) { - final Logger log = Logger.getLogger("com.steadystate.css"); + final Logger log = Logger.getLogger("com.fr.third.steadystate.css"); log.warning(e.toString()); log.warning("using the default 'SACParserCSS21' instead"); log.throwing("CSSOMParser", "consturctor", e); diff --git a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS1.java b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS1.java index 7438371b2..ae859ba58 100644 --- a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS1.java +++ b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS1.java @@ -6,7 +6,6 @@ import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.Condition; import org.w3c.css.sac.LexicalUnit; import org.w3c.css.sac.Locator; -import org.w3c.css.sac.Parser; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.SimpleSelector; @@ -619,7 +618,7 @@ throw toCSSParseException("invalidSelector", e); break; } case HASH:{ -simpleSel = ((com.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); +simpleSel = ((com.fr.third.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); c = hash(c); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case DOT:{ @@ -644,7 +643,7 @@ simpleSel = ((com.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelec break; } case DOT:{ -simpleSel = ((com.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); +simpleSel = ((com.fr.third.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); c = _class(c); switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { case LINK_PSCLASS: @@ -662,7 +661,7 @@ simpleSel = ((com.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelec case LINK_PSCLASS: case VISITED_PSCLASS: case ACTIVE_PSCLASS:{ -simpleSel = ((com.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); +simpleSel = ((com.fr.third.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); c = pseudoClass(c); break; } diff --git a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS2.java b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS2.java index f6e160d90..8fa4e67c0 100644 --- a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS2.java +++ b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS2.java @@ -6,7 +6,6 @@ import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.Condition; import org.w3c.css.sac.LexicalUnit; import org.w3c.css.sac.Locator; -import org.w3c.css.sac.Parser; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.SimpleSelector; @@ -1265,7 +1264,7 @@ if (o instanceof Condition) case COLON: case LSQUARE: case HASH:{ -simpleSel = ((com.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); +simpleSel = ((com.fr.third.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); label_41: while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { diff --git a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS21.java b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS21.java index 695ea2295..1bbfe713d 100644 --- a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS21.java +++ b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS21.java @@ -6,7 +6,6 @@ import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.Condition; import org.w3c.css.sac.LexicalUnit; import org.w3c.css.sac.Locator; -import org.w3c.css.sac.Parser; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.SimpleSelector; @@ -1133,7 +1132,7 @@ if (o instanceof Condition) case COLON: case LSQUARE: case HASH:{ -simpleSel = ((com.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); +simpleSel = ((com.fr.third.steadystate.css.parser.selectors.SelectorFactoryImpl) getSelectorFactory()).createSyntheticElementSelector(); label_32: while (true) { switch ((jj_ntk==-1)?jj_ntk_f():jj_ntk) { diff --git a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS3.java b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS3.java index 01f16243b..7a13da52b 100644 --- a/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS3.java +++ b/fine-cssparser/src/com/fr/third/steadystate/css/parser/SACParserCSS3.java @@ -2,9 +2,6 @@ /* Generated By:JavaCC: Do not edit this line. SACParserCSS3.java */ package com.fr.third.steadystate.css.parser; -import java.util.LinkedList; -import java.util.Locale; - import com.fr.third.steadystate.css.dom.CSSValueImpl; import com.fr.third.steadystate.css.dom.Property; import com.fr.third.steadystate.css.format.CSSFormatable; @@ -14,11 +11,13 @@ import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.Condition; import org.w3c.css.sac.LexicalUnit; import org.w3c.css.sac.Locator; -import org.w3c.css.sac.Parser; import org.w3c.css.sac.Selector; import org.w3c.css.sac.SelectorList; import org.w3c.css.sac.SimpleSelector; +import java.util.LinkedList; +import java.util.Locale; + /** * @author David Schweinsberg * @author waldbaer @@ -1797,15 +1796,15 @@ Condition c = null; c = getConditionFactory().createBeginHyphenAttributeCondition(name, null, null != value, value); break; case 4: - c = ((com.steadystate.css.parser.selectors.ConditionFactoryImpl) getConditionFactory()) + c = ((com.fr.third.steadystate.css.parser.selectors.ConditionFactoryImpl) getConditionFactory()) .createPrefixAttributeCondition(name, null, null != value, value); break; case 5: - c = ((com.steadystate.css.parser.selectors.ConditionFactoryImpl) getConditionFactory()) + c = ((com.fr.third.steadystate.css.parser.selectors.ConditionFactoryImpl) getConditionFactory()) .createSuffixAttributeCondition(name, null, null != value, value); break; case 6: - c = ((com.steadystate.css.parser.selectors.ConditionFactoryImpl) getConditionFactory()) + c = ((com.fr.third.steadystate.css.parser.selectors.ConditionFactoryImpl) getConditionFactory()) .createSubstringAttributeCondition(name, null, null != value, value); break; } From c102cfcb0bf42bd1b012d52f9b5d56200aa46d5d Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 15 Mar 2018 18:18:27 +0800 Subject: [PATCH 2/2] rt --- .../steadystate/css/dom/DOMExceptionImpl.java | 6 ++-- .../css/parser/AbstractSACParser.java | 33 +++++++++---------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/fine-cssparser/src/com/fr/third/steadystate/css/dom/DOMExceptionImpl.java b/fine-cssparser/src/com/fr/third/steadystate/css/dom/DOMExceptionImpl.java index 5e8318c1f..ad1143866 100644 --- a/fine-cssparser/src/com/fr/third/steadystate/css/dom/DOMExceptionImpl.java +++ b/fine-cssparser/src/com/fr/third/steadystate/css/dom/DOMExceptionImpl.java @@ -15,11 +15,11 @@ package com.fr.third.steadystate.css.dom; +import org.w3c.dom.DOMException; + import java.util.Locale; import java.util.ResourceBundle; -import org.w3c.dom.DOMException; - /** * Custom {@link DOMException} extension. * @@ -54,7 +54,7 @@ public class DOMExceptionImpl extends DOMException { private static ResourceBundle ExceptionResource_ = ResourceBundle.getBundle( - "com.steadystate.css.parser.ExceptionResource", + "com.fr.third.steadystate.css.parser.ExceptionResource", Locale.getDefault()); public DOMExceptionImpl(final short code, final int messageKey) { diff --git a/fine-cssparser/src/com/fr/third/steadystate/css/parser/AbstractSACParser.java b/fine-cssparser/src/com/fr/third/steadystate/css/parser/AbstractSACParser.java index 1d18bed73..ef73e0daf 100644 --- a/fine-cssparser/src/com/fr/third/steadystate/css/parser/AbstractSACParser.java +++ b/fine-cssparser/src/com/fr/third/steadystate/css/parser/AbstractSACParser.java @@ -15,16 +15,14 @@ package com.fr.third.steadystate.css.parser; -import java.io.IOException; -import java.io.InputStreamReader; -import java.net.URL; -import java.nio.charset.Charset; -import java.text.MessageFormat; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - +import com.fr.third.steadystate.css.parser.selectors.ConditionFactoryImpl; +import com.fr.third.steadystate.css.parser.selectors.SelectorFactoryImpl; +import com.fr.third.steadystate.css.sac.ConditionFactoryAdapter; +import com.fr.third.steadystate.css.sac.ConditionFactoryExt; +import com.fr.third.steadystate.css.sac.DocumentHandlerAdapter; +import com.fr.third.steadystate.css.sac.DocumentHandlerExt; import com.fr.third.steadystate.css.sac.SelectorFactoryAdapter; +import com.fr.third.steadystate.css.sac.SelectorFactoryExt; import org.w3c.css.sac.CSSParseException; import org.w3c.css.sac.ConditionFactory; import org.w3c.css.sac.DocumentHandler; @@ -39,13 +37,14 @@ import org.w3c.css.sac.SelectorFactory; import org.w3c.css.sac.SelectorList; import org.w3c.dom.DOMException; -import com.fr.third.steadystate.css.parser.selectors.ConditionFactoryImpl; -import com.fr.third.steadystate.css.parser.selectors.SelectorFactoryImpl; -import com.fr.third.steadystate.css.sac.ConditionFactoryAdapter; -import com.fr.third.steadystate.css.sac.ConditionFactoryExt; -import com.fr.third.steadystate.css.sac.DocumentHandlerAdapter; -import com.fr.third.steadystate.css.sac.DocumentHandlerExt; -import com.fr.third.steadystate.css.sac.SelectorFactoryExt; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.URL; +import java.nio.charset.Charset; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.ResourceBundle; /** * Base implementation of {@link Parser}. @@ -155,7 +154,7 @@ abstract class AbstractSACParser implements SACParser { if (sacParserMessages_ == null) { try { sacParserMessages_ = ResourceBundle.getBundle( - "com.steadystate.css.parser.SACParserMessages", + "com.fr.third.steadystate.css.parser.SACParserMessages", getLocale()); } catch (final MissingResourceException e) {