Apex Documentation Generation fails

Issue #2352 resolved
Jason van Beukering created an issue
  • On a Webstorm project where I previously had no issue generating Apex Docs, running the generation now fails with the error below

    • Webstorm version: 2022.3.4
    • IcApexDoc version: 1.0.0.6
    • Illuminated Cloud version: 2.2.6.8

ApeDoc Generation Failed

Error: Invocation of method 'getDeclaration Wrappers' in class

com.ic. apexdoc. template.ApexDocIndexAllPageContext threw exception java. lang. IllegalArgumentException:

Illegal group reference at indexAllPage.vm[line 49, column 50]

Comments (12)

  1. Scott Wells repo owner

    Hi, Jason. Apologies for the issue. I’m going to attach a build of IcApexDoc 1.0.0.6 here temporarily that will provide a full stack trace for errors like this that terminate the process. That will allow me to pinpoint the exact regular expression that’s causing this issue for you so that I can perform better root cause analysis.

  2. Scott Wells repo owner

    Here you go. Just install this in place of what you have installed now, reproduce the issue, and provide the full failure message/stack trace. Once I have that I'll almost certainly have questions for you about the org against which IcApexDoc is being run (installed packages, etc.) and how it's being run (options provided).

  3. Jason van Beukering reporter

    Hi Scott,

    Does this assist?

    Error: Invocation of method 'getDeclarationWrappers' in class com.ic.apexdoc.template.ApexDocIndexAllPageContext threw exception java.lang.IllegalArgumentException: Illegal group reference at indexAllPage.vm[line 49, column 50] org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getDeclarationWrappers' in class com.ic.apexdoc.template.ApexDocIndexAllPageContext threw exception java.lang.IllegalArgumentException: Illegal group reference at indexAllPage.vm[line 49, column 50] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:308) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:235) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704) at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:237) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147) at org.apache.velocity.runtime.directive.Foreach.renderBlock(Foreach.java:309) at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:279) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439) at org.apache.velocity.Template.merge(Template.java:358) at org.apache.velocity.Template.merge(Template.java:262) at com.ic.util.VelocityUtil.applyVelocityTemplate(VelocityUtil.java:105) at com.ic.apexdoc.ApexDocProcessor.generateIndexAllFile(ApexDocProcessor.java:1177) at com.ic.apexdoc.ApexDocProcessor.generateIndexFiles(ApexDocProcessor.java:908) at com.ic.apexdoc.ApexDocProcessor.process(ApexDocProcessor.java:597) at com.ic.apexdoc.ApexDocProcessor.run(ApexDocProcessor.java:274) at com.ic.apexdoc.IcApexDoc.run(IcApexDoc.java:163) at com.ic.apexdoc.IcApexDoc.main(IcApexDoc.java:118) Caused by: java.lang.IllegalArgumentException: Illegal group reference at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1076) at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:1006) at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1268) at com.ic.markdown.MarkdownToHtmlConverter.applyTransform(MarkdownToHtmlConverter.java:399) at com.ic.markdown.MarkdownToHtmlConverter.toHtml(MarkdownToHtmlConverter.java:202) at com.ic.markdown.MarkdownToHtmlConverter.convert(MarkdownToHtmlConverter.java:176) at com.ic.apexdoc.ApexDocHtmlGenerator.generate(ApexDocHtmlGenerator.java:193) at com.ic.apexdoc.template.LightApexDeclarationTemplateWrapper.getDescription(LightApexDeclarationTemplateWrapper.java:800) at com.ic.apexdoc.template.LightApexDeclarationTemplateWrapper.forMember(LightApexDeclarationTemplateWrapper.java:177) at com.ic.apexdoc.template.ApexDocIndexAllPageContext.getDeclarationWrappers(ApexDocIndexAllPageContext.java:88) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221) ... 18 more

  4. Scott Wells repo owner

    Hi, Jason. Yes, it does. It looks like it's having issues processing a fenced code block in one of your files. I've instrumented a little additional error handling and recovery in the attached build. Can you please install it and use it provide a more detailed error? Note that it will include the entire text that's being converted from Markdown to HTML that's resulting in the failure, and it'll be important for me to have access to that so that I can reproduce and fix the issue. Feel free to email it to me if you'd prefer. Please make sure that the original formatting is retained using either a fenced code block (```...```) or a raw text file. Thanks!

  5. Scott Wells repo owner

    Oh, one other thing…it should complete ApexDoc generation time this because it’s going to recover from the error, but it won’t have converted the fenced code block in the description text for (at least) one of the members. Please send me any errors in the generation output that look like:

    Failed to apply transform pattern:
    <regexp>
    to Markdown text:
    <text>
    <stack trace>
    

  6. Jason van Beukering reporter

    Here is the snippet as request

    Error

    Failed to apply transform pattern:
    (?ms)^([ ])(`{3,})(\w+)?
    (.?
    )\1\2
    to Markdown text:

    CMN_UTIL_String.containsAny(null, *) = false
    CMN_UTIL_String.containsAny("", *) = false
    CMN_UTIL_String.containsAny(*, null) = false
    CMN_UTIL_String.containsAny(*, "") = false
    CMN_UTIL_String.containsAny("zzabyycdxx", "za") = true
    CMN_UTIL_String.containsAny("zzabyycdxx", "by") = true
    CMN_UTIL_String.containsAny("zzabyycdxx", "zy") = true
    CMN_UTIL_String.containsAny("zzabyycdxx", "\tx") = true
    CMN_UTIL_String.containsAny("zzabyycdxx", "$.#yF") = true
    CMN_UTIL_String.containsAny("aba", "z") = false
    

    java.lang.IllegalArgumentException: Illegal group reference
    at java.base/java.util.regex.Matcher.appendExpandedReplacement(Matcher.java:1076)
    at java.base/java.util.regex.Matcher.appendReplacement(Matcher.java:1006)
    at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1268)
    at com.ic.markdown.MarkdownToHtmlConverter.applyTransform(MarkdownToHtmlConverter.java:402)
    at com.ic.markdown.MarkdownToHtmlConverter.toHtml(MarkdownToHtmlConverter.java:203)
    at com.ic.markdown.MarkdownToHtmlConverter.convert(MarkdownToHtmlConverter.java:177)
    at com.ic.apexdoc.ApexDocHtmlGenerator.generate(ApexDocHtmlGenerator.java:193)
    at com.ic.apexdoc.template.LightApexDeclarationTemplateWrapper.getDescription(LightApexDeclarationTemplateWrapper.java:800)
    at com.ic.apexdoc.template.LightApexDeclarationTemplateWrapper.forMember(LightApexDeclarationTemplateWrapper.java:177)
    at com.ic.apexdoc.template.ApexDocIndexAllPageContext.getDeclarationWrappers(ApexDocIndexAllPageContext.java:88)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:571)
    at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:554)
    at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:221)
    at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:368)
    at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:704)
    at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:237)
    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
    at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:147)
    at org.apache.velocity.runtime.directive.Foreach.renderBlock(Foreach.java:309)
    at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:279)
    at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:304)
    at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:439)
    at org.apache.velocity.Template.merge(Template.java:358)
    at org.apache.velocity.Template.merge(Template.java:262)
    at com.ic.util.VelocityUtil.applyVelocityTemplate(VelocityUtil.java:105)
    at com.ic.apexdoc.ApexDocProcessor.generateIndexAllFile(ApexDocProcessor.java:1177)
    at com.ic.apexdoc.ApexDocProcessor.generateIndexFiles(ApexDocProcessor.java:908)
    at com.ic.apexdoc.ApexDocProcessor.process(ApexDocProcessor.java:597)
    at com.ic.apexdoc.ApexDocProcessor.run(ApexDocProcessor.java:274)
    at com.ic.apexdoc.IcApexDoc.run(IcApexDoc.java:172)
    at com.ic.apexdoc.IcApexDoc.main(IcApexDoc.java:121)

  7. Log in to comment