CachedDataAccessController.getSpectrumById() ClassCastException
Opened this issue · 3 comments
Tobias-Ternent commented
In class: CachedDataAccessController
L166
Spectrum getSpectrumById(Comparable id, boolean useCache) {
return useCache ? (Spectrum) cache.get(CacheEntry.SPECTRUM, id) : null;
}
This method is being used by the PX submission pipeline:
Spectrum spectrum = dataAccessController.getSpectrumById(specId);
java.lang.ClassCastException: java.util.Collections$SynchronizedMap cannot be cast to uk.ac.ebi.pride.utilities.data.core.Spectrum
So the cache.get() is returning a SynchonizedMap instead of just one Spectrum object.
Tobias
ypriverol commented
@tobias can you add me an example where you found the problem, to be able to reproduce the error.
Tobias-Ternent commented
java.lang.ClassCastException: java.util.Collections$SynchronizedMap cannot be cast to uk.ac.ebi.pride.utilities.data.core.Spectrum
at uk.ac.ebi.pride.utilities.data.controller.impl.ControllerImpl.CachedDataAccessController.getSpectrumById(CachedDataAccessController.java:166) ~[ms-data-core-api-2.0.6-SNAPSHOT.jar:na]
at uk.ac.ebi.pride.utilities.data.controller.impl.ControllerImpl.ReferencedIdentificationController.getSpectrumById(ReferencedIdentificationController.java:407) ~[ms-data-core-api-2.0.6-SNAPSHOT.jar:na]
at uk.ac.ebi.pride.utilities.data.controller.impl.ControllerImpl.CachedDataAccessController.getSpectrumById(CachedDataAccessController.java:154) ~[ms-data-core-api-2.0.6-SNAPSHOT.jar:na]
at uk.ac.ebi.pride.submission.AssayFileScanner.scanEntryByEntry(AssayFileScanner.java:409) ~[submission-pipeline-2.0.0.jar:na]
at uk.ac.ebi.pride.submission.AssayFileScanner.scan(AssayFileScanner.java:90) ~[submission-pipeline-2.0.0.jar:na]
ypriverol commented
Should be address in the performance optimization.