-
Notifications
You must be signed in to change notification settings - Fork 490
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
Fix Abdera ArrayIndexOutOfBoundsException with non-existent atom-entry-study.xml in SWORD jar (upstream ideally) #893
Comments
Original Redmine Comment This bug still exists in the upstream, though it's in a different place now: Perhaps they should add a try/catch?
|
Original Redmine Comment I filed an issue upstream: swordapp/JavaServer2.0#6 |
As of 2c1cfd5 this error should be fixed. Rather than a crazy Glassfish exception we get a sane "Unable to parse SWORD entry" message to report back to the user:
Please note that this fix required patching the upstream SWORD library. I have submitted a pull request here: throw SwordError for unparseable Atom entry swordapp/JavaServer2.0#6 by pdurbin · Pull Request #7 · swordapp/JavaServer2.0 - swordapp/JavaServer2.0#7 If the pull request gets accepted and a new upstream version is released, we should upgrade to it. I left a note about this in our pom.xml: Line 72 in 2c1cfd5
Passing to QA. |
Create a study for non-existent atom-entry-study.xml
Below is the sword output: ` <sword:error xmlns:sword="http://purl.org/net/sword/terms/" href="Unable to parse SWORD entry: org.apache.abdera.parser.ParseException: java.lang.ArrayIndexOutOfBoundsException"> |
the message above is much better than the crazy glassfish exception, closing the issue. |
Author Name: Philip Durbin (@pdurbin)
Original Redmine Issue: 3305, https://redmine.hmdc.harvard.edu/issues/3305
Original Date: 2013-09-16
If you attempt to create a study via SWORD with an Atom entry file that doesn't exist you will see "org.apache.abdera.parser.ParseException: java.lang.ArrayIndexOutOfBoundsException" from the client side...
[#|2013-09-16T08:19:33.170-0400|WARNING|glassfis###1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=33;_ThreadName=Thread-4;|StandardWrapperValve[edu.harvard.iq.dvn.core.web.servlet.SWORDv2CollectionServlet]: PWC1406: Servlet.service() for servlet edu.harvard.iq.dvn.core.web.servlet.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:334)
at org.swordapp.server.CollectionAPI.post(CollectionAPI.java:156)
at edu.harvard.iq.dvn.core.web.servlet.SWORDv2CollectionServlet.doPost(SWORDv2CollectionServlet.java:37)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:115)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:328)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at java.io.PushbackInputStream.unread(PushbackInputStream.java:218)
at org.apache.abdera.i18n.text.io.DynamicPushbackInputStream.unread(DynamicPushbackInputStream.java:91)
at org.apache.abdera.i18n.text.io.PeekAheadInputStream.peek(PeekAheadInputStream.java:61)
at org.apache.abdera.i18n.text.io.PeekAheadInputStream.peek(PeekAheadInputStream.java:52)
at org.apache.abdera.i18n.text.io.CharsetSniffingInputStream.detectEncoding(CharsetSniffingInputStream.java:110)
at org.apache.abdera.parser.stax.util.FOMSniffingInputStream.detectEncoding(FOMSniffingInputStream.java:39)
at org.apache.abdera.i18n.text.io.CharsetSniffingInputStream.(CharsetSniffingInputStream.java:81)
at org.apache.abdera.i18n.text.io.CharsetSniffingInputStream.(CharsetSniffingInputStream.java:74)
at org.apache.abdera.parser.stax.util.FOMSniffingInputStream.(FOMSniffingInputStream.java:35)
at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:107)
... 37 more
|#]
328 protected void addDepositPropertiesFromEntry(Deposit deposit, HttpServletRequest req)
329 throws IOException
330 {
331 InputStream entryPart = req.getInputStream();
332 Abdera abdera = new Abdera();
333 Parser parser = abdera.getParser();
334 Document entryDoc = parser.parse(entryPart);
335 Entry entry = entryDoc.getRoot();
336 deposit.setEntry(entry);
337 }
The text was updated successfully, but these errors were encountered: