Grim
Grim

Reputation: 1974

StackOverflowError in String.toLowerCase

It looks like a too long String causing folowing exception:

Caused by: java.lang.StackOverflowError
    at java.lang.String.toLowerCase(String.java:2496)
    at com.gargoylesoftware.htmlunit.html.NamedAttrNodeMapImpl.fixName(DomElement.java:489)
    at com.gargoylesoftware.htmlunit.html.NamedAttrNodeMapImpl.get(DomElement.java:602)
    at com.gargoylesoftware.htmlunit.html.DomElement.getAttribute(DomElement.java:215)
    at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.getStyleMap(CSSStyleDeclaration.java:634)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getStyleMap(ComputedCSSStyleDeclaration.java:243)
    at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.getStyleAttribute(CSSStyleDeclaration.java:472)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getStyleAttribute(ComputedCSSStyleDeclaration.java:162)
    at com.gargoylesoftware.htmlunit.javascript.host.css.CSSStyleDeclaration.jsxGet_position(CSSStyleDeclaration.java:4008)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.jsxGet_position(ComputedCSSStyleDeclaration.java:1304)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getPositionWithInheritance(ComputedCSSStyleDeclaration.java:1883)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getTop(ComputedCSSStyleDeclaration.java:1737)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getTop(ComputedCSSStyleDeclaration.java:1769)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getTop(ComputedCSSStyleDeclaration.java:1769)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getTop(ComputedCSSStyleDeclaration.java:1769)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getTop(ComputedCSSStyleDeclaration.java:1769)
    at com.gargoylesoftware.htmlunit.javascript.host.css.ComputedCSSStyleDeclaration.getTop(ComputedCSSStyleDeclaration.java:1769)

I guess the loop in ComputedCSSStyleDeclaration causing this problem.

What is the physical limit of a String? Can I limit the loop-detector for ComputedCSSStyleDeclaration?

Upvotes: 0

Views: 822

Answers (2)

emeraldjava
emeraldjava

Reputation: 11190

Is there already a bug open about this? http://sourceforge.net/p/htmlunit/bugs/1233/

Upvotes: 1

Hunter Zhao
Hunter Zhao

Reputation: 4649

The reason is a recursion-invoke existing in your code. please check.

At a deeper level of knowledge of JVM to explain this problem: the java virtual machine specification has ruled two situations of exception for java stack:

  1. Java stack is allowed to expand automaticly, it'll throw OOM(OutOfMemory) error when it cann't apply for enough memory.
  2. Java stack is constituted with stack frame, and each java method push a frame, it'll throw the StackOverflowError when the stack depth of the current thread is larger than the jvm's allowed.

Maybe help you:)

Upvotes: 1

Related Questions