phax / ph-schematron

Java Schematron library that supports XSLT and native application
Apache License 2.0
115 stars 36 forks source link

ResourceErrorGroup.containsOnlySuccess issue #7

Closed czajek closed 9 years ago

czajek commented 9 years ago

ResourceErrorGroup.containsOnlySuccess method returns false instead of true in first condition. If m_aErrors is empty, this method should return true.

public boolean containsOnlySuccess () { if (m_aErrors.isEmpty ()) return false; for (final IResourceError aError : m_aErrors) if (aError.isFailure ()) return false; return true; }

phax commented 9 years ago

This is a tricky thing. The semantics of "containsOnlySuccess" is "contains at least one entry, and each entry is a success". If the list is empty, no success is contained. I know that this is a bit tricky. But you may use "containsNoFailure ()" instead which has a consistent semantic: this is true, if the list is empty or if only success is contained.

But of cause I will try to clarify this in the JavaDocs

// Philip