From bb794dd37aec8ad2e68981aa854da7c3f8c4943f Mon Sep 17 00:00:00 2001 From: Saisai Date: Fri, 30 Aug 2024 10:00:08 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E7=88=AC=E5=8F=96=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=9B=BE=E7=89=87=E6=96=87=E4=BB=B6=20?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8B=E8=BD=BD=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mobai/webMagic/util/ImageDownloaderUtil.java | 4 ++++ 1 file changed, 4 insertions(+) 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; } } }