Skip to content

Commit

Permalink
Fixes NPE odpi#6229
Browse files Browse the repository at this point in the history
Signed-off-by: Ljupcho Palashevski <ljupcho.palashevski@ing.com>
  • Loading branch information
Ljupcho Palashevski committed Feb 23, 2022
1 parent 4c26396 commit 842b9dd
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -113,19 +113,19 @@ private int extractLineagePublisherBatchSize(Map<String, Object> 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(),
Expand Down

0 comments on commit 842b9dd

Please sign in to comment.