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:18:00 UTC
[jira] [Updated] (GROOVY-10530) Calling firstChild does not produce the same result as getFirstChild()
[ https://issues.apache.org/jira/browse/GROOVY-10530?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ted Lundqvist updated GROOVY-10530:
-----------------------------------
Description:
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.getFirstChild().class, node.firstChild.class)
//org.opentest4j.AssertionFailedError:
//Expected :class com.sun.org.apache.xerces.internal.dom.DeferredElementImpl
//Actual :class java.lang.Boolean
}
}
{code}
was:
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}
> 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
> Priority: Major
>
> 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.getFirstChild().class, node.firstChild.class)
> //org.opentest4j.AssertionFailedError:
> //Expected :class com.sun.org.apache.xerces.internal.dom.DeferredElementImpl
> //Actual :class java.lang.Boolean
> }
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)