From 54aef0f0e032176aa5c081ec35af7e75d5e63057 Mon Sep 17 00:00:00 2001 From: Sutra Zhou Date: Tue, 23 Apr 2024 23:34:15 +0800 Subject: [PATCH 1/2] Update versions for hotfix --- pom.xml | 2 +- webmagic-core/pom.xml | 2 +- webmagic-coverage/pom.xml | 2 +- webmagic-extension/pom.xml | 2 +- webmagic-samples/pom.xml | 2 +- webmagic-saxon/pom.xml | 2 +- webmagic-scripts/pom.xml | 2 +- webmagic-selenium/pom.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 0eaf2f761..df314b7ce 100644 --- a/pom.xml +++ b/pom.xml @@ -1,7 +1,7 @@ us.codecraft - 0.10.2 + 0.10.3 4.0.0 pom diff --git a/webmagic-core/pom.xml b/webmagic-core/pom.xml index 8803b6ede..20a942791 100644 --- a/webmagic-core/pom.xml +++ b/webmagic-core/pom.xml @@ -3,7 +3,7 @@ us.codecraft webmagic-parent - 0.10.2 + 0.10.3 4.0.0 diff --git a/webmagic-coverage/pom.xml b/webmagic-coverage/pom.xml index 8754c4782..46b66f328 100644 --- a/webmagic-coverage/pom.xml +++ b/webmagic-coverage/pom.xml @@ -8,7 +8,7 @@ us.codecraft webmagic-parent - 0.10.2 + 0.10.3 webmagic-coverage diff --git a/webmagic-extension/pom.xml b/webmagic-extension/pom.xml index 03ef006d5..dd72ccbd9 100644 --- a/webmagic-extension/pom.xml +++ b/webmagic-extension/pom.xml @@ -3,7 +3,7 @@ us.codecraft webmagic-parent - 0.10.2 + 0.10.3 4.0.0 diff --git a/webmagic-samples/pom.xml b/webmagic-samples/pom.xml index 0f53566ac..3f191c7b7 100644 --- a/webmagic-samples/pom.xml +++ b/webmagic-samples/pom.xml @@ -3,7 +3,7 @@ webmagic-parent us.codecraft - 0.10.2 + 0.10.3 4.0.0 diff --git a/webmagic-saxon/pom.xml b/webmagic-saxon/pom.xml index 4b72dbdda..cbd1621ca 100644 --- a/webmagic-saxon/pom.xml +++ b/webmagic-saxon/pom.xml @@ -3,7 +3,7 @@ webmagic-parent us.codecraft - 0.10.2 + 0.10.3 4.0.0 diff --git a/webmagic-scripts/pom.xml b/webmagic-scripts/pom.xml index aa11e1c6f..568c8d0b8 100644 --- a/webmagic-scripts/pom.xml +++ b/webmagic-scripts/pom.xml @@ -3,7 +3,7 @@ webmagic-parent us.codecraft - 0.10.2 + 0.10.3 4.0.0 diff --git a/webmagic-selenium/pom.xml b/webmagic-selenium/pom.xml index e53dbee59..a7a9179bc 100644 --- a/webmagic-selenium/pom.xml +++ b/webmagic-selenium/pom.xml @@ -3,7 +3,7 @@ webmagic-parent us.codecraft - 0.10.2 + 0.10.3 4.0.0 From 462c60fef2e4f3c97f2f55415d76ce035a6478fc Mon Sep 17 00:00:00 2001 From: Sutra Zhou Date: Tue, 23 Apr 2024 23:37:46 +0800 Subject: [PATCH 2/2] Fix for entity is null. --- .../codecraft/webmagic/downloader/HttpClientDownloader.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webmagic-core/src/main/java/us/codecraft/webmagic/downloader/HttpClientDownloader.java b/webmagic-core/src/main/java/us/codecraft/webmagic/downloader/HttpClientDownloader.java index d93fc03c0..39deecc73 100644 --- a/webmagic-core/src/main/java/us/codecraft/webmagic/downloader/HttpClientDownloader.java +++ b/webmagic-core/src/main/java/us/codecraft/webmagic/downloader/HttpClientDownloader.java @@ -103,8 +103,8 @@ public void setThread(int thread) { protected Page handleResponse(Request request, String charset, HttpResponse httpResponse, Task task) throws IOException { HttpEntity entity = httpResponse.getEntity(); - byte[] bytes = entity != null ? IOUtils.toByteArray(entity.getContent()) : new byte[0];; - String contentType = httpResponse.getEntity().getContentType() == null ? "" : httpResponse.getEntity().getContentType().getValue(); + byte[] bytes = entity != null ? IOUtils.toByteArray(entity.getContent()) : new byte[0]; + String contentType = entity != null && entity.getContentType() != null ? entity.getContentType().getValue() : null; Page page = new Page(); page.setBytes(bytes); if (!request.isBinaryContent()) {