Patched the upperBound calculation
This commit is contained in:
parent
f29c258375
commit
1877291fba
|
@ -147,8 +147,12 @@ public class Validator {
|
|||
|
||||
// now validate fields
|
||||
int metadataIndex = 0;
|
||||
|
||||
Map<String, MetadataField> metadataFieldMap = new HashMap<>();
|
||||
for(MetadataField metadataField : metadataFields) {
|
||||
|
||||
metadataFieldMap.put(metadataField.getFieldName(), metadataField);
|
||||
|
||||
int categoryIdIndex = categoriesIds.indexOf(metadataField.getCategoryRef());
|
||||
logger.debug("Found index for category " + metadataField.getCategoryRef() + " " + categoryIdIndex);
|
||||
List<CustomField> validCFs = validateAgainstMetadataField(metadataIndex, categoryIdIndex,
|
||||
|
@ -167,7 +171,20 @@ public class Validator {
|
|||
Map.Entry<java.lang.String,java.lang.Integer> entry = (Map.Entry<java.lang.String,java.lang.Integer>) iteratorLowerBounds
|
||||
.next();
|
||||
int lowerBound = entry.getValue();
|
||||
int upperBound = fieldsMandatoryUpperBoundMap.get(entry.getKey());
|
||||
|
||||
// int upperBound = fieldsMandatoryUpperBoundMap.get(entry.getKey());
|
||||
String maxOccurs = metadataFieldMap.get(entry.getKey()).getMaxOccurs();
|
||||
int upperBound = Integer.MAX_VALUE;
|
||||
if(maxOccurs.compareTo("*")==0) {
|
||||
upperBound = Integer.MAX_VALUE;
|
||||
}else {
|
||||
try {
|
||||
upperBound = Integer.valueOf(maxOccurs);
|
||||
}catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int inserted = numberFieldsMandatorySameKeyMap.get(entry.getKey());
|
||||
|
||||
logger.info("Field with key '" + entry.getKey() + "' has been found " + inserted
|
||||
|
|
Loading…
Reference in New Issue