backported fixes

This commit is contained in:
Luca Frosini 2021-04-14 15:08:11 +02:00
parent 6cab331db0
commit 68b3e2c71a
1 changed files with 12 additions and 8 deletions

View File

@ -174,16 +174,20 @@ public class Validator {
int lowerBound = entry.getValue();
// 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) {
try {
String maxOccurs = metadataFieldMap.get(entry.getKey()).getMaxOccurs();
if(maxOccurs==null || maxOccurs.compareTo("*")==0) {
upperBound = Integer.MAX_VALUE;
}else {
try {
upperBound = Integer.valueOf(maxOccurs);
}catch (Exception e) {
}
}
}catch (Exception e) {
upperBound = Integer.MAX_VALUE;
}
int inserted = numberFieldsMandatorySameKeyMap.get(entry.getKey());