code: @Transactional(readOnly = true)
      public void validateToken(E token) throws Exception {
  
          if (token == null) {
              throw new Exception("The provided token is null.");
          }
  
          DateTime expirationDate = (DateTime) token.getExpirationDate();
  
          String tokenValue = token.getToken();
  
          // check if the token expire date is valid
          if (expirationDate.isBeforeNow()) {
              throw new Exception("The token '" + tokenValue + "' expired on '"
                  + expirationDate + "'");
          }
  
      }
docs: If the passed token is null or expired, this method will throw an
  {@link Exception}.
  
  @param token
  @throws Exception if the token is not valid (e.g. because it is expired)