org.cloudfoundry.identity.uaa.zone.InvalidClientSecretException Maven / Gradle / Ivy
The newest version!
package org.cloudfoundry.identity.uaa.zone;
import org.cloudfoundry.identity.uaa.client.InvalidClientDetailsException;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
public class InvalidClientSecretException extends InvalidClientDetailsException {
private final List errorMessages;
public InvalidClientSecretException(String message) {
super(message);
errorMessages = Arrays.asList(message);
}
public InvalidClientSecretException(List errorMessages) {
super(concatenate(errorMessages));
this.errorMessages = errorMessages;
}
public List getErrorMessages() {
return errorMessages;
}
public String getMessagesAsOneString() {
return concatenate(errorMessages);
}
private static String concatenate(List errorMessages) {
ArrayList sortedMessages = new ArrayList(errorMessages);
Collections.sort(sortedMessages);
return StringUtils.collectionToDelimitedString(sortedMessages, " ");
}
}