You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this is a bug, but I encountered this situation while using the software. It does not occur consistently.
For an expression like "$.result.success," the data being accessed might have a "result" value or not. After compiling the expression using MVEL.compileExpression, I use MVEL.executeExpression to obtain the value. If the current data does not have a "result" value, I expect it to throw a PropertyAccessException, but instead, I get a NullPointerException (NPE).
Upon tracing the code, I found a suspicious part.
In ASTNode, there is a variable "protected transient volatile Accessor accessor;" with the "volatile" modifier. When I try to execute the expression from data without a "result" value and trace it to ASTNode, I find that the accessor already exists. As a result, it attempts to access the values in the order of "$," "result," and "success." Since "result" does not exist, it throws an NPE.
Actually, the expectation was that the accessor would not exist, and during the construction of the accessor, a PropertyAccessException would be thrown due to the null "result" value.
Therefore, I suspect that the issue is caused by the "volatile" modifier, which makes the accessor visible to other threads during concurrent execution, leading to the problem described above.
The text was updated successfully, but these errors were encountered:
I am not sure if this is a bug, but I encountered this situation while using the software. It does not occur consistently.
For an expression like "$.result.success," the data being accessed might have a "result" value or not. After compiling the expression using MVEL.compileExpression, I use MVEL.executeExpression to obtain the value. If the current data does not have a "result" value, I expect it to throw a PropertyAccessException, but instead, I get a NullPointerException (NPE).
Upon tracing the code, I found a suspicious part.
In ASTNode, there is a variable "protected transient volatile Accessor accessor;" with the "volatile" modifier. When I try to execute the expression from data without a "result" value and trace it to ASTNode, I find that the accessor already exists. As a result, it attempts to access the values in the order of "$," "result," and "success." Since "result" does not exist, it throws an NPE.
Actually, the expectation was that the accessor would not exist, and during the construction of the accessor, a PropertyAccessException would be thrown due to the null "result" value.
Therefore, I suspect that the issue is caused by the "volatile" modifier, which makes the accessor visible to other threads during concurrent execution, leading to the problem described above.
The text was updated successfully, but these errors were encountered: