lock-manager icon indicating copy to clipboard operation
lock-manager copied to clipboard

groovy.lang.MissingPropertyException in Lock User

Open srpape opened this issue 8 years ago • 3 comments

Just saw the following error in the Lock User logs:

12:59:36 PM: error groovy.lang.MissingPropertyException: No such property: lock for class: java.lang.Boolean @ line 798

Seemed to occur after the user was in a "Controller failed to set code" state, after I reset the user.

The relevant code is the return lockApp.lock in this function:

def getLock(params) {
  def id = ''
  // Assign params to id.  Sometimes parameters are double nested.
  if (params?.id) {
    id = params.id
  } else if (params?.params){
    id = params.params.id
  } else if (state.lastLock) {
    id = state.lastLock
  }
  state.lastLock = id
  def lockApp = getLockApp(state.lastLock)

  return lockApp.lock
}

It appears getLockApp() returned false for some reason, and this function doesn't check for that condition.

srpape avatar Jun 10 '17 17:06 srpape

I can't replicate this. I've changed the code to add a try to the lock method, so it might stop the error from occurring, but probably won't solve the underlying issue.

Is it possible you somehow have a lock app installed without being connected to a lock? It would look like a blank line in the app screen. If there is, click into it and you should be able to remove the lock.

ethayer avatar Jun 11 '17 17:06 ethayer

No, I have 5 locks, and they all have names. I'm not sure exactly how it happened.

I was in debug mode because I was having issues with one of the users failing to set a code on a lock, trying a bunch of things to get it working. It seemed to happen right after I reset the user.

Thanks for looking into it. If I can figure out a reliable way to reproduce it, I'll let you know.

srpape avatar Jun 12 '17 13:06 srpape

The lock not found error should be fixed now. I also added a delay to the user initialization after you reset a user because it seems like there was a race condition where...

  • a user would become valid for attempting to send it to the lock
  • initialization logic would run before the valid user is saved on ST.
  • the valid user would look invalid milliseconds before it became valid, and then ignored.

update from master and let me know if this helps.

Thanks!

ethayer avatar Jun 12 '17 17:06 ethayer