Report a form object without a value in `SHOW`, `PRINT`, `EXPORT`, `JSON` and `JSONTEXT` instead of a NullPointerException
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
The behavior is in how the SHOW/PRINT/EXPORT/JSON/JSONTEXT operators are parsed and validated: locate the parser code that reads the OBJECTS block and the class-form usage of these operators, then find where a missing = expression is currently left unchecked. Use the fix for DIALOG in #1979 as the model for how the error should be raised, and reuse the existing operator error reporting so the message carries the position. Done means the sample module from the issue fails with a clear "form object needs a value" error instead of a NullPointerException, and the same for the JSON/JSONTEXT expressions and class-forms.
Written by the indexing model from the issue text.
Description
Description
In the SHOW and PRINT operators, in the EXPORT of a form and in the form variants of JSON and JSONTEXT, every object listed in OBJECTS needs a value (OBJECTS s = expression), and so does the object of the class-form (SHOW EDIT Sku = expression). Only DIALOG allows an object to be listed without one. When the value is omitted in the other operators, it is not reported as an error of the operator: loading the module fails with a NullPointerException.
MODULE ShowProbe;
CLASS Sku;
num = DATA INTEGER (Sku);
FORM sku OBJECTS s = Sku PANEL PROPERTIES(s) num;
open () {
FOR num(Sku s) = 1 DO SHOW sku OBJECTS s;
}
Error during parsing at ShowProbe:7:44
java.lang.NullPointerException
PRINT sku OBJECTS s;, EXPORT sku OBJECTS s JSON;, the expressions JSON (sku OBJECTS s) and JSONTEXT (sku OBJECTS s), and the class-forms SHOW EDIT Sku;, SHOW LIST Sku;, PRINT LIST Sku;, EXPORT LIST Sku JSON; fail the same way. The /eval and /eval/action probes returned HTTP 500 with the same exception. When internal error details are hidden, the response omits the exception text. With the value given (SHOW sku OBJECTS s = s;) the module loads.
Reproduced on 7.0-SNAPSHOT (master). SHOW sku OBJECTS s; fails the same way on 6.3-SNAPSHOT.
Reason
In an application module, one such operator prevents the server from starting. In an evaluated script, it fails the request. The error gives a position but does not say that a value is missing. The operator is easy to write: inside a loop over s, OBJECTS s reads as "the object s of the form takes the loop's s", and the IDE does not mark it. A similar case of DIALOG was fixed in #1979.
Fix
Report it as a regular error of the operator, saying that the form object needs a value (= expression).
- Dominant language
- Java
- Stars
- 214
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lsfusion/platform
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
-
bug
Difficulty 4/5 1-2 days Newbie friendliness 58/100
All issues in lsfusion/platform
Similar issues
-
account assessment course feature lecture
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
app:learninggoalhub enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
PropertyResolver fails on JDK classes with a non-public field named like the propertyPossibly taken @vaibhavgupta443 claimed this today. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/wicket#1991 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100