Search in sources :

Example 1 with NotFoundException

use of org.eclipse.userstorage.util.NotFoundException in project epp.mpc by eclipse.

the class UserFavoritesService method getFavoriteIds.

public Set<String> getFavoriteIds(IProgressMonitor monitor) throws NoServiceException, NotAuthorizedException, IllegalStateException, IOException {
    SubMonitor progress = SubMonitor.convert(monitor, Messages.DefaultMarketplaceService_FavoritesRetrieve, 1000);
    try {
        String favoritesData = getFavoritesBlob().getContentsUTF();
        // FIXME waiting for USS bug 488335 to have proper progress and cancelation
        progress.worked(950);
        Set<String> result = parseFavoritesBlobData(favoritesData);
        synchronized (this) {
            favorites.clear();
            favorites.addAll(result);
        }
        return result;
    } catch (NotFoundException ex) {
        // the user does not yet have favorites
        return new LinkedHashSet<String>();
    } catch (OperationCanceledException ex) {
        throw processProtocolException(ex);
    } catch (ProtocolException ex) {
        throw processProtocolException(ex);
    }
}
Also used : ProtocolException(org.eclipse.userstorage.util.ProtocolException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) SubMonitor(org.eclipse.core.runtime.SubMonitor) FileNotFoundException(java.io.FileNotFoundException) NotFoundException(org.eclipse.userstorage.util.NotFoundException)

Aggregations

FileNotFoundException (java.io.FileNotFoundException)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 NotFoundException (org.eclipse.userstorage.util.NotFoundException)1 ProtocolException (org.eclipse.userstorage.util.ProtocolException)1