Java StringIndexOutOfBoundsException and ArrayIndexOutOfBoundsException
Closed this issue · 4 comments
When I try to run parse_amr.sh
to parse text into linearized-AMR graphs, I frequently get the following problems:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1967)
at util.apps.AmrUtils.getAmrValue(AmrUtils.java:289)
at util.apps.AmrUtils.deAnonymizeAmrTokens(AmrUtils.java:250)
at util.apps.AmrUtils.deAnonymizeSingleAmr(AmrUtils.java:212)
at util.apps.AmrUtils.deAnonymizeSingle(AmrUtils.java:170)
at util.apps.AmrUtils.lambda$deAnonymizeFile$2(AmrUtils.java:160)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at util.apps.AmrUtils.deAnonymizeFile(AmrUtils.java:160)
at util.apps.AmrUtils.deAnonymizeAmr(AmrUtils.java:76)
at util.apps.AmrUtils.main(AmrUtils.java:597)
and
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at util.apps.AmrUtils.lambda$getAlignmentsFromString$5(AmrUtils.java:317)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at util.apps.AmrUtils.getAlignmentsFromString(AmrUtils.java:318)
at util.apps.AmrUtils.deAnonymizeSingle(AmrUtils.java:169)
at util.apps.AmrUtils.lambda$deAnonymizeFile$2(AmrUtils.java:160)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at util.apps.AmrUtils.deAnonymizeFile(AmrUtils.java:160)
at util.apps.AmrUtils.deAnonymizeAmr(AmrUtils.java:76)
at util.apps.AmrUtils.main(AmrUtils.java:597)
and
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at util.apps.AmrUtils.lambda$anonymizeFile$0(AmrUtils.java:110)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at util.apps.AmrUtils.anonymizeFile(AmrUtils.java:108)
at util.apps.AmrUtils.anonymizeText(AmrUtils.java:87)
at util.apps.AmrUtils.main(AmrUtils.java:598)
and
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 4
at java.util.Arrays$ArrayList.get(Arrays.java:3841)
at util.apps.AmrUtils.readGraph(AmrUtils.java:456)
at util.apps.AmrUtils.expandStrippedToFull(AmrUtils.java:229)
at util.apps.AmrUtils.lambda$deAnonymizeFile$2(AmrUtils.java:160)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at util.apps.AmrUtils.deAnonymizeFile(AmrUtils.java:160)
at util.apps.AmrUtils.deAnonymizeAmr(AmrUtils.java:76)
at util.apps.AmrUtils.main(AmrUtils.java:602)
Any idea or suggestion for fixing this bug? Thank you very much in advance!
First bug has been definitely fixed. The rest have also been taken care of, but I would appreciate some examples that cause them, as I cannot get to reproduce them.
I could provide the file from which I encountered these problems. Is it OK to send through Email?
Absolutely; thanks!
Latest update fix these bugs.