structurizr / cli

A command line utility for Structurizr.
https://docs.structurizr.com/cli
Apache License 2.0
500 stars 77 forks source link

NullPointerException when pushing updated DSL to workspace #24

Closed borisnaydis closed 3 years ago

borisnaydis commented 3 years ago

I often encounter an issue that prevents me from uploading updated DSL.

I do a few changes in the definition, try to push, and it fails with the following error. I suppose the API cannot merge the updated definition with the previous one. To circumvent this, I have to either delete the workspace or push an empty definition. After that, I can push the same updated DSL without issues. The error doesn't help to understand what has caused the mismatch.

The stack trace:

2021-02-04 16:16:42.791 ERROR 9 --- [           main] com.structurizr.api.StructurizrClient    : java.lang.NullPointerException
com.structurizr.api.StructurizrClientException: java.lang.NullPointerException
        at com.structurizr.api.StructurizrClient.putWorkspace(StructurizrClient.java:400)
        at com.structurizr.cli.PushCommand.run(PushCommand.java:183)
        at com.structurizr.cli.StructurizrCliApplication.run(StructurizrCliApplication.java:37)
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:795)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:779)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:322)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
        at com.structurizr.cli.StructurizrCliApplication.main(StructurizrCliApplication.java:74)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:109)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.NullPointerException
        at com.structurizr.view.DefaultLayoutMergeStrategy.lambda$findElementView$2(DefaultLayoutMergeStrategy.java:96)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
        at java.util.HashMap$KeySpliterator.tryAdvance(HashMap.java:1577)
        at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
        at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:499)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:486)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:531)
        at com.structurizr.view.DefaultLayoutMergeStrategy.findElementView(DefaultLayoutMergeStrategy.java:96)
        at com.structurizr.view.DefaultLayoutMergeStrategy.copyLayoutInformation(DefaultLayoutMergeStrategy.java:43)
        at com.structurizr.view.View.copyLayoutInformationFrom(View.java:396)
        at com.structurizr.view.ViewSet.copyLayoutInformationFrom(ViewSet.java:619)
        at com.structurizr.api.StructurizrClient.putWorkspace(StructurizrClient.java:355)
        ... 16 more
simonbrowndotje commented 3 years ago

There's a bug in the Java client library, which has been fixed, but the CLI needs a release. I will do that shortly...

simonbrowndotje commented 3 years ago

v1.8.1 is now available.