Skip to content

Commit 1e8512b

Browse files
add check before casting
1 parent 7aa2edc commit 1e8512b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

server/src/main/java/org/apache/cloudstack/backup/BackupManagerImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
import org.apache.cloudstack.backup.dao.BackupScheduleDao;
6363
import org.apache.cloudstack.context.CallContext;
6464
import org.apache.cloudstack.framework.config.ConfigKey;
65+
import org.apache.cloudstack.framework.jobs.AsyncJob;
6566
import org.apache.cloudstack.framework.jobs.AsyncJobDispatcher;
6667
import org.apache.cloudstack.framework.jobs.AsyncJobManager;
6768
import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
@@ -673,6 +674,10 @@ protected void sendExceededBackupLimitAlert(String ownerUuid, Resource.ResourceT
673674
* @return The backup schedule ID. Returns null if the backup has been manually created
674675
*/
675676
protected Long getBackupScheduleId(Object job) {
677+
if (!(job instanceof AsyncJob)) {
678+
return null;
679+
}
680+
676681
AsyncJobVO asyncJob = (AsyncJobVO) job;
677682
logger.debug("Trying to retrieve [{}] parameter from the job [ID: {}] parameters.", ApiConstants.SCHEDULE_ID, asyncJob.getId());
678683
String jobParamsRaw = asyncJob.getCmdInfo();

0 commit comments

Comments
 (0)