Reputation: 11
When I execute the command ./dspace oai import -c
I get the following error:
OAI 2.0 manager action started
Clearing index
Index cleared
Using full import.
Full import
java.lang.NullPointerException
at org.dspace.xoai.app.XOAI.index(XOAI.java:275)
at org.dspace.xoai.app.XOAI.index(XOAI.java:229)
at org.dspace.xoai.app.XOAI.indexAll(XOAI.java:210)
at org.dspace.xoai.app.XOAI.index(XOAI.java:128)
at org.dspace.xoai.app.XOAI.main(XOAI.java:439)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:225)
at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:77)
Upvotes: 1
Views: 1653
Reputation: 91
If you have harvested items that are being indexed by OAI, it will be these items that are causing the exception. The problem appears to be that DSpace sets an invalid null value for the submitter_id when an item is created via a harvest.
There's no simple way around this on an archive which is active; every time items are harvested, you will experience this problem. The only quick fix I have found is to reset the submitter_id field's null value directly in the database:
UPDATE item SET submitter_id = null WHERE submitter_id IS null;
The problem is not really at the doc.addField method, as having a properly set db null value will result in the getSubmitter() method correctly validating the submitter_id as null and so the getEmail returns nothing. Rather, the problem is with the invalid value that DSpace uses for setting null.
Upvotes: 2
Reputation: 1063
Elaborating on user323094's comment:
Looking at line 275 here: https://github.com/DSpace/DSpace/blob/c5e3b7150a24c669172492ab3dc276111328a865/dspace-oai/src/main/java/org/dspace/xoai/app/XOAI.java
This error seems to be caused by:
doc.addField("item.submitter", item.getSubmitter().getEmail());
So either you have an item who doesn't have a submitter, meaning that getSubmitter
causes the NPE, or that there is a submitter, but that it doesn't have an email, meaning that getEmail
will trigger the NPE.
Upvotes: 1