public String checkKeyAndGetDatabaseName(String db){
  if (key == null) {
    return db;
  }
  if (key.equals(db)) {
    return keyDatabase;
  }
  throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD);
}

public String checkKeyAndGetDatabaseName ( String db ) { if ( key == null ) { return db ; } if ( key . equals ( db ) ) { return keyDatabase ; } throw DbException . get ( ErrorCode . WRONG_USER_OR_PASSWORD ) ; }
if no key is set , return the original database name . if a key is set , check if the key matches . if yes , return the correct database name . if not , throw an exception .
