Report a form object without a value in `SHOW`, `PRINT`, `EXPORT`, `JSON` and `JSONTEXT` instead of a NullPointerException

Abierto
#2,015 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java
Área
compilers

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
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).

Lenguaje dominante
Java
Estrellas
214
Forks
46
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de lsfusion/platform

Todos los issues de lsfusion/platform

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.