diff --git a/src/main/java/com/mobai/webMagic/util/ImageDownloaderUtil.java b/src/main/java/com/mobai/webMagic/util/ImageDownloaderUtil.java index 83f5bbb..68f41c2 100644 --- a/src/main/java/com/mobai/webMagic/util/ImageDownloaderUtil.java +++ b/src/main/java/com/mobai/webMagic/util/ImageDownloaderUtil.java @@ -31,7 +31,9 @@ public class ImageDownloaderUtil { try { httpResponse = httpClient.execute(httpGet); } catch (IOException e) { + logger.warn("execute http request fail:", e); + return; } //非常简单的下载方法 try { @@ -39,12 +41,14 @@ public class ImageDownloaderUtil { httpResponse.getEntity().writeTo(out); } catch (Exception e) { logger.warn("save file fail:", e); + return; } try { //消耗实体 EntityUtils.consume(httpResponse.getEntity()); } catch (IOException e) { logger.warn("consume entity fail:", e); + return; } } }