namedLayerInfo = choice.getNamedLayer();
}
}
}
if (namedLayerInfo == null) {
throw new LayerException(ExceptionCode.INVALID_SLD, styledLayerDescriptorInfo.getName(), layerName);
}
UserStyleInfo userStyleInfo = null;
for (NamedLayerInfo.ChoiceInfo choice : namedLayerInfo.getChoiceList()) {
// we only support user styles, pick the right name or the first
if (choice.ifUserStyle()) {
if (styleName != null) {
if (styleName.equals(choice.getUserStyle().getName())) {
userStyleInfo = choice.getUserStyle();
break;
}
}
if (userStyleInfo == null) {
userStyleInfo = choice.getUserStyle();
}
}
}
if (userStyleInfo == null) {
throw new LayerException(ExceptionCode.INVALID_SLD, styledLayerDescriptorInfo.getName(), layerName);
}
NamedStyleInfo namedStyleInfo = convert(userStyleInfo, featureInfo);
if (namedStyleInfo.getName() == null) {
namedStyleInfo.setName(styleName);