This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new d1b9ccf  Trivial refactoring: simplify the condition
d1b9ccf is described below

commit d1b9ccff5ae9f077e57ec8d1572370746558a427
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Apr 11 21:15:12 2020 +0800

    Trivial refactoring: simplify the condition
---
 subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java 
b/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java
index 88798ed..37c129b 100644
--- a/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java
+++ b/subprojects/groovy-xml/src/main/java/groovy/xml/dom/DOMCategory.java
@@ -351,7 +351,7 @@ public class DOMCategory {
     }
 
     public static Node replaceNode(NodesHolder self, Closure c) {
-        if (self.getLength() <= 0 || self.getLength() > 1) {
+        if (self.getLength() != 1) {
             throw new GroovyRuntimeException(
                     "replaceNode() can only be used to replace a single 
element, " +
                     "but was applied to " + self.getLength() + " elements."

Reply via email to