HtmSerializer

View: New views
2 Messages — Rating Filter:   Alert me  

HtmSerializer

by reinhard schwab :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

with jconsole i see sometimes that a thread spends long time in

Stack trace:
java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3366)
java.util.regex.Pattern$Curly.match0(Pattern.java:3770)
java.util.regex.Pattern$Curly.match(Pattern.java:3744)
java.util.regex.Pattern$Start.match(Pattern.java:3055)
java.util.regex.Matcher.search(Matcher.java:1105)
java.util.regex.Matcher.find(Matcher.java:535)
java.util.regex.Matcher.replaceAll(Matcher.java:814)
java.lang.String.replaceAll(String.java:2189)
com.gargoylesoftware.htmlunit.html.HtmlSerializer.reduceWhitespace(HtmlSerializer.java:70)
com.gargoylesoftware.htmlunit.html.HtmlSerializer.cleanUp(HtmlSerializer.java:56)
com.gargoylesoftware.htmlunit.html.HtmlSerializer.asText(HtmlSerializer.java:50)
com.gargoylesoftware.htmlunit.html.DomNode.asText(DomNode.java:671)

the regex there is

// remove white spaces before or after block separators
        text = text.replaceAll("\\s*" + AS_TEXT_BLOCK_SEPARATOR + "\\s*", AS_TEXT_BLOCK_SEPARATOR);

this can be changed to

text = text.replaceAll("\\s+" + AS_TEXT_BLOCK_SEPARATOR + "\\s+", AS_TEXT_BLOCK_SEPARATOR);

?

regards
reinhard


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: HtmSerializer

by Ahmed Ashour :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I am ok with:
 
text = text.replaceAll("\\s+" + AS_TEXT_BLOCK_SEPARATOR, AS_TEXT_BLOCK_SEPARATOR).replaceAll(AS_TEXT_BLOCK_SEPARATOR + "\\s+", AS_TEXT_BLOCK_SEPARATOR);
if it makes significant difference.
 
Ahmed
----
Blog: http://asashour.blogspot.com

From: reinhard schwab <reinhard.schwab@...>
To: htmlunit-user@...
Sent: Sat, November 7, 2009 3:16:42 PM
Subject: [Htmlunit-user] HtmSerializer

with jconsole i see sometimes that a thread spends long time in

Stack trace:
java.util.regex.Pattern$BmpCharProperty.match(Pattern.java:3366)
java.util.regex.Pattern$Curly.match0(Pattern.java:3770)
java.util.regex.Pattern$Curly.match(Pattern.java:3744)
java.util.regex.Pattern$Start.match(Pattern.java:3055)
java.util.regex.Matcher.search(Matcher.java:1105)
java.util.regex.Matcher.find(Matcher.java:535)
java.util.regex.Matcher.replaceAll(Matcher.java:814)
java.lang.String.replaceAll(String.java:2189)
com.gargoylesoftware.htmlunit.html.HtmlSerializer.reduceWhitespace(HtmlSerializer.java:70)
com.gargoylesoftware.htmlunit.html.HtmlSerializer.cleanUp(HtmlSerializer.java:56)
com.gargoylesoftware.htmlunit.html.HtmlSerializer.asText(HtmlSerializer.java:50)
com.gargoylesoftware.htmlunit.html.DomNode.asText(DomNode.java:671)

the regex there is

// remove white spaces before or after block separators
        text = text.replaceAll("\\s*" + AS_TEXT_BLOCK_SEPARATOR + "\\s*", AS_TEXT_BLOCK_SEPARATOR);

this can be changed to

text = text.replaceAll("\\s+" + AS_TEXT_BLOCK_SEPARATOR + "\\s+", AS_TEXT_BLOCK_SEPARATOR);

?

regards
reinhard


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user