Skip to content

WeakReference(s) lead to NullPointerException in bsh.BshClassManager$MemberCache.findMethod(String, java.lang.Class[]) after a couple of days running #781

@jrburk

Description

@jrburk

I have a couple of scripts that are running for ever in my Smart Home system. When the system runs for a couple of days BeanShell is not working anymore because of NullPointerException(s).

The references using WeakLinks should restore themselves if they got garbage collected.

bsh.EvalError: java.util.concurrent.CompletionException:
    java.util.concurrent.CompletionException:
        java.lang.NullPointerException:
        Cannot invoke "bsh.BshClassManager$MemberCache.findMethod(
            String, java.lang.Class[]
        )" because the return value of
        "bsh.util.ReferenceCache.get(Object)" is null
        at <unknown location>
    at bsh.This.invokeMethod(This.java:323)
    at Grohe_Blue_Webcam.run(Unknown Source)
    at i8.bundle.action.ScheduledActionJob.execute(
        ScheduledActionJob.java:78
      )
    at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(
        SimpleThreadPool.java:566
      )

Caused by: java.util.concurrent.CompletionException:
    java.util.concurrent.CompletionException:
        java.util.concurrent.CompletionException:
            java.lang.NullPointerException:
            Cannot invoke "bsh.BshClassManager$MemberCache.findMethod(
                String, java.lang.Class[]
            )" because the return value of
            "bsh.util.ReferenceCache.get(Object)" is null
            at bsh.util.ReferenceCache.dereferenceValue(
                ReferenceCache.java:163
              )
            at bsh.util.ReferenceCache.get(ReferenceCache.java:88)
            at bsh.Reflect.resolveExpectedJavaField(
                Reflect.java:357
              )
            at bsh.Reflect.resolveJavaField(Reflect.java:340)
            at bsh.NameSpace.getImportedVar(NameSpace.java:934)
            at bsh.NameSpace.getVariableImpl(NameSpace.java:658)
            at bsh.NameSpace.getVariableImpl(NameSpace.java:661)
            at bsh.NameSpace.getVariable(NameSpace.java:639)
            at bsh.Name.resolveThisFieldReference(Name.java:572)
            at bsh.Name.consumeNextObjectField(Name.java:252)
            at bsh.Name.toObject(Name.java:195)
            at bsh.BSHAmbiguousName.toObject(
                BSHAmbiguousName.java:53
              )
            at bsh.BSHAmbiguousName.toObject(
                BSHAmbiguousName.java:44
              )
            at bsh.BSHPrimaryExpression.eval(
                BSHPrimaryExpression.java:115
              )
            at bsh.BSHPrimaryExpression.eval(
                BSHPrimaryExpression.java:67
              )
            at bsh.BSHUnaryExpression.eval(
                BSHUnaryExpression.java:53
              )
            at bsh.BSHAssignment.eval(BSHAssignment.java:40)
            at bsh.BSHIfStatement.evaluateCondition(
                BSHIfStatement.java:56
              )
            at bsh.BSHIfStatement.eval(BSHIfStatement.java:39)
            at bsh.BSHBlock.evalBlock(BSHBlock.java:161)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions