You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Ted Lundqvist (Jira)" <ji...@apache.org> on 2022/03/16 14:10:00 UTC
[jira] [Created] (GROOVY-10530) Calling firstChild does not produce the same result as getFirstChild()
Ted Lundqvist created GROOVY-10530:
--------------------------------------
Summary: Calling firstChild does not produce the same result as getFirstChild()
Key: GROOVY-10530
URL: https://issues.apache.org/jira/browse/GROOVY-10530
Project: Groovy
Issue Type: Bug
Affects Versions: 4.0.0
Environment: IntelliJ IDEA 2021.3.2
Java jdk1.8.0_211
Groovy 4.0.0
Reporter: Ted Lundqvist
Calling firstChild returns a Boolean with the value false but getFirstChild() returns the correct object.
Noticed this problem when upgrading from Groovy 3.0.5 to 4.0.0
{code:java}
import org.junit.jupiter.api.Test
import org.w3c.dom.Node
import org.xml.sax.InputSource
import javax.xml.parsers.DocumentBuilderFactory
import static org.junit.jupiter.api.Assertions.assertEquals
class XmlTest {
@Test()
void firstChild_test() {
String xml = "<xml><foo>bar</foo></xml>"
Node node = DocumentBuilderFactory.newInstance()
.newDocumentBuilder()
.parse(new InputSource(new StringReader(xml)))
assertEquals(node.firstChild.class, node.getFirstChild().class)
//org.opentest4j.AssertionFailedError:
//Expected :class java.lang.Boolean
//Actual :class org.apache.xerces.dom.DeferredElementImpl
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.20.1#820001)