出于某种原因,以下脚本在执行时不仅会在日志中打印输出,还会在信息弹出对话框中打印输出。有人可以向我解释为什么会发生这种情况以及如何防止它发生吗?
import groovy.io.FileType;
import org.custommonkey.xmlunit.*;
def file1 = "somepath/file1.xml"
def file2 = "somepath/file2.xml"
def xml1 = new FileReader(file1)
def xml2= new FileReader(file2)
XMLUnit.setIgnoreWhitespace(true)
XMLUnit.setIgnoreComments(true)
XMLUnit.setIgnoreDiffBetweenTextAndCDATA(true)
XMLUnit.setNormalizeWhitespace(true)
DetailedDiff myDiff = new DetailedDiff(new Diff(xml1, xml2));
List allDifferences = myDiff.getAllDifferences();
allDifferences.each { difference ->
log.info (difference)
}
编辑:通过实验,我发现以下行:
List allDifferences = myDiff.getAllDifferences();
这就是弹出对话的原因。我猜测 getAllDiffenes() 方法会导致对话框弹出。
我仍然需要一些帮助来确定可行的替代方案,因为我正在尝试比较两个 xml 文件并打印文件中的差异。