Exception when using !includesub

0 votes
asked Dec 13, 2019 in Question / help by Konstantin Lebedev (120 points)

I'm using PlantUML v1.2019.13

I have 2 files: a.uml, and b.uml. a.uml includes subpart from b.uml, and b.uml includes subpart from a.uml.

It's very important not to include whole file content, so i use !startsub !ensub and !includesub.

Using include guard (!includesub inside condition block) cause an exception (same behavior when  there is no condition).

a.uml

@startuml
!startsub DO_NOT_WANT_TO_INCLUDE_THIS
    !log A.BRIEF
!endsub
!startsub DETAILS
    !log A.DETAILS
    !$HAVE_MODULE_A = 1
    component [a] as A
    !if (%not(%variable_exists("$HAVE_MODULE_B")))
        !includesub b.uml!DETAILS
    !endif
    component [a1] as A1
    component [a2] as A2

    A <-- A1
    A <-- A2
    A <-- B
!endsub
@enduml

b.uml

@startuml
!startsub DO_NOT_WANT_TO_INCLUDE_THIS
    !log B.BRIEF
!endsub
!startsub DETAILS
    !log B.DETAILS
    !$HAVE_MODULE_B = 1
    component [b] as B
    !if (%not(%variable_exists("$HAVE_MODULE_A")))
        !includesub a.uml!DETAILS
    !endif
    component [b1] as B1
    component [b2] as B2

    B <-- B1
    B <-- B2
    B <-- A
!endsub
@enduml

java -jar plantuml.jar a.uml 2>&1 | head

[Log] A.BRIEF
Exception in thread "main" java.lang.StackOverflowError
    at java.base/java.io.UnixFileSystem.resolve(UnixFileSystem.java:104)
    at java.base/java.io.File.<init>(File.java:366)
    at net.sourceforge.plantuml.AParentFolderRegular.getAFile(AParentFolderRegular.java:62)
    at net.sourceforge.plantuml.preproc.ImportedFiles.getAFile(ImportedFiles.java:85)
    at net.sourceforge.plantuml.preproc.FileWithSuffix.<init>(FileWithSuffix.java:127)
    at net.sourceforge.plantuml.tim.TContext.executeIncludesub(TContext.java:593)
    at net.sourceforge.plantuml.tim.TContext.executeOneLine(TContext.java:204)
    at net.sourceforge.plantuml.tim.TContext.runSub(TContext.java:623)

What is the valid way to include looped subparts and make an include guard in PlantUML?

1 Answer

0 votes
answered Dec 13, 2019 by plantuml (295,000 points)
We have fixed some stuff.

Could you test with last beta http://beta.plantuml.net/plantuml.jar ?

And tell us the result.

Thanks !
commented Dec 17, 2019 by Konstantin Lebedev (120 points)
Thanx! Last beta (PlantUML Version 1.2019.14beta3) works good at this case.
...