Example usage for org.apache.commons.lang3 ExtendedStringUtils safeCompare

List of usage examples for org.apache.commons.lang3 ExtendedStringUtils safeCompare

Introduction

In this page you can find the example usage for org.apache.commons.lang3 ExtendedStringUtils safeCompare.

Prototype

public static final int safeCompare(String s1, String s2) 

Source Link

Document

Compares 2 String -s allowing for null's

Usage

From source file:org.springframework.validation.SimpleErrors.java

@Override
public void addAllErrors(Errors errors) {
    Assert.notNull(errors, "No errors to add");
    if (ExtendedStringUtils.safeCompare(getObjectName(), errors.getObjectName()) != 0) {
        throw new IllegalArgumentException("addErrors(" + getObjectName()
                + ") mismatched argument object name: " + errors.getObjectName());
    }/*from ww  w. ja v a 2s  .c  o m*/

    Collection<? extends ObjectError> glbl = errors.getGlobalErrors();
    if (ExtendedCollectionUtils.size(glbl) > 0) {
        globalErrors.addAll(glbl);
    }

    Collection<? extends FieldError> flds = errors.getFieldErrors();
    if (ExtendedCollectionUtils.size(flds) > 0) {
        fieldErrors.addAll(flds);
    }
}