Free Support Forum - aspose.com

Getting a java.lang.StringIndexOutOfBoundsException when calling Document.getPageCount()

Hi,

When we call Document.getPageCount() just after loading the document we’re getting a java.lang.StringIndexOutOfBoundsException wrapped in a java.lang.RuntimeException. It seems to originate from a chart in the document that was originally embedded from Excel. I will attach an example document here. (Although this problem sounds similar to the issue I raised in Getting an java.lang.ArrayIndexOutOfBoundsException when calling Document.getPageCount() (WORDSNET-22213), the exception I’m getting is different, as is the document that triggers the problem).

stringindexoutofbounds_example.docx (16.0 KB)

Environment
We’re using v21.4 and I can reproduce this on Mac and on Linux.

JVM
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)

Stack trace

Caused by: java.lang.RuntimeException: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 1
    at com.aspose.words.zz4T.zzz (Unknown Source)
    at com.aspose.words.zz4T.zzZ (Unknown Source)
    at com.aspose.words.zz6V.zzZ (Unknown Source)
    at com.aspose.words.zz6V.zzZ (Unknown Source)
    at com.aspose.words.zzZEA.zzU (Unknown Source)
    at com.aspose.words.zzZEA.zzW (Unknown Source)
    at com.aspose.words.zzZEA.zzU (Unknown Source)
    at com.aspose.words.zzZEN.zzl (Unknown Source)
    at com.aspose.words.zzZEN.zzZ4v (Unknown Source)
    at com.aspose.words.zzZEM.getWidth (Unknown Source)
    at com.aspose.words.zzYN4.zz65 (Unknown Source)
    at com.aspose.words.zzYO1.zzYx (Unknown Source)
    at com.aspose.words.zzXD.zz9c (Unknown Source)
    at com.aspose.words.zzXC.zz9c (Unknown Source)
    at com.aspose.words.zzYXU.zzR (Unknown Source)
    at com.aspose.words.zzYXU.zzYEl (Unknown Source)
    at com.aspose.words.zzYXU.zzX (Unknown Source)
    at com.aspose.words.zzYXU.zzYEq (Unknown Source)
    at com.aspose.words.zzYXQ.zzYE7 (Unknown Source)
    at com.aspose.words.zzYXQ.zzYEp (Unknown Source)
    at com.aspose.words.zzYH.zzdF (Unknown Source)
    at com.aspose.words.zzYH.zzdG (Unknown Source)
    at com.aspose.words.zzYH.zzdQ (Unknown Source)
    at com.aspose.words.zzYH.zzdP (Unknown Source)
    at com.aspose.words.zzZS7.<init> (Unknown Source)
    at com.aspose.words.zzYKM.<init> (Unknown Source)
    at com.aspose.words.zzYKC.zzYh5 (Unknown Source)
    at com.aspose.words.zzYKC.zzYh3 (Unknown Source)
    at com.aspose.words.zzYKC.zzYE7 (Unknown Source)
    at com.aspose.words.zzYKC.zzdP (Unknown Source)
    at com.aspose.words.zzYKC.zzYho (Unknown Source)
    at com.aspose.words.zzCP.zzW (Unknown Source)
    at com.aspose.words.zzYH.zzYx (Unknown Source)
    at com.aspose.words.zzYH.zzGK (Unknown Source)
    at com.aspose.words.zzCP.zzX (Unknown Source)
    at com.aspose.words.zzYH.zzGK (Unknown Source)
    at com.aspose.words.zzCP.zzZ (Unknown Source)
    at com.aspose.words.zzCP.zzI (Unknown Source)
    at com.aspose.words.zzVG.zzZ (Unknown Source)
    at com.aspose.words.zzVG.zzZ (Unknown Source)
    at com.aspose.words.zzYOL.zzYpI (Unknown Source)
    at com.aspose.words.zzYOL.zzY (Unknown Source)
    at com.aspose.words.zzYOL.zzZ (Unknown Source)
    at com.aspose.words.zzWY.zz8c (Unknown Source)
    at com.aspose.words.zzWY.zzW (Unknown Source)
    at com.aspose.words.zzWY.zzX (Unknown Source)
    at com.aspose.words.zzYYB.zzB (Unknown Source)
    at com.aspose.words.zzYYB.zzC (Unknown Source)
    at com.aspose.words.zzYYB.zzYFC (Unknown Source)
    at com.aspose.words.zzYYB.zzL (Unknown Source)
    at com.aspose.words.zzYXH.zzJ (Unknown Source)
    at com.aspose.words.zzYMM.zza (Unknown Source)
    at com.aspose.words.zz3P.zzJ (Unknown Source)
    at com.aspose.words.zz3Q.zzZxv (Unknown Source)
    at com.aspose.words.zzYYF.zzYFY (Unknown Source)
    at com.aspose.words.Document.updatePageLayout (Unknown Source)
    at com.aspose.words.Document.zzWa (Unknown Source)
    at com.aspose.words.Document.getPageCount (Unknown Source)
    at com.elsevier.dp.works.transformation.aspose.extractor.PageExtractor.extract (PageExtractor.java:30)
    at com.elsevier.dp.works.transformation.aspose.AsposeWorksTransformer.transform (AsposeWorksTransformer.java:97)
    at com.elsevier.dp.works.transformation.aspose.AsposeWorksTransformer.transform (AsposeWorksTransformer.java:56)
    at com.elsevier.dp.works.transformation.Main.main (Main.java:32)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:829)
