You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/04/11 15:33:19 UTC

[groovy] 08/20: Trivial refactoring: simplify the condition

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

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

commit 468c21eaf3e47a495464aa9ef8aaed9c52ef5364
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Apr 11 21:15:12 2020 +0800

    Trivial refactoring: simplify the condition
    
    (cherry picked from commit d1b9ccff5ae9f077e57ec8d1572370746558a427)
---
 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."