Skip to content

It is not possible to activate all PlantUML elements with "ENABLE_ALL_PLANT_ELEMENTS". New PlantUML server versions produce an error. #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
kirchsth opened this issue Mar 30, 2025 · 4 comments · May be fixed by #391

Comments

@kirchsth
Copy link
Member

The "Sample with PlantUML elements" sample in the LayoutOptions.md section is not working anymore (ex. PlantUML version 1.2025.4beta3).

If "!ENABLE_ALL_PLANT_ELEMENTS = 1" is set then it produces an error like below:

Error java.lang.IllegalStateException
java.lang.IllegalStateException
        at net.sourceforge.plantuml.command.CommandSkinParamMultilines.execute(CommandSkinParamMultilines.java:112)
        at net.sourceforge.plantuml.command.CommandSkinParamJaws.executeArg(CommandSkinParamJaws.java:114)
        at net.sourceforge.plantuml.command.CommandSkinParamJaws.executeArg(CommandSkinParamJaws.java:87)
        at net.sourceforge.plantuml.command.SingleLineCommand2.execute(SingleLineCommand2.java:189)
        at net.sourceforge.plantuml.command.ProtectedCommand.execute(ProtectedCommand.java:96)
        at net.sourceforge.plantuml.AbstractPSystem.executeCommand(AbstractPSystem.java:234)
        at net.sourceforge.plantuml.command.PSystemCommandFactory.executeFewLines(PSystemCommandFactory.java:181)
        at net.sourceforge.plantuml.command.PSystemCommandFactory.createSystem(PSystemCommandFactory.java:140)
        at net.sourceforge.plantuml.PSystemBuilder.createPSystem(PSystemBuilder.java:197)
        at net.sourceforge.plantuml.BlockUml.getDiagram(BlockUml.java:229)
        at net.sourceforge.plantuml.SourceFileReaderAbstract.getGeneratedImages(SourceFileReaderAbstract.java:218)
        at net.sourceforge.plantuml.Run.manageFileInternal(Run.java:565)
        at net.sourceforge.plantuml.Run.processArgs(Run.java:459)
        at net.sourceforge.plantuml.Run.manageAllFiles(Run.java:426)
        at net.sourceforge.plantuml.Run.main(Run.java:261)

If the options is not activated then it works without any problem ("only" the style is not correct):

The problem is the changed "\n", "%newline()" handling in the new PlantUML versions.

@kirchsth
Copy link
Member Author

kirchsth commented Mar 30, 2025

The problem is that the "style" supports no %newline() anymore ("skinparam" are fixed in the meantime and works again).
Eg. following sample works with an older version (ex. v1.2024.5) but not with current version (ex. v1.2025.3beta4).
The sample contains a skinparam and a style section but only the styles are the problematic one.

@startuml
!ENABLE_ALL_PLANT_ELEMENTS = 1

!function $nl()
  ' workaround
  ' !return %breakline()
  !return %newline()
!endfunction

!function $elementTagSkinparams($element, $tagStereo, $fontColor)
  !$elementSkin = "skinparam " + $element + "<<" + $tagStereo + ">> {" + %newline()
  !if ($fontColor != "")
    !$elementSkin = $elementSkin + "    StereotypeFontColor " + $fontColor + %newline()
    !$elementSkin = $elementSkin + "    FontColor " + $fontColor + %newline()
  !endif
  !$elementSkin = $elementSkin + "}" + %newline()
  !return $elementSkin
!endfunction

' label colors cannot be set via skinparam use style
!function $labelElementTagSkinparams($tagStereo, $bgColor)
    !$tagSkin = $nl() + "<style>" + $nl()
    ' componentDiagram {
    !$tagSkin = $tagSkin + "  label {" + $nl()
    !$tagSkin = $tagSkin + "    ." + $tagStereo + " {" + $nl()
    !$tagSkin = $tagSkin + "      StereotypeFontColor " + $bgColor + $nl()
    !$tagSkin = $tagSkin + "      Fontcolor " + $bgColor + $nl()
    !$tagSkin = $tagSkin + "    }" + $nl()
    !$tagSkin = $tagSkin + "  }" + $nl()
    ' }
    !$tagSkin = $tagSkin + "</style>" + $nl()
  !return $tagSkin
!endfunction

