Made code review.

This commit is contained in:
Christian P. MOMON 2017-12-14 17:11:52 +01:00
parent e22c563554
commit c38e987611
6 changed files with 13 additions and 8 deletions

View File

@ -83,7 +83,7 @@ public class Application implements ReviewListener
{ {
try try
{ {
final File file = new File(date + "_" + this.properties.getProperty(FILE_SUFFIX)); File file = new File(date + "_" + this.properties.getProperty(FILE_SUFFIX));
FileUtils.writeStringToFile(file, text); FileUtils.writeStringToFile(file, text);
this.bot.sendMessage("% Compte-rendu de la revue : " + file.getName()); this.bot.sendMessage("% Compte-rendu de la revue : " + file.getName());
} }

View File

@ -56,7 +56,7 @@ public class PastebinClient
public static final String API_ERROR = "Bad API request,"; public static final String API_ERROR = "Bad API request,";
private final String apiKey; private final String apiKey;
private String apiUserKey = null; private String apiUserKey;
private HttpClient httpClient = new DefaultHttpClient(); private HttpClient httpClient = new DefaultHttpClient();

View File

@ -28,7 +28,7 @@ import java.util.Set;
*/ */
public class CollectiveTopic extends Topic public class CollectiveTopic extends Topic
{ {
private final Messages messages = new Messages(); private final Messages messages;
/** /**
* Instantiates a new collective topic. * Instantiates a new collective topic.
@ -39,6 +39,8 @@ public class CollectiveTopic extends Topic
public CollectiveTopic(final String title) public CollectiveTopic(final String title)
{ {
super(title); super(title);
this.messages = new Messages();
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -28,7 +28,7 @@ import java.util.Set;
*/ */
public class IndividualTopic extends Topic public class IndividualTopic extends Topic
{ {
private final Map<String, Messages> messages = new HashMap<String, Messages>(); private final Map<String, Messages> messages;
/** /**
* Instantiates a new individual topic. * Instantiates a new individual topic.
@ -39,6 +39,8 @@ public class IndividualTopic extends Topic
public IndividualTopic(final String title) public IndividualTopic(final String title)
{ {
super(title); super(title);
this.messages = new HashMap<String, Messages>();
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -26,7 +26,7 @@ import org.joda.time.DateTime;
*/ */
public class Message public class Message
{ {
private final DateTime date = new DateTime(); private final DateTime date;
private final String author; private final String author;
private final String content; private final String content;
@ -42,6 +42,7 @@ public class Message
{ {
this.author = author; this.author = author;
this.content = content; this.content = content;
this.date = new DateTime();
} }
/** /**

View File

@ -51,11 +51,11 @@ public class UserAlias
{ {
try try
{ {
final Unmarshaller u = JAXBContext.newInstance(Users.class).createUnmarshaller(); final Unmarshaller unmarshaller = JAXBContext.newInstance(Users.class).createUnmarshaller();
u.setSchema(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI) unmarshaller.setSchema(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI)
.newSchema(UserAlias.class.getResource("/fr/imirhil/april/hebdobot/users.xsd"))); .newSchema(UserAlias.class.getResource("/fr/imirhil/april/hebdobot/users.xsd")));
for (final User user : u.unmarshal(new StreamSource(source), Users.class).getValue().getUser()) for (final User user : unmarshaller.unmarshal(new StreamSource(source), Users.class).getValue().getUser())
{ {
final String realName = user.getRealName(); final String realName = user.getRealName();
for (final String nick : user.getNick()) for (final String nick : user.getNick())