NullPointerException when you declare note style just before note (on sequence diagram)

0 votes
asked Feb 28, 2021 in Bug by The-Lu (63,920 points)

Hello PlantUML,

We observe a 'NullPointerException' when you declare note style just before note, on sequence diagram:

@startuml
a->b
<style>
  note {
    BackGroundColor green
  }
</style>
note over a: note\nover a
@enduml

That is OK, if style is on the beginning:

@startuml
<style>
  note {
    BackGroundColor green
  }
</style>
a->b
note over a: note\nover a
@enduml

That for your support,
Regards,
Th.

1 Answer

0 votes
answered Mar 5, 2021 by plantuml (294,960 points)
selected Mar 5, 2021 by The-Lu
 
Best answer

Because we are currently in transition mode for style, this issue is difficult to solve. Note that it will be fixed when we will have finished our work on style, so we don't want to spend time on it.

A possible workaround is to declare an empty style right at the beginning:

@startuml
<style>
</style>
a->b
<style>
  note {
    BackGroundColor green
  }
</style>
note over a: note\nover a
@enduml

I know it sounds strange, sorry about that!

commented Mar 5, 2021 by The-Lu (63,920 points)

Hello PlantUML,

Thank for the workaround,
As long as the local style is available:

@startuml
<style>
</style>
participant Alice
participant Bob
<style>
  note {
    BackGroundColor aqua
  }
</style>
note left of Alice
This is displayed
left of Alice.
end note

<style>
  note {
    BackGroundColor  #FBFB77
    .pink {
       BackGroundColor pink
  }
}
</style>
note right of Alice: This is displayed right of Alice.

note over Alice: This is displayed over Alice.

note <<pink>> over Alice, Bob : This is displayed\n over Bob and Alice.

note over Bob, Alice
This is yet another
example of
a long note.
end note
@enduml

Thanks for your work,
Regards,
Th.

...