diff --git a/src/com/difegue/doujinsoft/wc24/WiiConnect24Api.java b/src/com/difegue/doujinsoft/wc24/WiiConnect24Api.java index 94f008c..0736ee2 100644 --- a/src/com/difegue/doujinsoft/wc24/WiiConnect24Api.java +++ b/src/com/difegue/doujinsoft/wc24/WiiConnect24Api.java @@ -73,7 +73,7 @@ public String sendMails(List mails) throws IOException { // Log full multipart request, if thou must // It makes the logs gigantic if (System.getenv().containsKey("WC24_DEBUG")) { - + try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); builder.build().writeTo(baos); @@ -123,16 +123,17 @@ public void receiveMails() throws Exception { HttpResponse response = httpclient.execute(request); HttpEntity entity = response.getEntity(); - if (System.getenv().containsKey("WC24_DEBUG")) { - Logger log = Logger.getLogger("WC24 Debug"); - log.log(Level.INFO, responseText); - } - if (entity != null) try (InputStream inStream = entity.getContent()) { String responseText = new BufferedReader(new InputStreamReader(inStream)).lines() .collect(Collectors.joining("\n")); + + if (System.getenv().containsKey("WC24_DEBUG")) { + Logger log = Logger.getLogger("WC24 Debug"); + log.log(Level.INFO, responseText); + } + new MailItemParser(application).consumeEmails(responseText); } }