ACS-2800: Replace throwing NPE to CmisInvalidArgumentException (#1130)

* ACS-2800 Throw CmisInvalidArgumentException if type cannot be found

* ACS-2800 Reformat code
This commit is contained in:
Damian Ujma
2022-05-24 10:43:09 +02:00
committed by GitHub
parent 02a2d88712
commit 83e06193d1

View File

@@ -78,6 +78,10 @@ public class ObjectTypeIdLuceneBuilder extends BaseLuceneBuilder
String field = getLuceneFieldName();
String stringValue = getValueAsString(value);
TypeDefinitionWrapper type = cmisDictionaryService.findType(stringValue);
if (type == null)
{
throw new CmisInvalidArgumentException("Unknown type: " + stringValue);
}
return lqpa
.getFieldQuery(field, type.getAlfrescoClass().toString(), AnalysisMode.IDENTIFIER, luceneFunction);
}