Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feeding an empty Atom entry file to CollectionAPI.post results in org.apache.abdera.parser.ParseException: java.lang.ArrayIndexOutOfBoundsException #6

Open
pdurbin opened this issue Jul 1, 2014 · 1 comment

Comments

@pdurbin
Copy link
Contributor

pdurbin commented Jul 1, 2014

If atom-entry-empty.xml is an empty file (i.e. touch atom-entry-empty.xml to create it) and I try to feed it into CollectionAPI.post like this...

curl -s --insecure --data-binary @scripts/api/data-deposit/data/atom-entry-empty.xml -H 'Content-Type: application/atom+xml' https://pete:pete@localhost:8181/dvn/api/data-deposit/v1/swordv2/collection/dataverse/peteTop

... I get the exception below. Perhaps a try/catch could be added?

Here's the relevant line: https://github.com/swordapp/JavaServer2.0/blob/sword2-server-1.0/src/main/java/org/swordapp/server/SwordAPIEndpoint.java#L355

StandardWrapperValve[edu.harvard.iq.dataverse.api.datadeposit.SWORDv2CollectionServlet]: Servlet.service() for servlet edu.harvard.iq.dataverse.api.datadeposit.SWORDv2CollectionServlet threw exception
org.apache.abdera.parser.ParseException: java.lang.ArrayIndexOutOfBoundsException
        at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:128)
        at org.apache.abdera.util.AbstractParser.parse(AbstractParser.java:65)
        at org.swordapp.server.SwordAPIEndpoint.addDepositPropertiesFromEntry(SwordAPIEndpoint.java:355)
        at org.swordapp.server.CollectionAPI.post(CollectionAPI.java:156)
        at edu.harvard.iq.dataverse.api.datadeposit.SWORDv2CollectionServlet.doPost(SWORDv2CollectionServlet.java:34)

The Java SWORD library is upstream of me but here's where I'm tracking this issue: IQSS/dataverse#893

@pdurbin
Copy link
Contributor Author

pdurbin commented Oct 20, 2014

A related bug is that we get org.apache.abdera.parser.ParseException when trying to create a SWORD entry with some XML that contains an invisible character:

https://github.com/IQSS/dataverse/blob/master/scripts/api/data-deposit/data/atom-entry-study-894-invisible-character.xml

However, I was able to catch org.apache.abdera.parser.ParseException in my code

IQSS/dataverse@f181c0d

pdurbin added a commit to IQSS/swordv2-java-server-library that referenced this issue Oct 21, 2014
poikilotherm added a commit to gdcc/sword2-server that referenced this issue Jul 22, 2021
Thank you @pdurbin for your commit swordapp@8554370
from where I shamelessly plugged the fix in this commit.

The fix has been extended to be included in a refactoring.
Multipart uploads used the same logic (code duplication), so
the code was moved to a common function, applying the fix
for both cases.

swordapp#6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant