OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 Rev 156
Line 273... Line 273...
273
            final Reader bR = new StringReader(bW.getBuffer().toString());
273
            final Reader bR = new StringReader(bW.getBuffer().toString());
274
 
274
 
275
            Object interpreterResult = interpreter.interpret(bR, "memory");
275
            Object interpreterResult = interpreter.interpret(bR, "memory");
276
            bR.close();
276
            bR.close();
277
            try {
277
            try {
-
 
278
 
278
                // this.status.setText(interpreter.getVariableNames().toString());
279
                final Object variableValue = interpreter.getVariable(varCallName);
-
 
280
                if (variableValue != null && Number.class.isAssignableFrom(variableValue.getClass())) {
279
                this.status.setText("Code correct, valeur de retour = " + interpreter.getVariable(varCallName).toString());
281
                    this.status.setText("Code correct, valeur de retour = " + variableValue);
280
                this.setCodeValid(true);
282
                    this.setCodeValid(true);
281
                return interpreter.getVariable(varCallName);
283
                    return interpreter.getVariable(varCallName);
-
 
284
                } else {
-
 
285
                    this.status.setText("Code correct, valeur de retour incorrecte = " + variableValue);
-
 
286
                    setCodeValid(false);
-
 
287
                    return null;
-
 
288
                }
282
            } catch (IllegalStateException iSE) {
289
            } catch (IllegalStateException iSE) {
283
                if (interpreterResult != null) {
290
                if (interpreterResult != null) {
284
                    // this.status.setText(interpreter.getVariableNames().toString());
291
                    if (interpreterResult != null && Number.class.isAssignableFrom(interpreterResult.getClass())) {
285
                    this.status.setText("Code correct, valeur de retour = " + interpreterResult.toString());
292
                        this.status.setText("Code correct, valeur de retour = " + interpreterResult.toString());
286
                    this.setCodeValid(true);
293
                        this.setCodeValid(true);
287
                    bR.close();
-
 
288
                    return interpreterResult;
294
                        return interpreterResult;
289
                } else {
295
                    } else {
290
                    // this.status.setText(interpreter.getVariableNames().toString());
296
                        this.status.setText("Code correct, valeur de retour incorrecte = " + interpreterResult);
-
 
297
                        setCodeValid(false);
-
 
298
                        return null;
-
 
299
                    }
-
 
300
                } else {
291
                    this.status.setText("Aucune valeur de retour");
301
                    this.status.setText("Aucune valeur de retour");
292
                    this.setCodeValid(false);
302
                    this.setCodeValid(false);
293
                    return null;
303
                    return null;
294
                }
304
                }
295
            }
305
            }