You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2016/10/28 19:51:19 UTC
svn commit: r1767069 -
/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java
Author: fschumacher
Date: Fri Oct 28 19:51:19 2016
New Revision: 1767069
URL: http://svn.apache.org/viewvc?rev=1767069&view=rev
Log:
Space-police
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java?rev=1767069&r1=1767068&r2=1767069&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/parser/CssParser.java Fri Oct 28 19:51:19 2016
@@ -56,24 +56,24 @@ import com.helger.css.reader.errorhandle
public class CssParser implements LinkExtractorParser {
private static final boolean IGNORE_UNRECOVERABLE_PARSING_ERROR = JMeterUtils.getPropDefault("httpsampler.ignore_failed_embedded_resource", false); //$NON-NLS-1$
private static final Logger LOG = LoggingManager.getLoggerForClass();
-
+
/**
- *
+ *
*/
private static final int CSS_URL_CACHE_MAX_SIZE = JMeterUtils.getPropDefault("css.parser.cache.size", 400);
private static final boolean IGNORE_ALL_CSS_ERRORS = JMeterUtils.getPropDefault("css.parser.ignore_all_css_errors", true);
-
+
/**
- *
+ *
*/
@SuppressWarnings("unchecked")
- private static Map<String, URLCollection> CSS_URL_CACHE =
+ private static Map<String, URLCollection> CSS_URL_CACHE =
CSS_URL_CACHE_MAX_SIZE > 0 ? Collections.synchronizedMap(new LRUMap(CSS_URL_CACHE_MAX_SIZE)) : null;
-
+
private static final class CustomLoggingCSSParseExceptionCallback extends LoggingCSSParseExceptionCallback {
/**
- *
+ *
*/
private static final long serialVersionUID = -9111232037888068394L;
private URL cssUrl;
@@ -89,22 +89,22 @@ public class CssParser implements LinkEx
*/
@Override
public void onException(ParseException ex) {
- if(IGNORE_UNRECOVERABLE_PARSING_ERROR) {
+ if(IGNORE_UNRECOVERABLE_PARSING_ERROR) {
LOG.warn("Failed to parse CSS: " + cssUrl + ", " + LoggingCSSParseErrorHandler.createLoggingStringParseError (ex));
} else {
throw new IllegalStateException("Failed to parse CSS: " + cssUrl + ", " + LoggingCSSParseErrorHandler.createLoggingStringParseError (ex));
}
}
}
-
+
/**
- *
+ *
*/
public CssParser() {
}
/**
- *
+ *
* @see
* org.apache.jmeter.protocol.http.parser.LinkExtractorParser#getEmbeddedResourceURLs
* (java.lang.String, byte[], java.net.URL,
@@ -119,9 +119,9 @@ public class CssParser implements LinkEx
URLCollection urlCollection = null;
if(cacheEnabled) {
md5Key = DigestUtils.md5Hex(data);
- urlCollection = CSS_URL_CACHE.get(md5Key);
+ urlCollection = CSS_URL_CACHE.get(md5Key);
}
-
+
if(urlCollection == null) {
String cssContent = new String(data, encoding);
final CSSReaderSettings cssSettings = new CSSReaderSettings()
@@ -170,7 +170,7 @@ public class CssParser implements LinkEx
LOG.warn("Failed parsing url:"+baseUrl+", got null CascadingStyleSheet");
}
}
-
+
if(LOG.isDebugEnabled()) {
StringBuilder builder = new StringBuilder();
for (Iterator<URL> iterator = urlCollection.iterator(); iterator.hasNext();) {
@@ -179,7 +179,7 @@ public class CssParser implements LinkEx
}
LOG.debug("Parsed:"+baseUrl+", got:"+builder.toString());
}
-
+
return urlCollection.iterator();
} catch (Exception e) {
throw new LinkExtractorParseException(e);