{"record":{"id":"67a3738407c409ff","repo":"flowable/flowable-engine","slug":"context-is-null","errorCode":null,"errorMessage":"context is null","messagePattern":"context is null","errorType":"exception","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JsonNodeELResolver.java","lineNumber":87,"sourceCode":"     * this resolver, before returning. If this property is not true after this method is called, the caller should ignore the return value. Assuming the base is a Map, this method will always return\n     * Object.class. This is because Maps accept any object as the value for a given key.\n     * \n     * @param context\n     *            The context of this evaluation.\n     * @param base\n     *            The map to analyze. Only bases of type Map are handled by this resolver.\n     * @param property\n     *            The key to return the acceptable type for. Ignored by this resolver.\n     * @return If the propertyResolved property of ELContext was set to true, then the most general acceptable type; otherwise undefined.\n     * @throws NullPointerException\n     *             if context is null\n     * @throws ELException\n     *             if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.\n     */\n    @Override\n    public Class<?> getType(ELContext context, Object base, Object property) {\n        if (context == null) {\n            throw new NullPointerException(\"context is null\");\n        }\n        Class<?> result = null;\n        if (isResolvable(base)) {\n            result = Object.class;\n            context.setPropertyResolved(true);\n        }\n        return result;\n    }\n\n    /**\n     * If the base object is a map, returns the value associated with the given key, as specified by the property argument. If the key was not found, null is returned. If the base is a Map, the\n     * propertyResolved property of the ELContext object must be set to true by this resolver, before returning. If this property is not true after this method is called, the caller should ignore the\n     * return value. Just as in java.util.Map.get(Object), just because null is returned doesn't mean there is no mapping for the key; it's also possible that the Map explicitly maps the key to null.\n     * \n     * @param context\n     *            The context of this evaluation.\n     * @param base\n     *            The map to analyze. Only bases of type Map are handled by this resolver.","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/JsonNodeELResolver.java#L69-L105","documentation":"JsonNodeELResolver.getType() implements the JUEL/EL contract, which mandates an immediate NullPointerException when the passed ELContext is null before doing any resolution. It is a defensive precondition check protecting the resolver's use of context.setPropertyResolved().","triggerScenarios":"Calling resolver.getType(context, base, property) programmatically with a null ELContext; an EL implementation invoking the resolver without a context.","commonSituations":"Custom code or tests invoking the ELResolver API directly and forgetting the context argument; embedding JsonNodeELResolver in a non-Flowable EL setup where the context is not wired.","solutions":["Always pass a valid, non-null ELContext (e.g. StandardELContext or the engine-provided context)","In custom callers, assert/initialize the ELContext before invoking resolver methods","Use the resolver only through a proper EL processor (ExpressionFactory) which supplies the context automatically"],"exampleFix":"// before\nresolver.getType(null, jsonNode, \"field\"); // NPE\n// after\nELContext ctx = factory.getELContext(resolver);\nresolver.getType(ctx, jsonNode, \"field\");","handlingStrategy":"validation","validationCode":"if (context == null) {\n    throw new IllegalArgumentException(\"An ELContext is required before calling JsonNodeELResolver.getType\");\n}\nresolver.getType(context, base, property);","typeGuard":"boolean ready = context != null; // establish before invoking resolver\nif (!ready) context = factory.getELContext(resolver);","tryCatchPattern":"try {\n    return resolver.getType(context, base, property);\n} catch (NullPointerException e) {\n    if (\"context is null\".equals(e.getMessage())) {\n        throw new IllegalArgumentException(\"ELContext must be provided to JsonNodeELResolver\", e);\n    }\n    throw e;\n}","preventionTips":["Always obtain the ELContext from an ExpressionFactory rather than passing null","Never call ELResolver methods directly with a null context in tests","Wrap resolver access in a helper that initializes the context lazily"],"tags":["null-check","el-resolver","json","flowable"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}