protected AttributeDefinition toDefinition(String name, String config) {
AttributeProperty prop = AttributeProperty.fromName(name);
if (prop == null) {
throw new ConfigurationException("Unable to locate a standard OpenId Attribute property for name '" +
name + "'. Please ensure this name matches one of the constants in the " +
AttributeProperty.class.getName() + " enum (name matching is case insensitive).");
}
String uri = prop.getUri();
boolean required = false;
int count = 0;
if (config != null) {
String[] configPairs = StringUtils.split(config);
for (String pair : configPairs) {
String nameValue[] = pair.split("\\=", 2);
if (nameValue.length != 2) {
throw new ConfigurationException("OpenId attribute properties with configuration must be " +
"comma-delimited name/value pairs. Each name/value pair must be separated by the " +
"equals sign, e.g. nameProp[name1=value1, name2=value2, ...]. The string that " +
"caused this error was '" + pair + "'.");
}
String pairName = nameValue[0];
String pairValue = nameValue[1];
if ("uri".equalsIgnoreCase(pairName)) {
uri = pairValue;
} else if ("required".equalsIgnoreCase(pairName)) {
required = Boolean.valueOf(pairValue);
} else if ("count".equalsIgnoreCase(pairName)) {
try {
count = Integer.parseInt(pairValue);
} catch (NumberFormatException e) {
String msg = "Unable to correctly parse 'count' value '" + pairValue + "' for OpenId " +
"attribute '" + name + "'";
throw new ConfigurationException(msg, e);
}
if (count < 0) {
count = 0;
}
} else {