nasa / CCDD

CFS Command and Data Dictionary Tool (CCDDT)
81 stars 31 forks source link

Tutorial script cannot be run #105

Closed 9a3eedi closed 11 months ago

9a3eedi commented 1 year ago

Hello,

While following the tutorial, I attempted to run the tutorial script (tutorial.js) and got an error:

Cannot execute script '/home/mkhoory/tar/CCDD/scripts/tutorial.js' using table(s) 'myStruct'; cause 'Script file '/home/mkhoory/tar/CCDD/scripts/tutorial.js' error 'class [Ljava.lang.String; cannot be cast to class java.util.List ([Ljava.lang.String; ... (68)

The myStruct passed to the script looks like this: image

and this is the child struct referenced image

From the error, it initially seemsedlike an issue in the way CCDD is executing the script, not the script itself. I figured it might be because my JRE is too new (v11), so I tried running CCDD with OpenJDK 8, but I got the same error. However, I also tried running another script: XTCE_export.js, and that worked OK, so maybe there's a problem with the tutorial.js script itself.

I would post a backtrace, but I'm not sure how. Also, I'm not very familiar with javascript

My platform is Ubuntu 22.04 running under WSL2 on Windows 10, with VcXsrv as the X server, and using the distro-supplied package for postgresql (version 14+238). I am using the distro supplied OpenJDK version 11.0.20 2023-07-18 and also tried OpenJDK 1.8.0_382

9a3eedi commented 1 year ago

Upon further investigation it seems like the offending line in tutorial.js is line 110, which calls the getLongestStrings() function in CcddScriptDataAccessHandler.java

However, that's as far as I can go, I tried to debug, but couldn't figure out how to correctly set up a development environment.

KevinMcCluney commented 1 year ago

I'm not sure what has changed with Javascript since this used to work. The problem is in the script. To correct it, change line 110 to: var columnWidths = ccdd.getLongestStrings(Java.to(tableData, "java.lang.String[][]"), null);

9a3eedi commented 1 year ago

Changing the line fixed the issue for me, thanks!