Migrated from JodaTime library to Java 8 Time (JodaTime integrated).

This commit is contained in:
Christian P. MOMON 2018-01-22 10:04:56 +01:00
parent de4bd8b44d
commit 3de3542a5c
6 changed files with 13 additions and 11 deletions

View File

@ -26,7 +26,6 @@
<classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
<classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
<classpathentry kind="lib" path="lib/jaxb-api-2.2.12.jar"/>
<classpathentry kind="lib" path="lib/joda-time-2.8.1.jar"/>
<classpathentry kind="lib" path="lib/pircbot-1.5.0.jar" sourcepath="lib/pircbot-1.5.0-sources.zip"/>
<classpathentry kind="lib" path="lib/scribe-1.3.7.jar"/>
<classpathentry kind="lib" path="lib/quartz-2.2.3.jar" sourcepath="lib/quartz-2.2.3-source.zip"/>

Binary file not shown.

Binary file not shown.

View File

@ -22,6 +22,8 @@ package org.april.hebdobot.model;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import org.apache.commons.collections.CollectionUtils;
@ -45,8 +47,6 @@ import org.april.hebdobot.util.BuildInformation;
import org.jibble.pircbot.IrcException;
import org.jibble.pircbot.NickAlreadyInUseException;
import org.jibble.pircbot.PircBot;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -310,7 +310,7 @@ public class Hebdobot extends PircBot
else
{
{
String date = ISODateTimeFormat.basicDate().print(new DateTime());
String date = LocalDate.now().format(DateTimeFormatter.BASIC_ISO_DATE);
String textReview = this.review.toString();
if (this.pastebinSettings.isValid())
@ -342,6 +342,7 @@ public class Hebdobot extends PircBot
}
File file = new File(this.reviewDirectory, date + "_" + this.reviewFileSuffix);
FileUtils.writeStringToFile(file, textReview, StandardCharsets.UTF_8);
logger.info("File review saved in: [{}]", file.getAbsolutePath());
sendMessage("% Compte-rendu de la revue : " + file.getName());
}
catch (final Exception exception)

View File

@ -19,14 +19,14 @@
*/
package org.april.hebdobot.model.review;
import org.joda.time.DateTime;
import java.time.LocalDateTime;
/**
* The Class Message.
*/
public class Message
{
private final DateTime date;
private final LocalDateTime date;
private final String author;
private final String content;
@ -42,7 +42,7 @@ public class Message
{
this.author = author;
this.content = content;
this.date = new DateTime();
this.date = LocalDateTime.now();
}
/**
@ -70,7 +70,7 @@ public class Message
*
* @return the date
*/
public DateTime getDate()
public LocalDateTime getDate()
{
return this.date;
}

View File

@ -19,15 +19,16 @@
*/
package org.april.hebdobot.model.review;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import org.apache.commons.lang3.StringUtils;
import org.april.hebdobot.model.UserAliases;
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import fr.devinsy.util.strings.StringSet;
@ -211,7 +212,8 @@ public class Review
addLine(buffer, '=');
addCenter(buffer, "Revue de la semaine en cours");
addEmpty(buffer);
addCenter(buffer, DateTimeFormat.fullDate().print(new DateTime()));
addCenter(buffer,
StringUtils.capitalize(LocalDateTime.now().format(DateTimeFormatter.ofPattern("EEEE dd MMMM yyyy").withLocale(Locale.FRENCH))));
addLine(buffer, '=');
addEmpty(buffer);
addEmpty(buffer);