QDox
  1. QDox
  2. QDOX-241

Increase stack size for deeply embedded interfaces or embedded classes

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.12, 2.0-alpha
    • Fix Version/s: 2.0
    • Component/s: Parser
    • Labels:
      None
    • Patch Submitted:
      Yes
    • Number of attachments :
      2

      Description

      QDox will fail with an ArrayIndexOutOfBoundsException if classes or interfaces are nested beyond 9 levels.

      We were able to get around the problem by simply modifying the JFlexLexer to have a larger array size. We have provided a patch that increases this array size to 50. Perhaps it should be even larger if the size of the allocation is not very worrisome.

      java.lang.ArrayIndexOutOfBoundsException: 10
      at com.thoughtworks.qdox.parser.impl.JFlexLexer.pushState(JFlexLexer.java:781)
      at com.thoughtworks.qdox.parser.impl.JFlexLexer.yylex(JFlexLexer.java:1350)
      at com.thoughtworks.qdox.parser.impl.JFlexLexer.lex(JFlexLexer.java:769)
      at com.thoughtworks.qdox.parser.impl.Parser.yylex(Parser.java:1004)
      at com.thoughtworks.qdox.parser.impl.Parser.yyparse(Parser.java:1284)
      at com.thoughtworks.qdox.parser.impl.Parser.parse(Parser.java:999)
      at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:353)
      at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:381)
      at com.thoughtworks.qdox.JavaDocBuilder.addSource(JavaDocBuilder.java:377)
      at com.thoughtworks.qdox.JavaDocBuilder$2.visitFile(JavaDocBuilder.java:467)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:43)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.walk(DirectoryScanner.java:34)
      at com.thoughtworks.qdox.directorywalker.DirectoryScanner.scan(DirectoryScanner.java:52)
      at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:464)
      at com.thoughtworks.qdox.JavaDocBuilder.addSourceTree(JavaDocBuilder.java:453)

      1. patch.txt
        0.5 kB
        Philip Maher
      2. Test.java
        2 kB
        Philip Maher

        Activity

        Hide
        Robert Scholte added a comment -

        If you need a larger depth then 10, you should really think of refactoring this code when possible (I'm wondering what Sonar would say). I don't like the idea to just push it to 50 "because you can".
        I think it should be possible to add a qdox.properties on the classpath, where you can specify some values if the defaults don't work for you.

        Show
        Robert Scholte added a comment - If you need a larger depth then 10, you should really think of refactoring this code when possible (I'm wondering what Sonar would say). I don't like the idea to just push it to 50 "because you can" . I think it should be possible to add a qdox.properties on the classpath, where you can specify some values if the defaults don't work for you.
        Hide
        Robert Scholte added a comment -

        Fixed in rev. 1517
        You can put a qdox.properties on your classpath.
        With the property lexer.statestack.size you can adjust this size (default is still 10).

        Show
        Robert Scholte added a comment - Fixed in rev. 1517 You can put a qdox.properties on your classpath. With the property lexer.statestack.size you can adjust this size (default is still 10).
        Robert Scholte made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Robert Scholte [ rfscholte ]
        Fix Version/s 2.0 [ 15636 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Robert Scholte
            Reporter:
            Philip Maher
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: