Frage

If a VersionConflictException is thrown the stacktrace contains the conflicting ID in the string:

com.google.gdata.util.VersionConflictException: Conflict Duplicate insert - page with name "EF9BDFEFBCF2AD70A68B57EFC4621D6D" already exists - existing page id is 8279809882450151638

I would like to get a handle to the conflicting entry. My current approach is to fetch the id from the string and fetch the entry through the SitesService.getEntry().

Is there a better way to do this? Either getting a handle to the entry from the exception or a method to fetch the ID of the conflicting entry? If Google decides to change the error message my method will break.

War es hilfreich?

Lösung

client.getEntry(new URL(getSiteFeedUrl() + location), SiteEntry.class);

Works, location is the last part of the site URL

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top