@@ -261,23 +261,30 @@ public void doInTransactionWithoutResult(TransactionStatus status) {
261261 for (final Backup .RestorePoint restorePoint : restorePoints ) {
262262 boolean backupExists = false ;
263263 for (final Backup backup : backupsInDb ) {
264- if (restorePoint .getId ().equals (backup .getExternalId ())) {
265- backupExists = true ;
266- removeList .remove (backup .getId ());
267- if (metric != null ) {
268- LOG .debug (String .format ("Update backup with [uuid: %s, external id: %s] from [size: %s, protected size: %s] to [size: %s, protected size: %s]." ,
269- backup .getUuid (), backup .getExternalId (), backup .getSize (), backup .getProtectedSize (), metric .getBackupSize (), metric .getDataSize ()));
270-
271- ((BackupVO ) backup ).setSize (metric .getBackupSize ());
272- ((BackupVO ) backup ).setProtectedSize (metric .getDataSize ());
273- backupDao .update (backup .getId (), ((BackupVO ) backup ));
264+ if (restorePoint .getId () != null ) {
265+ if (restorePoint .getId ().equals (backup .getExternalId ())) {
266+ backupExists = true ;
267+ removeList .remove (backup .getId ());
268+ if (metric != null ) {
269+ LOG .debug (String .format ("Update backup with [uuid: %s, external id: %s] from [size: %s, protected size: %s] to [size: %s, protected size: %s]." ,
270+ backup .getUuid (), backup .getExternalId (), backup .getSize (), backup .getProtectedSize (), metric .getBackupSize (), metric .getDataSize ()));
271+
272+ ((BackupVO ) backup ).setSize (metric .getBackupSize ());
273+ ((BackupVO ) backup ).setProtectedSize (metric .getDataSize ());
274+ backupDao .update (backup .getId (), ((BackupVO ) backup ));
275+ }
276+ break ;
274277 }
275- break ;
276278 }
277279 }
280+
278281 if (backupExists ) {
279282 continue ;
280283 }
284+ if (restorePoint .getId () == null || restorePoint .getType () == null || restorePoint .getCreated () == null ) {
285+ continue ;
286+ }
287+
281288 BackupVO backup = new BackupVO ();
282289 backup .setVmId (vm .getId ());
283290 backup .setExternalId (restorePoint .getId ());
0 commit comments