Skip to content
Snippets Groups Projects
Commit b200a47e authored by Adam Laskowski's avatar Adam Laskowski
Browse files

SSDM-13524: Added missing null-check for material type UpdateMaterialTypesOperationExecutor

parent e483c39a
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
......@@ -47,7 +47,8 @@ public class UpdateMaterialTypesOperationExecutor
implements IUpdateMaterialTypesOperationExecutor
{
private static final List<DataTypeCode> INVALID_TYPES =
Arrays.asList(DataTypeCode.ARRAY_INTEGER, DataTypeCode.ARRAY_STRING, DataTypeCode.ARRAY_REAL,
Arrays.asList(DataTypeCode.ARRAY_INTEGER, DataTypeCode.ARRAY_STRING,
DataTypeCode.ARRAY_REAL,
DataTypeCode.ARRAY_TIMESTAMP, DataTypeCode.JSON);
@Autowired
......@@ -82,26 +83,34 @@ public class UpdateMaterialTypesOperationExecutor
{
for (MaterialTypeUpdate materialTypeUpdate : materialTypeUpdates)
{
if(materialTypeUpdate.getPropertyAssignments() != null)
if (materialTypeUpdate.getPropertyAssignments() != null)
{
for (PropertyAssignmentCreation addedAssignments : materialTypeUpdate.getPropertyAssignments()
.getAdded())
{
PropertyTypePE type =
findPropertyType(context, addedAssignments.getPropertyTypeId());
if (type.getType() != null && INVALID_TYPES.contains(type.getType().getCode()))
if (addedAssignments.getPropertyTypeId() != null)
{
return false;
PropertyTypePE type =
findPropertyType(context, addedAssignments.getPropertyTypeId());
if (type.getType() != null && INVALID_TYPES.contains(
type.getType().getCode()))
{
return false;
}
}
}
for (PropertyAssignmentCreation setAssignments : materialTypeUpdate.getPropertyAssignments()
.getSet())
{
PropertyTypePE type =
findPropertyType(context, setAssignments.getPropertyTypeId());
if (type.getType() != null && INVALID_TYPES.contains(type.getType().getCode()))
if (setAssignments.getPropertyTypeId() != null)
{
return false;
PropertyTypePE type =
findPropertyType(context, setAssignments.getPropertyTypeId());
if (type.getType() != null && INVALID_TYPES.contains(
type.getType().getCode()))
{
return false;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment