String albumImageId = albumXml.getValue("album-image", null);
if ((id == null) || (title == null) || (description == null)) {
logger.log(Level.WARNING, String.format("Downloaded Sone %s contains invalid album!", sone));
- return null;
+ throw new MalformedXml();
}
Album parent = sone.getRootAlbum();
if (parentId != null) {
parent = albums.get(parentId);
if (parent == null) {
logger.log(Level.WARNING, String.format("Downloaded Sone %s has album with invalid parent!", sone));
- return null;
+ throw new InvalidParentAlbum();
}
}
Album album = parent.newAlbumBuilder().withId(id).build().modify().setTitle(title).setDescription(description).update();
public static class MalformedTime extends RuntimeException {
}
+
+ public static class InvalidParentAlbum extends RuntimeException {
+
+ }
+
}