@Nonnull
    private InternalType getObjectByIdentifier(
            String identifier, @Nullable Directory<InternalType> directory)
            throws GuacamoleException {

        // Use the directory associated with this instance if not otherwise
        // specified
        if (directory == null)
            directory = this.directory;

        // Retrieve the object having the given identifier
        InternalType object;
        try {
            object = directory.get(identifier);
            if (object == null)
                throw new GuacamoleResourceNotFoundException(
                        "Not found: \"" + identifier + "\"");
        }
        catch (GuacamoleException | RuntimeException | Error e) {
            fireDirectoryFailureEvent(
                    DirectoryEvent.Operation.GET, identifier, null, e);
            throw e;
        }

        // Return the object; it is guaranteed to be non-null at this point
        return object;
    }
Retrieve and return the object having the given identifier from the
directory, throwing a GuacamoleResourceNotFoundException and firing a
directory GET failure event if no object exists with the given identifier
in the directory.

@param identifier
    The identifier of the object to retrieve from the directory.

@param directory
    The directory to fetch the object from. If null, the directory
    associated with this DirectoryResource instance will be used.

@return
    The object from the directory with the provided identifier.

@throws GuacamoleException
    If no object with the provided identifier exists within the
    directory, or if any other error occurs while attempting to retrieve
    the object.
guacamole/src/main/java/org/apache/guacamole/rest/directory/DirectoryResource.java