I have a Spring Boot application and I am loading a file from Google Cloud Storage, however this error is being thrown:
java.lang.ClassCastException: class com.jws1g18.myphrplus.EncFile cannot be cast to class com.jws1g18.myphrplus.EncFile
(com.jws1g18.myphrplus.EncFile is in unnamed module of loader 'app'; com.jws1g18.myphrplus.EncFile is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader @18e513bc)
However I am struggling to work out why it is being thrown, as they are the same class. It is being thrown by this code:
private static EncFile readEncFile(InputStream iStream) {
try {
return (EncFile) SerializationUtils.deserialize(iStream.readAllBytes());
} catch (IOException e) {
return null;
}
}
Let me know if you need any more info. Any help would be appreciated