From 027927562ed1fab63b7dbd1cbce35efb20c7177a Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Wed, 3 Jan 2018 02:51:35 +0100 Subject: [PATCH] Cleaned code. --- src/org/april/hebdobot/cron/CronManager.java | 12 ++++++++++++ src/org/april/hebdobot/model/Hebdobot.java | 5 +++-- src/org/april/hebdobot/pastebin/PastebinClient.java | 5 +++-- src/org/april/hebdobot/util/HebdobotUtils.java | 4 ---- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/org/april/hebdobot/cron/CronManager.java b/src/org/april/hebdobot/cron/CronManager.java index 5d96781..4823a4b 100644 --- a/src/org/april/hebdobot/cron/CronManager.java +++ b/src/org/april/hebdobot/cron/CronManager.java @@ -78,6 +78,18 @@ public class CronManager TriggerListener listener = new CronListener(this.bot, cron); this.scheduler.getListenerManager().addTriggerListener(listener, KeyMatcher.keyEquals(new TriggerKey(cron.getName()))); + + logger.info("Added cron value: " + cron.getName()); + } + + /** + * Gets the crons. + * + * @return the crons + */ + public CronSettings getCrons() + { + return this.crons; } /** diff --git a/src/org/april/hebdobot/model/Hebdobot.java b/src/org/april/hebdobot/model/Hebdobot.java index ce4b3d9..c620721 100644 --- a/src/org/april/hebdobot/model/Hebdobot.java +++ b/src/org/april/hebdobot/model/Hebdobot.java @@ -21,6 +21,7 @@ package org.april.hebdobot.model; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Collection; import org.apache.commons.collections.CollectionUtils; @@ -343,7 +344,7 @@ public class Hebdobot extends PircBot try { File file = new File(this.homeDirectory, date + "_" + this.reviewFileSuffix); - FileUtils.writeStringToFile(file, textReview); + FileUtils.writeStringToFile(file, textReview, StandardCharsets.UTF_8); sendMessage("% Compte-rendu de la revue : " + file.getName()); } catch (final Exception exception) @@ -542,7 +543,7 @@ public class Hebdobot extends PircBot else { logger.info("Else caught."); - + // All the other. if (this.review != null) { diff --git a/src/org/april/hebdobot/pastebin/PastebinClient.java b/src/org/april/hebdobot/pastebin/PastebinClient.java index 1e3957d..4ced4ea 100644 --- a/src/org/april/hebdobot/pastebin/PastebinClient.java +++ b/src/org/april/hebdobot/pastebin/PastebinClient.java @@ -21,6 +21,7 @@ package org.april.hebdobot.pastebin; import java.io.IOException; import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.util.LinkedList; import java.util.List; @@ -95,7 +96,7 @@ public class PastebinClient request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); final HttpResponse response = this.httpClient.execute(request); - final String content = IOUtils.toString(response.getEntity().getContent()); + final String content = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); APIException.throwIfError(content); this.apiUserKey = content; } @@ -425,7 +426,7 @@ public class PastebinClient request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); final HttpResponse response = this.httpClient.execute(request); - result = IOUtils.toString(response.getEntity().getContent()); + result = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); APIException.throwIfError(result); } catch (UnsupportedEncodingException exception) diff --git a/src/org/april/hebdobot/util/HebdobotUtils.java b/src/org/april/hebdobot/util/HebdobotUtils.java index c1ae771..cbdc369 100644 --- a/src/org/april/hebdobot/util/HebdobotUtils.java +++ b/src/org/april/hebdobot/util/HebdobotUtils.java @@ -26,16 +26,12 @@ import java.util.Properties; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.math.NumberUtils; import org.april.hebdobot.HebdobotException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * The Class Launcher. */ public class HebdobotUtils { - private static final Logger logger = LoggerFactory.getLogger(HebdobotUtils.class); - /** * Constructor restriction. */