Caused by: java.lang.StringIndexOutOfBoundsException: begin 0, end -1, length 1
    at java.lang.String.checkBoundsBeginEnd (String.java:3319)
    at java.lang.String.substring (String.java:1874)
    at com.aspose.words.zzHE.zzZ (Unknown Source)
    at com.aspose.words.zzHE.zzZ (Unknown Source)
    at com.aspose.words.zzHE.zzZ (Unknown Source)
    at com.aspose.words.zzGG.zzZ (Unknown Source)
    at com.aspose.words.zzGG.zzU (Unknown Source)
    at com.aspose.words.zzGG.zzX (Unknown Source)
    at com.aspose.words.zzJ5.zzZ (Unknown Source)
    at com.aspose.words.zzHE.zzX (Unknown Source)
    at com.aspose.words.zzHE.zzY (Unknown Source)
    at com.aspose.words.zzHE.<init> (Unknown Source)
    at com.aspose.words.zzG7.zzZPv (Unknown Source)
    at com.aspose.words.zzG7.zzZPy (Unknown Source)
    at com.aspose.words.zzG7.zzZVj (Unknown Source)
    at com.aspose.words.zzG7.zzZ (Unknown Source)
    at com.aspose.words.zzGF.zzZ (Unknown Source)
    at com.aspose.words.zz4T.zzz (Unknown Source)
    at com.aspose.words.zz4T.zzZ (Unknown Source)
    at com.aspose.words.zz6V.zzZ (Unknown Source)
    at com.aspose.words.zz6V.zzZ (Unknown Source)
    at com.aspose.words.zzZEA.zzU (Unknown Source)
    at com.aspose.words.zzZEA.zzW (Unknown Source)
    at com.aspose.words.zzZEA.zzU (Unknown Source)
    at com.aspose.words.zzZEN.zzl (Unknown Source)
    at com.aspose.words.zzZEN.zzZ4v (Unknown Source)
    at com.aspose.words.zzZEM.getWidth (Unknown Source)
    at com.aspose.words.zzYN4.zz65 (Unknown Source)
    at com.aspose.words.zzYO1.zzYx (Unknown Source)
    at com.aspose.words.zzXD.zz9c (Unknown Source)
    at com.aspose.words.zzXC.zz9c (Unknown Source)
    at com.aspose.words.zzYXU.zzR (Unknown Source)
    at com.aspose.words.zzYXU.zzYEl (Unknown Source)
    at com.aspose.words.zzYXU.zzX (Unknown Source)
    at com.aspose.words.zzYXU.zzYEq (Unknown Source)
    at com.aspose.words.zzYXQ.zzYE7 (Unknown Source)
    at com.aspose.words.zzYXQ.zzYEp (Unknown Source)
    at com.aspose.words.zzYH.zzdF (Unknown Source)
    at com.aspose.words.zzYH.zzdG (Unknown Source)
    at com.aspose.words.zzYH.zzdQ (Unknown Source)
    at com.aspose.words.zzYH.zzdP (Unknown Source)
    at com.aspose.words.zzZS7.<init> (Unknown Source)
    at com.aspose.words.zzYKM.<init> (Unknown Source)
    at com.aspose.words.zzYKC.zzYh5 (Unknown Source)
    at com.aspose.words.zzYKC.zzYh3 (Unknown Source)
    at com.aspose.words.zzYKC.zzYE7 (Unknown Source)
    at com.aspose.words.zzYKC.zzdP (Unknown Source)
    at com.aspose.words.zzYKC.zzYho (Unknown Source)
    at com.aspose.words.zzCP.zzW (Unknown Source)
    at com.aspose.words.zzYH.zzYx (Unknown Source)
    at com.aspose.words.zzYH.zzGK (Unknown Source)
    at com.aspose.words.zzCP.zzX (Unknown Source)
    at com.aspose.words.zzYH.zzGK (Unknown Source)
    at com.aspose.words.zzCP.zzZ (Unknown Source)
    at com.aspose.words.zzCP.zzI (Unknown Source)
    at com.aspose.words.zzVG.zzZ (Unknown Source)
    at com.aspose.words.zzVG.zzZ (Unknown Source)
    at com.aspose.words.zzYOL.zzYpI (Unknown Source)
    at com.aspose.words.zzYOL.zzY (Unknown Source)
    at com.aspose.words.zzYOL.zzZ (Unknown Source)
    at com.aspose.words.zzWY.zz8c (Unknown Source)
    at com.aspose.words.zzWY.zzW (Unknown Source)
    at com.aspose.words.zzWY.zzX (Unknown Source)
    at com.aspose.words.zzYYB.zzB (Unknown Source)
    at com.aspose.words.zzYYB.zzC (Unknown Source)
    at com.aspose.words.zzYYB.zzYFC (Unknown Source)
    at com.aspose.words.zzYYB.zzL (Unknown Source)
    at com.aspose.words.zzYXH.zzJ (Unknown Source)
    at com.aspose.words.zzYMM.zza (Unknown Source)
    at com.aspose.words.zz3P.zzJ (Unknown Source)
    at com.aspose.words.zz3Q.zzZxv (Unknown Source)
    at com.aspose.words.zzYYF.zzYFY (Unknown Source)
    at com.aspose.words.Document.updatePageLayout (Unknown Source)
    at com.aspose.words.Document.zzWa (Unknown Source)
    at com.aspose.words.Document.getPageCount (Unknown Source)
    at com.elsevier.dp.works.transformation.aspose.extractor.PageExtractor.extract (PageExtractor.java:30)
    at com.elsevier.dp.works.transformation.aspose.AsposeWorksTransformer.transform (AsposeWorksTransformer.java:97)
    at com.elsevier.dp.works.transformation.aspose.AsposeWorksTransformer.transform (AsposeWorksTransformer.java:56)
    at com.elsevier.dp.works.transformation.Main.main (Main.java:32)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:254)
    at java.lang.Thread.run (Thread.java:829)

@arronhardenels

We have logged this problem in our issue tracking system as WORDSJAVA-2580. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like