cloudsim icon indicating copy to clipboard operation
cloudsim copied to clipboard

CloudSimExample6 is Not Working Due to Null Pointer Exception

Open Astabol opened this issue 2 years ago • 2 comments

Hello Folks, While Executing of CloudSimExample6.java is encountered Null Pointer Exception.

Snapshot Attached Below: image

Current Result Vs Expected Result Current Result: Throwing Null Exception Expected Result: It should execute correctly without any error

Java Version: 21 & 23 CloudSim Version: 7.0

How to Regenerate the issue: Simply Execute the CloudSimExample6.java, It will be recreated.

Thank You

Astabol avatar Nov 17 '24 14:11 Astabol

Hi @Astabol

I've fixed it in my (private) work-in-progress patch to CloudSim7G. I can't share the code yet, unfortunately, but you could try to apply the patch yourself in the meantime (just don't commit it locally, or you'll eventually have a merge conflict with the official release)

Just add:

if (host == null) {
        return false;
 }

At the beginning of allocateHostForGuest(GuestEntity guest, HostEntity host) method in VmAllocationPolicy.java

deRemo avatar Nov 21 '24 15:11 deRemo

Thanks @deRemo

Astabol avatar Nov 28 '24 16:11 Astabol