DaanHoogland commented on pull request #4516: URL: https://github.com/apache/cloudstack/pull/4516#issuecomment-740476087
> > @alexandru-bagu why _host.getHypervisorType()_ is null in your case, here: > > https://github.com/apache/cloudstack/blob/fb1e903532d943bc98a1a8b95d4499013234a917/server/src/main/java/com/cloud/storage/StorageManagerImpl.java#L619 > > I am sure it's not null, not in my case anyway. If you are actually referring to the null verification I do in PR then I guess it's just a habit I picked up along the way. As you can read in my stacktrace, the hypervisorType is not null but rather not castable to string. I am assuming it was never accepted in java to cast an enum to string. Enums (at least in C#) are castable to integers not strings. If my assumption is wrong then is this code not meant to be ran with openjdk? @alexandru-bagu, it is a general accepted practice to have enum types be casted to string, but you'll need a `toString()` defined on the enum. casting to int is generally frowned upon because the string descriptors may be auto-numbered and an insert on the type will change the numbering. (in this case the enum range is small and also persisted so that can't be allowed anyway) hope this explains. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
