Menu

#245 New attributes may cause a StackOverflowError for toHtml()

v2.0
closed-duplicate
5
2007-08-18
2007-06-07
No

After adding new attributes to a document, the call to the toHtml() method may cause a StackOverflowError.

In the provided example, the StackOverflowError occurs only if attributes are added with the nodevisitor.

Discussion

  • Hanh-Missi TRAN

    Hanh-Missi TRAN - 2007-06-07

    java code to reproduce error

     
  • Hanh-Missi TRAN

    Hanh-Missi TRAN - 2007-06-18

    Logged In: YES
    user_id=832167
    Originator: YES

    I have looked into the source code and there's a problem when an attribute is added to an empty tag.
    For example, I have a tag <div id="someId"/> in my html file. In the attributes list for this tag, the last attribute is "/". However when I add an attribute, this attribute is added to the end of the list. So "/" is not the last attribute anymore. That's why, when I call the toHtml() method, the method isEmptyXmlTag() returns false for the tag and that provokes an infinite loop because <div> is a composite tag and in my example, its end tag is itself.
    Hope that helps :)

     
  • Hanh-Missi TRAN

    Hanh-Missi TRAN - 2007-06-18

    Logged In: YES
    user_id=832167
    Originator: YES

    I have looked into the source code and there's a problem when an attribute is added to an empty tag.
    For example, I have a tag <div id="someId"/> in my html file. In the attributes list for this tag, the last attribute is "/". However when I add an attribute, this attribute is added to the end of the list. So "/" is not the last attribute anymore. That's why, when I call the toHtml() method, the method isEmptyXmlTag() returns false for the tag and that provokes an infinite loop because <div> is a composite tag and in my example, its end tag is itself.
    Hope that helps :)

     
  • Derrick Oswald

    Derrick Oswald - 2007-08-18
    • labels: --> Attribute Parsing
    • assigned_to: nobody --> derrickoswald
    • status: open --> closed-duplicate
     
  • Derrick Oswald

    Derrick Oswald - 2007-08-18

    Logged In: YES
    user_id=605407
    Originator: NO

    I believe this is the same issue as bug #1761484 tag.setAttribute() not compatible with <tag/> which has been fixed.

     

Log in to post a comment.

MongoDB Logo MongoDB