From 842b9dd3a82da0fad8d6b18d3238e105897e4d6c Mon Sep 17 00:00:00 2001 From: Ljupcho Palashevski Date: Wed, 23 Feb 2022 08:28:53 +0100 Subject: [PATCH] Fixes NPE #6229 Signed-off-by: Ljupcho Palashevski --- .../assetlineage/admin/AssetLineageAdmin.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/open-metadata-implementation/access-services/asset-lineage/asset-lineage-server/src/main/java/org/odpi/openmetadata/accessservices/assetlineage/admin/AssetLineageAdmin.java b/open-metadata-implementation/access-services/asset-lineage/asset-lineage-server/src/main/java/org/odpi/openmetadata/accessservices/assetlineage/admin/AssetLineageAdmin.java index 14741521b95..e7f39bdbf1c 100644 --- a/open-metadata-implementation/access-services/asset-lineage/asset-lineage-server/src/main/java/org/odpi/openmetadata/accessservices/assetlineage/admin/AssetLineageAdmin.java +++ b/open-metadata-implementation/access-services/asset-lineage/asset-lineage-server/src/main/java/org/odpi/openmetadata/accessservices/assetlineage/admin/AssetLineageAdmin.java @@ -100,7 +100,7 @@ public void initialize(AccessServiceConfig accessServiceConfigurationProperties, /** * Extract the value from access service options property defined with PUBLISHER_BATCH_SIZE_PROPERTY_NAME static field. - * If the value provided in the access service options is not usable (NaN or negative number), default value is returned. + * If accessServiceOptions is null or the property provided value is not usable (NaN or negative number), default value is returned. * * @param accessServiceOptions Options for the access service * @param accessServiceFullName Name of the access service @@ -113,19 +113,19 @@ private int extractLineagePublisherBatchSize(Map accessServiceOp AuditLog auditLog) throws OMAGConfigurationErrorException { final String methodName = "extractLineagePublisherBatchSize"; - Object propertyValue = accessServiceOptions.get(PUBLISHER_BATCH_SIZE_PROPERTY_NAME); + if(accessServiceOptions == null) { + return defaultPublisherBatchSize; + } + Object propertyValue = accessServiceOptions.get(PUBLISHER_BATCH_SIZE_PROPERTY_NAME); if (propertyValue == null) { return defaultPublisherBatchSize; } - try - { + try { int value = Integer.parseInt(propertyValue.toString()); auditLog.logMessage(methodName, AssetLineageAuditCode.CONFIGURED_PUBLISHER_BATCH_SIZE.getMessageDefinition(PUBLISHER_BATCH_SIZE_PROPERTY_NAME, Integer.toString(value))); return value < 1 ? defaultPublisherBatchSize : value; - } - catch (Exception error) - { + } catch (Exception error) { auditLog.logMessage(methodName, AssetLineageAuditCode.INVALID_PUBLISHER_BATCH_SIZE.getMessageDefinition(PUBLISHER_BATCH_SIZE_PROPERTY_NAME)); throw new OMAGConfigurationErrorException(OMAGAdminErrorCode.BAD_CONFIG_PROPERTIES.getMessageDefinition(accessServiceFullName, propertyValue.toString(),