!unquoted procedure $defineSkinparams($tagStereo, $bgColor, $fontColor)
  ' skinparam works based on updated server implementation
  !$tagSkin = $elementTagSkinparams("rectangle", $tagStereo, $fontColor)
  !$tagSkin = $tagSkin + $elementTagSkinparams("package", $tagStereo, $fontColor)

  ' style does not work, %newline() is not supported anymore
  !$tagSkin = $tagSkin + $labelElementTagSkinparams($tagStereo, $bgColor)
$tagSkin
!endprocedure

$defineSkinparams("red", white, red)
$defineSkinparams("blueboundary", white, blue)
$defineSkinparams("bluelabel", blue, white)

[C]

rectangle r <<red>> {
}

label "LABEL" as l <<bluelabel>>

package p <<blueboundary>> {
}

@enduml

If I replace the %newline() in the styles with the new %breakline() the it works with the new PlantUML version too.

!function $nl()
  ' workaround
  !return %breakline()
  ' !return %newline()
!endfunction

I reported in forum an issue for that.

kirchsth added a commit to kirchsth/C4-PlantUML that referenced this issue Mar 30, 2025
kirchsth added a commit to kirchsth/C4-PlantUML that referenced this issue Mar 30, 2025
@arnaudroques
Copy link

Thank you for the report.

I'm a bit confused about the following stack trace entries:

        at net.sourceforge.plantuml.command.CommandSkinParamMultilines.execute(CommandSkinParamMultilines.java:112)
        at net.sourceforge.plantuml.command.CommandSkinParamJaws.executeArg(CommandSkinParamJaws.java:114)

The reason is that there is no line 112 in CommandSkinParamMultilines.java and no line 114 in CommandSkinParamJaws.java.
Which PlantUML jar file are you using?

Also, I cannot reproduce the crash, the following example works fine on my side:

@kirchsth
Copy link
Member Author

kirchsth commented Apr 5, 2025

Hi @arnaudroques,

thank you for your fast response (and sorry for my delay).

If I try to open following link then I cannot display it on the server (using %newline())

https://www.plantuml.com/plantuml/uml/dPNVRzem4CVV_LSSKIUeXZRjdQ7IBdlAqAJoDat8IGvcuTYPVnGXnFy-smIJ1WfqR_7vxdDt_Xx7WpPK6LjnqakdaySidK-oRFupcqndypHBVwJJsJDyXI-4z1PM58P90NU23-u9G1_MKgseabQKuTXJQAmIy25NI5US2Gn-qInmtHXxACe3xnKQELOep8mkdrTCr5JHIWyErY7S6NTXKA5qtmifp9FaKeKa1oSVvofEz24U4lWOmUup6Os29QAyRJo6hRV66WEJBM1mJ0CzXqtynMcwzj7plC-URZOrVe-8a3aIsmblvzvAyu_C5kGwT1SxxqhMzko8rWTES-HG-DGQ2Yg4D90ZQ3JmmYWS1R3QMSs6Orlf49sUbRijShwC4lj6_5NJX9_286T0ZrqFSJBzC1QoggLmy6-CBdqLsnD4_7GKQDhPHiuLTu1FfsDqU_Y50ObDlmFb0SN_0tQtbhthFlFkOi3eSrUSE5lHhxiChFXhfS4IQYKBBAr2k2jnmGHUcP7kIkYtHj1lAWqvrOuh1TYwf3w5HlM22bXLxmUHXXew_PpTIOd2mb2nv9XSMald7-OjPasB5LrU8eQsmfj2AL63a2RqDcpzVe7jxThMjLI-JIesbLHuePxt_XfVYHU58kHKgKHXwHfQ_s46X-0Ez-USScunztyaL6sEtjxwfdieETaxDH7kVNuz_IOaQWCAHYENqwztiYCan42IJHxJB06gWRlx21kF2MaaW7f_4Ojg20-kNLlnVm00

If I replace it with %breakline() and display the %version() then you see it is a 1.1025.3beta5 server

https://www.plantuml.com/plantuml/uml/dPHDRziy3CVl-XIqqQ8jdk8PTi-2ffrtyee1xMqO2jbcCYEovEabGH3akq-q4zbrKZVTpQB87qdzQTuPoxLrbM1HyZYxJvENMPg-_4XdZyylIPfyJnwVd-0BV6RiSeNQb4fUtp0MpPtChJ_0XHJU0705QwMNN2id2t-CD5gd9Lnc6lbIb19Rhs2NkDvR8vJ50VUAZ08hbFQPBvwMfQovvfMvFbXluSBw2uiQbV-UAsaVb52QiaG79uhpnSVc40yn_1V0_ZEUJCZIeSWsdSAMh5sDn2pdSDsbWSXZOxeuJjS_4ezyMhhTrFWj82X7H-mdF9zxBeqUkPopzw6xOUT1ohxdGBGh43n30JcbDf1pAPM53C6WXLN9eHF06M-r6u5zfPlevAJSVP6pHP2O6g6hVHCqX8sS3NhgUmY3IQEPgwfMqiE_bdn1LMoF4VGP7hPjPzjnnjq1_ZyUe_F3HmOaDFq1507oVmVipYrxDtpctMZ0vDDGd31RmM-u39pyuvJ50cgjSYoSHhWeS5vAV6T6XYlXgZU2jAWCPDnuhfBWwe9J2eDwXHhAgcu7aJSr3FevkPDYZRdbSY4m7bzBfnxcBMRDyoLVZ17RjkXDeL1eG2hRz7RR-t-XREt6rRNIr2QNcqff7Addet_ZA_62K8mTAnLhB7n3wz-bnLlmXvjJJfbmc2ad2wutdJTPttHlIevRfts4Vv-V3xyO2zg0Xid4vwJrpdQCDJ4GfxFx98s16n3-Fi2cKyRs4a1D5xsYzeGxtwwhn5y0

I tried it locally on my windows version with the MIT version "plantuml-mit-SNAPSHOT-v1.2025.3beta5.jar" (from 30.3.) too, and it was not working.

Image

I attached my puml and the console log too:

TODO.puml.txt (please remove txt extension)
TODO.notworking.log

I tried it with ".\plantuml-mit-1.2025.2.jar " too, same exception.

============

Now I tried a simpler sample, I think it shows the problem in the UI with the %newline() (but without exception):

newlineNotWorking.puml.txt

>java -jar .\plantuml-mit-SNAPSHOT-v1.2025.3beta5.jar .\newlineNotWorking.puml
Error line 24 in file: .\newlineNotWorking.puml
Some diagram description contains errors

Image

=============

With this script I can reproduce it with %newline() and %breakline(). For me it looks like that the problem is that 2 variables are combined (tested it with ex. .\plantuml-mit-1.2025.2.jar produces the same state exception; only changed lines in SourceFileReaderAbstract class).

@startuml

!unquoted procedure $defineSkinparams($tagStereo, $bgColor, $fontColor)
  !$elementSkin = "skinparam " + $element + "<<" + $tagStereo + ">> {" + %newline()
  !$elementSkin = $elementSkin + "}" + %newline()
' none of both is working
!$defs = $elementSkin + %newline()
'!$defs = $elementSkin + %breakline()
$defs
!endprocedure

$defineSkinparams("bluelabel", blue, white)

label "LABEL" as l <<bluelabel>>

@enduml

Or you can see the illegal state exception on server too
https://www.plantuml.com/plantuml/uml/TP3DJeD058NtzoaE4unjv16GL8sxxle4WrpefCFSEZzXONnt6M99O-tkSFY-aypTXQXzJACbAfBxJ1AvmzdB1tV9CygEU-FuS3BkhBqUmwQCUZX4zYmLodPu4oj-JhsukEGj0KN9baTsCNjuXWeN7mfFkFoTewhhfLb7SzSq-ChjW-F96iUR_pQlFxFq_STuX1F7a1wjn2DCm2H-PWSgygF2xSIrV9TfFUlJBxKmLB3hreCHtLvCjJQnrIrRLI7d2jFHHDuIBItK_kNrVQ-W0opgUiMRXcWthwVH_W00

BR Helmut

PS.: can we switch to the forum? https://forum.plantuml.net/19921/combination-styles-3beta4-%25newline-older-version-working

@arnaudroques
Copy link

PS.: can we switch to the forum? https://forum.plantuml.net/19921/combination-styles-3beta4-%25newline-older-version-working

No problem, I have answered on the forum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants