Issues

Select view

Select search mode

 

Incomplete language resource Json files causes the Lucee admin to crash

Fixed

Description

I’ve found an issue in the Lucee Administrator while working on the lang resource files. The fallback to english isn’t working properly and throwing an error when an incomplete resource file is added to the source. You may try it by adding this simple JSON language resource file (e.g. this pt.json) .

{ "key": "pt", "label": "Português", "data": { "overview": { "introdesc": { "server": "Example" } } } }

Whenever you add such a language resource file to the source, the admin will through an error, e.g.:

Lucee 6.0.0.475-SNAPSHOT Error (expression) Message: key [INFO] doesn't exist Stacktrace: The Error Occurred in /admin/overview.cfm: line 642 called from /admin/web.cfm: line 509 called from /admin/index.cfm: line 3 Java Stacktrace lucee.runtime.exp.ExpressionException: key [INFO] doesn't exist

 

My findings are that the fallback isn’t working as expected in this lines of code:
See here: https://github.com/lucee/Lucee/blob/bdf6d299cd2fc5a5fe0908469466e5fba0ade3e3/core/src/main/cfml/context/admin/resources/text.cfm#LL35C3-L43C59

  1. the tmp var isn’t being used.

  2. In line 43 there is a defining line:
    stText = application.stText[ session.lucee_admin_lang ];

    Now see line 48:
    application.stText[ session.lucee_admin_lang ] =langData[ session.lucee_admin_lang ].data; ,
    That line resets everything by overwriting any possible fallback data, and resetting it to the previous data from the files. Thus, any non existing definition in the lang resource file won’t have any data at all.

This is very likely related with the issues/ticket:
https://luceeserver.atlassian.net/browse/LDEV-4427
https://luceeserver.atlassian.net/browse/LDEV-4403

I’ve solved the issue by converting the nested struct to a one dimensional (unnested) struct ( using the propertypath as unique keys), then populating the language, and converting/translating it back. This ensures the english values as fallback data within the language.

Please See my PR in My Comments.

Environment

None

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Affects versions

Created 19 June 2023 at 22:28
Updated 20 June 2023 at 10:34
Resolved 20 June 2023 at 10:34

Activity

Show:

Michael Offner20 June 2023 at 10:29

can we close this?

Andreas R19 June 2023 at 23:53

you are fast with merging! THX!!! Just did an live update from 6.0.0.477-SNAPSHOT to 6.0.0.478-SNAPSHOT from within the Lucee admin, and it looks like it’s solved now. The 8s is really annoying, but it’s faster on my machine (I have an pretty old lap).

Zac Spitzer19 June 2023 at 23:33
Edited

but not any more!

https://github.com/lucee/Lucee/commit/9655520a10e1a2d7076aae766722a8f48c033bb8

i’ll note it tales for me almost 8s to load the admin after logging in (before and after this patch)

Zac Spitzer19 June 2023 at 23:25
Edited

Andreas R19 June 2023 at 22:29

Flag notifications