VerifyError on Aspose words package

Hello,

I am having an issue with com.aspose.words package where I am getting a VerifyError, see exceptions bellow

java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    com/aspose/words/Style.<init>(I)V @87: invokestatic
  Reason:
    Type 'com/aspose/words/Style' (current frame, stack[0]) is not assignable to 'java/lang/Throwable'
  Current Frame:
    bci: @87
    flags: { }
    locals: { 'com/aspose/words/Style', integer }
    stack: { 'com/aspose/words/Style', long, long_2nd, 'java/lang/String', integer }
  Bytecode:
    0000000: 2ab7 0107 2a11 2fff b500 512a 112f ffb5
    0000010: 004f 2a11 2fff b500 4e2a 112f ffb5 004d
    0000020: 2a11 2fff b500 4c2a 112f ffb5 0045 2abb
    0000030: 0031 59b7 00e6 b500 582a bb00 3059 b700
    0000040: d0b5 0057 2a1b b500 40b2 0343 9900 122a
    0000050: 1403 4413 0347 03b8 034d a700 0457 b1  
  Exception Handler Table:
    bci [79, 90] => handler: 93
  Stackmap Table:
    full_frame(@93,{Object[#32],Integer},{Object[#847]})
    same_frame(@94)
	at com.aspose.words.zz1S.zzZ(Unknown Source)
	at com.aspose.words.zz1S.zzD(Unknown Source)
	at com.aspose.words.zz2Y.zzKR(Unknown Source)
	at com.aspose.words.zz27.zzZuA(Unknown Source)
	at com.aspose.words.zz27.zzKR(Unknown Source)
	at com.aspose.words.zzYZ3.zzKR(Unknown Source)
	at com.aspose.words.Document.zzY(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.xpandit.jiraxporter.commons.document.builder.impl.aspose.word.utils.AsposeWordUtils.getUsedMappings(Unknown Source)
	at com.xpandit.raven.document.generator.engine.impl.DocumentBuildLookupImpl.a(Unknown Source)
	at com.xpandit.raven.queue.ExportRunner.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
2022-07-12 13:35:22,646+0200 xray-docgen-export-executor:thread-3 ERROR lekshmi.s-nair@allianz.com 670x2021529x12 1wy9843 10.94.240.46:61923,44.138.74.147 /rest/raven/1.0/docgen/export/background [c.x.raven.queue.ExportRunner] 
com.xpandit.raven.b.a.a.m
	at com.xpandit.raven.document.generator.engine.impl.DocumentBuildLookupImpl.a(Unknown Source)
	at com.xpandit.raven.queue.ExportRunner.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    com/aspose/words/ConditionalStyle.<init>(ILcom/aspose/words/TableStyle;)V @28: invokestatic
  Reason:
    Type 'com/aspose/words/ConditionalStyle' (current frame, stack[0]) is not assignable to 'java/lang/Throwable'
  Current Frame:
    bci: @28
    flags: { }
    locals: { 'com/aspose/words/ConditionalStyle', integer, 'com/aspose/words/TableStyle' }
    stack: { 'com/aspose/words/ConditionalStyle', long, long_2nd, 'java/lang/String', integer }
  Bytecode:
    0000000: 2ab7 006f 2a1b b500 252a 2cb5 0020 b201
    0000010: 7499 0012 2a14 0175 1301 7803 b801 7ea7
    0000020: 0004 57b1                              
  Exception Handler Table:
    bci [20, 31] => handler: 34
  Stackmap Table:
    full_frame(@34,{Object[#3],Integer,Object[#10]},{Object[#384]})
    same_frame(@35)
	at com.aspose.words.zz1S.zzZF(Unknown Source)
	at com.aspose.words.zz1S.zzZ(Unknown Source)
	at com.aspose.words.zz1S.zzZ(Unknown Source)
	at com.aspose.words.zz1S.zzD(Unknown Source)
	at com.aspose.words.zz2Y.zzKR(Unknown Source)
	at com.aspose.words.zz27.zzZuA(Unknown Source)
	at com.aspose.words.zz27.zzKR(Unknown Source)
	at com.aspose.words.zzYZ3.zzKR(Unknown Source)
	at com.aspose.words.Document.zzY(Unknown Source)
	at com.aspose.words.Document.zzZ(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.xpandit.jiraxporter.commons.document.builder.impl.aspose.word.utils.AsposeWordUtils.getUsedMappings(Unknown Source)
	at com.xpandit.raven.document.generator.engine.impl.DocumentBuildLookupImpl.a(Unknown Source)
	at com.xpandit.raven.queue.ExportRunner.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

I am using the following maven dependency

<dependency>
      <groupId>com.aspose</groupId>
      <artifactId>aspose-words</artifactId>
      <version>20.12</version>
      <classifier>jdk17</classifier>
</dependency>

The problem is intermittent and occurs when running against openjdk 11.0.14.1.

Is this a known issue?

Thank you.

@xavieridera Could you please provide a simple code that will allow us to reproduce the problem and the document that causes the problem? We will check the issue and provide you more information.
Also, I would suggest you to try using the latest 22.6 version of Aspose.Words.

Hello @alexey.noskov,

thank you for your answer.
The document used is the following one

PVgenerationAuto5_used_template.docx (179.1 KB)

and I think the problematic code is bellow

public List<String> getUsedMappings(File file, boolean useCompleteMapping) throws IOException {
        try {
            InputStream inputStream = new FileInputStream(file);
            Throwable var4 = null;

            List var5;
            try {
                var5 = getUsedMappings(new Document(inputStream), useCompleteMapping);
            } catch (Throwable var16) {
                var4 = var16;
                throw var16;
            } finally {
                if (inputStream != null) {
                    if (var4 != null) {
                        try {
                            inputStream.close();
                        } catch (Throwable var15) {
                            var4.addSuppressed(var15);
                        }
                    } else {
                        inputStream.close();
                    }
                }

            }

            return var5;
        } catch (IOException var18) {
            LOGGER.error("An IO Exception occurred while opening the DOCX file", var18);
            throw var18;
        } catch (Exception var19) {
            LOGGER.error("An Exception occurred while opening the DOCX file", var19);
            throw new XporterRuntimeException("An Exception occurred while opening the DOCX file", var19);
        }
    }

The exception seem to occur in new Document(inputStream), it eventually falls in zz1S.zzZ() method and the Style.zzo5() static constructor may be the issue. But at it is an intermittent issue I couldn’t reproduce it during debug so I can’t be certain.

@xavieridera Unfortunately, I cannot reproduce the problem on my side. Could you please provide more information about your environment configuration? If possible provide a Dokerfile that reproduces the environment where the problem occurs. We will investigate the issue and provide you more information.

Hello @alexey.noskov,

thank you for the support.
I have created the following container that may be similar to the environment with the issue.

docker run -dt --name envwithjdk -p 8080:8080 openjdk:11.0.14.1-jre-buster

I wasn’t able to reproduce the problem with this container but it may be to the fact of being an intermittent issue.

@xavieridera Thank you for additional information. But unfortunately, I still cannot reproduce the problem on my side.
Have you tried using the latest 22.7 version of Aspose.Words for Java on your side? Does it have the same problem on your side?

Hi team,

we can’t provide you with a code that reproduces the error consistently. This is an intermittent error.

Can you provide us with some direction? Is it possible we have access to a non-obfuscated version of 20.12 version?

Many thanks,
Diamantino

@Diamantino,

unfortunately we can’t provide a non-obfuscated version.

In addition, I recommend that you check the latest version of the library. You can download it from the following link:
Download Aspose.Words for Java 22.11