Remove image from previous album, if set.
[Sone.git] / src / main / java / net / pterodactylus / sone / core / SoneDownloader.java
index 4de9678..8d0d1f2 100644 (file)
@@ -17,7 +17,6 @@
 
 package net.pterodactylus.sone.core;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.util.ArrayList;
@@ -184,8 +183,8 @@ public class SoneDownloader extends AbstractService {
                                }
                        }
                        return parsedSone;
-               } catch (IOException ioe1) {
-                       logger.log(Level.WARNING, "Could not parse Sone from " + requestUri + "!", ioe1);
+               } catch (Exception e1) {
+                       logger.log(Level.WARNING, "Could not parse Sone from " + requestUri + "!", e1);
                } finally {
                        Closer.close(soneInputStream);
                        soneBucket.free();
@@ -451,14 +450,14 @@ public class SoneDownloader extends AbstractService {
                                                String imageCreationTimeString = imageXml.getValue("creation-time", null);
                                                String imageKey = imageXml.getValue("key", null);
                                                String imageTitle = imageXml.getValue("title", null);
-                                               String imageDescription = imageXml.getValue("description", null);
+                                               String imageDescription = imageXml.getValue("description", "");
                                                String imageWidthString = imageXml.getValue("width", null);
                                                String imageHeightString = imageXml.getValue("height", null);
-                                               if ((imageId == null) || (imageCreationTimeString == null) || (imageKey == null) || (imageTitle == null) || (imageDescription == null) || (imageWidthString == null) || (imageHeightString == null)) {
+                                               if ((imageId == null) || (imageCreationTimeString == null) || (imageKey == null) || (imageTitle == null) || (imageWidthString == null) || (imageHeightString == null)) {
                                                        logger.log(Level.WARNING, "Downloaded Sone %s contains invalid images!", new Object[] { sone });
                                                        return null;
                                                }
-                                               long creationTime = Numbers.safeParseInteger(imageCreationTimeString, 0);
+                                               long creationTime = Numbers.safeParseLong(imageCreationTimeString, 0L);
                                                int imageWidth = Numbers.safeParseInteger(imageWidthString, 0);
                                                int imageHeight = Numbers.safeParseInteger(imageHeightString, 0);
                                                if ((imageWidth < 1) || (imageHeight < 1)) {