mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fixed NPE in sending push notifications
This commit is contained in:
parent
8eaa7c6698
commit
128b5f64aa
@ -86,11 +86,18 @@ public class PushNotificationSchedulerTask implements Runnable {
|
|||||||
NotificationStrategy notificationStrategy = provider.getNotificationStrategyByDeviceType
|
NotificationStrategy notificationStrategy = provider.getNotificationStrategyByDeviceType
|
||||||
(operationMapping.getDeviceIdentifier().getType());
|
(operationMapping.getDeviceIdentifier().getType());
|
||||||
// Send the push notification on given strategy
|
// Send the push notification on given strategy
|
||||||
|
if (notificationStrategy != null) {
|
||||||
notificationStrategy.execute(new NotificationContext(operationMapping.getDeviceIdentifier(),
|
notificationStrategy.execute(new NotificationContext(operationMapping.getDeviceIdentifier(),
|
||||||
provider.getOperation(operationMapping.getDeviceIdentifier().getType(), operationMapping
|
provider.getOperation(operationMapping.getDeviceIdentifier().getType(), operationMapping
|
||||||
.getOperationId())));
|
.getOperationId())));
|
||||||
operationMapping.setPushNotificationStatus(Operation.PushNotificationStatus.COMPLETED);
|
operationMapping.setPushNotificationStatus(Operation.PushNotificationStatus.COMPLETED);
|
||||||
operationsCompletedList.add(operationMapping);
|
operationsCompletedList.add(operationMapping);
|
||||||
|
} else {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Tenant '" + PrivilegedCarbonContext.getThreadLocalCarbonContext()
|
||||||
|
.getTenantDomain() + "' does not have push notification strategy.");
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
log.error("Error occurred while getting notification strategy for operation mapping " +
|
log.error("Error occurred while getting notification strategy for operation mapping " +
|
||||||
operationMapping.getDeviceIdentifier().getType(), e);
|
operationMapping.getDeviceIdentifier().getType(), e);
|
||||||
@ -121,7 +128,7 @@ public class PushNotificationSchedulerTask implements Runnable {
|
|||||||
log.debug("Push notification job running completed.");
|
log.debug("Push notification job running completed.");
|
||||||
}
|
}
|
||||||
} catch (Throwable cause) {
|
} catch (Throwable cause) {
|
||||||
log.error("PushNotificationSchedulerTask failed due to " + cause);
|
log.error("PushNotificationSchedulerTask failed due to " + cause.getMessage(), cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user