From 47baf4dea0183eee29da8ef88a2e6bc8864bcfd8 Mon Sep 17 00:00:00 2001 From: Can Date: Thu, 12 Sep 2024 21:34:58 +0200 Subject: [PATCH] trying to fix issue #19 (#20) --- src/main/java/com/greydev/notionbackup/NotionClient.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/greydev/notionbackup/NotionClient.java b/src/main/java/com/greydev/notionbackup/NotionClient.java index f4f8d38..2ff78cb 100644 --- a/src/main/java/com/greydev/notionbackup/NotionClient.java +++ b/src/main/java/com/greydev/notionbackup/NotionClient.java @@ -201,7 +201,7 @@ private Optional getDownloadLink(String taskId) throws IOException, Inte .uri(URI.create(GET_TASKS_ENDPOINT)) .header("Cookie", TOKEN_V2 + "=" + notionTokenV2) .header("Content-Type", "application/json") - .timeout(Duration.ofSeconds(10)) + .timeout(Duration.ofSeconds(20)) .POST(HttpRequest.BodyPublishers.ofString(postBody)) .build(); @@ -210,12 +210,12 @@ private Optional getDownloadLink(String taskId) throws IOException, Inte Results results = objectMapper.readValue(response.body(), Results.class); - if (results.getResults().isEmpty()) { + if (results == null || results.getResults() == null || results.getResults().isEmpty()) { sleep(6000); continue; } - Result result = results.getResults().stream().findFirst().get(); + Result result = results.getResults().get(0); if (result.isFailure()) { log.info("Notion API workspace export returned a 'failure' state. Reason: {}", result.getError());