Cleaned code.

This commit is contained in:
Christian P. MOMON 2018-01-03 02:51:35 +01:00
parent 54371c5f7a
commit 027927562e
4 changed files with 18 additions and 8 deletions

View File

@ -78,6 +78,18 @@ public class CronManager
TriggerListener listener = new CronListener(this.bot, cron); TriggerListener listener = new CronListener(this.bot, cron);
this.scheduler.getListenerManager().addTriggerListener(listener, KeyMatcher.keyEquals(new TriggerKey(cron.getName()))); 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;
} }
/** /**

View File

@ -21,6 +21,7 @@ package org.april.hebdobot.model;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collection; import java.util.Collection;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -343,7 +344,7 @@ public class Hebdobot extends PircBot
try try
{ {
File file = new File(this.homeDirectory, date + "_" + this.reviewFileSuffix); 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()); sendMessage("% Compte-rendu de la revue : " + file.getName());
} }
catch (final Exception exception) catch (final Exception exception)
@ -542,7 +543,7 @@ public class Hebdobot extends PircBot
else else
{ {
logger.info("Else caught."); logger.info("Else caught.");
// All the other. // All the other.
if (this.review != null) if (this.review != null)
{ {

View File

@ -21,6 +21,7 @@ package org.april.hebdobot.pastebin;
import java.io.IOException; import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -95,7 +96,7 @@ public class PastebinClient
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
final HttpResponse response = this.httpClient.execute(request); 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); APIException.throwIfError(content);
this.apiUserKey = content; this.apiUserKey = content;
} }
@ -425,7 +426,7 @@ public class PastebinClient
request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8));
final HttpResponse response = this.httpClient.execute(request); 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); APIException.throwIfError(result);
} }
catch (UnsupportedEncodingException exception) catch (UnsupportedEncodingException exception)

View File

@ -26,16 +26,12 @@ import java.util.Properties;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.april.hebdobot.HebdobotException; import org.april.hebdobot.HebdobotException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* The Class Launcher. * The Class Launcher.
*/ */
public class HebdobotUtils public class HebdobotUtils
{ {
private static final Logger logger = LoggerFactory.getLogger(HebdobotUtils.class);
/** /**
* Constructor restriction. * Constructor restriction.
*/ */