src/main/java/edu/wisc/my/portlets/bookmarks/web/support/PreferencesRequestResolver.java
public Preferences getPreferences(PortletRequest request, boolean create) {
        final String owner = this.ownerResolver.getOwner(request);
        final String name = this.nameResolver.getBookmarkSetName(request);
        Preferences preferences = this.preferencesStore.getPreferences(owner, name);
        
        if (preferences == null && create) {
            preferences = this.preferencesStore.createPreferences(owner, name);
            
            if (preferences == null) {
                throw new IllegalStateException("Required Preferences is null even after createPreferences was called.");
            }
        }

        return preferences;
    }
public Preferences getPreferences(PortletRequest request, boolean create) {
        final String owner = this.ownerResolver.getOwner(request);
        final String name = this.nameResolver.getBookmarkSetName(request);
        Preferences preferences = this.preferencesStore.getPreferences(owner, name);
        
        if (preferences == null && create) {
            preferences = this.preferencesStore.createPreferences(owner, name);
            
            if (preferences == null) {
                throw new IllegalStateException("Required Preferences is null even after createPreferences was called.");
            }
        }

        return preferences;
    }
Gets Preferences for the request using the injected {@link OwnerResolver}
and {@link NameResolver}.
<br>
<br>
If <code>create</code> is false and no Preferences exists for the name and owner null is returned.
<br>
<br>
If <code>create</code> is true and no Preferences exists for the name and owner a new Preferences is created.

@param request The request to resolve the name and owner from.
@param create If a Preferences should be created for the name and owner if one does not exist
@return The Preferences for the name and owner from the request, null if it does not exists and create is false. If create is true this will never return null.