ChemicalService.cacheDataForModel fails with NullPointerException
Add project with Cache data:
being checked fails with Problem with uploading map: null. More details can be found in log file.
.
In the logfile one can find
2018-01-23 21:36:05,792 DEBUG [Thread-13] (ChemicalService.java:281) - Caching chemical queries...
2018-01-23 21:36:07,022 INFO [http-bio-8080-exec-3] (MiriamLink.java:111) - Address used: https://www.ebi.ac.uk/miriamws/main/MiriamWebServices
2018-01-23 21:36:07,022 INFO [http-bio-8080-exec-3] (MiriamLink.java:112) - If this address is not correct, use 'setAddress()' to change it.
2018-01-23 22:15:01,913 ERROR [Thread-13] (ProjectService.java:1514) -
java.lang.NullPointerException
at lcsb.mapviewer.services.search.db.DbSearchService.cacheMiriamData(DbSearchService.java:37)
at lcsb.mapviewer.services.search.db.chemical.ChemicalService.cacheDataForModel(ChemicalService.java:302)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)
at com.sun.proxy.$Proxy72.cacheDataForModel(Unknown Source)
at lcsb.mapviewer.services.impl.ProjectService.cacheData(ProjectService.java:1071)
at lcsb.mapviewer.services.impl.ProjectService.access$1200(ProjectService.java:117)
at lcsb.mapviewer.services.impl.ProjectService$7.run(ProjectService.java:991)
at java.lang.Thread.run(Thread.java:748)
I believe the reason is that DbSearchService.cacheMiriamData is iterating over a set of MiriamData
which may contain null
, for example Chemical.getSources() returns a Collection containing null
for uninitialised casID
or chemicalId
.