archimatetool / archi-scripting-plugin

jArchi - Scripting for Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
118 stars 33 forks source link

[jarchi] exception on updating visualObject.imagePosition property #106

Closed rchevallier closed 1 year ago

rchevallier commented 1 year ago

Version of Archi

Archi 4.9.3.202203221030

Archi Plug-ins

Archi Scripting (jArchi) 1.2.1.202208111159

Operating System

Windows 10 x64

Expected Behaviour

jArchi execute properly .imagePosition property for a visual object

Actual Behaviour

Got error : Script Error: javax.script.ScriptException: java.lang.NullPointerException at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.lambda$createNashornHostAccess$3(GraalJSScriptEngine.java:106) at com.oracle.truffle.polyglot.TargetMappingNode$SingleMappingNode.convert(TargetMappingNode.java:181) at com.oracle.truffle.polyglot.TargetMappingNode$SingleMappingNode.doDefault(TargetMappingNode.java:170) at com.oracle.truffle.polyglot.TargetMappingNodeGen$SingleMappingNodeGen.executeAndSpecialize(TargetMappingNodeGen.java:175) at com.oracle.truffle.polyglot.TargetMappingNodeGen$SingleMappingNodeGen.execute(TargetMappingNodeGen.java:158) at com.oracle.truffle.polyglot.TargetMappingNode.doCached(TargetMappingNode.java:80) at com.oracle.truffle.polyglot.TargetMappingNodeGen.execute(TargetMappingNodeGen.java:34) at com.oracle.truffle.polyglot.ToHostNode.convertImpl(ToHostNode.java:203) at com.oracle.truffle.polyglot.ToHostNode.doCached(ToHostNode.java:116) at com.oracle.truffle.polyglot.ToHostNodeGen.executeAndSpecialize(ToHostNodeGen.java:89) at com.oracle.truffle.polyglot.ToHostNodeGen.execute(ToHostNodeGen.java:49) at com.oracle.truffle.polyglot.HostExecuteNode.doFixed(HostExecuteNode.java:123)

Steps to Reproduce the Behaviour

  1. download and extract attached zip in the archi scripting source directory
  2. open and select a new blank model
  3. run the script "image_position_crash.ajs"
  4. see the exception trace in script console
rchevallier commented 1 year ago

forgot to add the zip file:

image_position_crash.zip

Phillipus commented 1 year ago

Ugh, those GraalVM messages are not very friendly are they?

You need IMAGE_POSITION.MIDDLE_CENTRE not IMAGE_POSITION.MIDDLE_CENTER

Because IMAGE_POSITION.MIDDLE_CENTER is null you are effectively calling:

vo.imagePosition = null

Because I'm from the UK I used that spelling. I should use CENTER really. I will add both to the init.js file

Phillipus commented 1 year ago

Just noticed I use CENTER elsewhere...I'll use that here too.

rchevallier commented 1 year ago

Thanks for the quick reply. I should have better RTFM ;-) Yep GraalVM message are not very helpful :-(