sonarcloud code improvements.

This commit is contained in:
Erik C. Thauvin 2019-04-01 21:59:23 -07:00
parent 20ff7ed62b
commit 6d3e3f2c6e
20 changed files with 139 additions and 156 deletions

2
sonar-project.properties Normal file
View file

@ -0,0 +1,2 @@
sonar.projectKey=ethauvin_semver
sonar.sourceEncoding=UTF-8

View file

@ -38,7 +38,7 @@ package net.thauvin.erik.mobibot;
* @created 2014-04-26 * @created 2014-04-26
* @since 1.0 * @since 1.0
*/ */
final public class Commands { public final class Commands {
/** /**
* The add (back)log command. * The add (back)log command.
*/ */
@ -159,8 +159,7 @@ final public class Commands {
* *
* @throws UnsupportedOperationException If the constructor is called. * @throws UnsupportedOperationException If the constructor is called.
*/ */
private Commands() private Commands() {
throws UnsupportedOperationException {
throw new UnsupportedOperationException("Illegal constructor call."); throw new UnsupportedOperationException("Illegal constructor call.");
} }
} }

View file

@ -73,8 +73,7 @@ final class EntriesMgr {
* *
* @throws UnsupportedOperationException If the constructor is called. * @throws UnsupportedOperationException If the constructor is called.
*/ */
private EntriesMgr() private EntriesMgr() {
throws UnsupportedOperationException {
throw new UnsupportedOperationException("Illegal constructor call."); throw new UnsupportedOperationException("Illegal constructor call.");
} }
@ -184,78 +183,76 @@ final class EntriesMgr {
} }
if (Utils.isValidString(bot.getLogsDir()) && Utils.isValidString(bot.getWeblogUrl())) { if (Utils.isValidString(bot.getLogsDir()) && Utils.isValidString(bot.getWeblogUrl())) {
Writer fw = null;
try { try {
fw = new OutputStreamWriter( final SyndFeedOutput output = new SyndFeedOutput();
new FileOutputStream(bot.getLogsDir() + CURRENT_XML), StandardCharsets.UTF_8);
SyndFeed rss = new SyndFeedImpl(); SyndFeed rss = new SyndFeedImpl();
rss.setFeedType("rss_2.0");
rss.setTitle(bot.getChannel() + " IRC Links");
rss.setDescription("Links from " + bot.getIrcServer() + " on " + bot.getChannel());
rss.setLink(bot.getWeblogUrl());
rss.setPublishedDate(Calendar.getInstance().getTime());
rss.setLanguage("en");
EntryLink entry;
StringBuffer buff;
EntryComment comment;
final List<SyndEntry> items = new ArrayList<>(0); final List<SyndEntry> items = new ArrayList<>(0);
SyndEntry item; SyndEntry item;
SyndContent description; SyndContent description;
try (final Writer fw = new OutputStreamWriter(
new FileOutputStream(bot.getLogsDir() + CURRENT_XML), StandardCharsets.UTF_8)) {
rss.setFeedType("rss_2.0");
rss.setTitle(bot.getChannel() + " IRC Links");
rss.setDescription("Links from " + bot.getIrcServer() + " on " + bot.getChannel());
rss.setLink(bot.getWeblogUrl());
rss.setPublishedDate(Calendar.getInstance().getTime());
rss.setLanguage("en");
for (int i = (entries.size() - 1); i >= 0; --i) { EntryLink entry;
entry = entries.get(i); StringBuilder buff;
EntryComment comment;
buff = new StringBuffer( for (int i = (entries.size() - 1); i >= 0; --i) {
"Posted by <b>" + entry.getNick() + "</b> on <a href=\"irc://" + bot.getIrcServer() + '/' entry = entries.get(i);
+ entry.getChannel() + "\"><b>" + entry.getChannel() + "</b></a>");
if (entry.getCommentsCount() > 0) { buff = new StringBuilder(
buff.append(" <br/><br/>"); "Posted by <b>" + entry.getNick() + "</b> on <a href=\"irc://" + bot.getIrcServer() + '/'
+ entry.getChannel() + "\"><b>" + entry.getChannel() + "</b></a>");
final EntryComment[] comments = entry.getComments(); if (entry.getCommentsCount() > 0) {
buff.append(" <br/><br/>");
for (int j = 0; j < comments.length; j++) { final EntryComment[] comments = entry.getComments();
comment = comments[j];
if (j > 0) { for (int j = 0; j < comments.length; j++) {
buff.append(" <br/>"); comment = comments[j];
if (j > 0) {
buff.append(" <br/>");
}
buff.append(comment.getNick()).append(": ").append(comment.getComment());
} }
buff.append(comment.getNick()).append(": ").append(comment.getComment());
} }
item = new SyndEntryImpl();
item.setLink(entry.getLink());
description = new SyndContentImpl();
description.setValue(buff.toString());
item.setDescription(description);
item.setTitle(entry.getTitle());
item.setPublishedDate(entry.getDate());
item.setAuthor(
bot.getChannel().substring(1) + '@' + bot.getIrcServer() + " (" + entry.getNick() + ')');
item.setCategories(entry.getTags());
items.add(item);
} }
item = new SyndEntryImpl(); rss.setEntries(items);
item.setLink(entry.getLink());
description = new SyndContentImpl();
description.setValue(buff.toString());
item.setDescription(description);
item.setTitle(entry.getTitle());
item.setPublishedDate(entry.getDate());
item.setAuthor(
bot.getChannel().substring(1) + '@' + bot.getIrcServer() + " (" + entry.getNick() + ')');
item.setCategories(entry.getTags());
items.add(item); if (bot.getLogger().isDebugEnabled()) {
bot.getLogger().debug("Writing the entries feed.");
}
output.output(rss, fw);
} }
rss.setEntries(items); try (final Writer fw = new OutputStreamWriter(
if (bot.getLogger().isDebugEnabled()) {
bot.getLogger().debug("Writing the entries feed.");
}
final SyndFeedOutput output = new SyndFeedOutput();
output.output(rss, fw);
fw.close();
fw = new OutputStreamWriter(
new FileOutputStream( new FileOutputStream(
bot.getLogsDir() + bot.getToday() + XML_EXT), StandardCharsets.UTF_8); bot.getLogsDir() + bot.getToday() + XML_EXT), StandardCharsets.UTF_8)) {
output.output(rss, fw); output.output(rss, fw);
}
if (isDayBackup) { if (isDayBackup) {
if (Utils.isValidString(bot.getBacklogsUrl())) { if (Utils.isValidString(bot.getBacklogsUrl())) {
@ -266,54 +263,46 @@ final class EntriesMgr {
history.remove(0); history.remove(0);
} }
} }
try (final Writer fw = new OutputStreamWriter(
new FileOutputStream(bot.getLogsDir() + NAV_XML), StandardCharsets.UTF_8)) {
rss = new SyndFeedImpl();
rss.setFeedType("rss_2.0");
rss.setTitle(bot.getChannel() + " IRC Links Backlogs");
rss.setDescription("Backlogs of Links from " + bot.getIrcServer() + " on " + bot.getChannel());
rss.setLink(bot.getBacklogsUrl());
rss.setPublishedDate(Calendar.getInstance().getTime());
fw.close(); String date;
fw = new OutputStreamWriter( items.clear();
new FileOutputStream(bot.getLogsDir() + NAV_XML), StandardCharsets.UTF_8);
rss = new SyndFeedImpl();
rss.setFeedType("rss_2.0");
rss.setTitle(bot.getChannel() + " IRC Links Backlogs");
rss.setDescription("Backlogs of Links from " + bot.getIrcServer() + " on " + bot.getChannel());
rss.setLink(bot.getBacklogsUrl());
rss.setPublishedDate(Calendar.getInstance().getTime());
String date; for (int i = (history.size() - 1); i >= 0; --i) {
items.clear(); date = history.get(i);
for (int i = (history.size() - 1); i >= 0; --i) { item = new SyndEntryImpl();
date = history.get(i); item.setLink(bot.getBacklogsUrl() + date + ".xml");
item.setTitle(date);
description = new SyndContentImpl();
description.setValue("Links for " + date);
item.setDescription(description);
item = new SyndEntryImpl(); items.add(item);
item.setLink(bot.getBacklogsUrl() + date + ".xml"); }
item.setTitle(date);
description = new SyndContentImpl();
description.setValue("Links for " + date);
item.setDescription(description);
items.add(item); rss.setEntries(items);
if (bot.getLogger().isDebugEnabled()) {
bot.getLogger().debug("Writing the backlog feed.");
}
output.output(rss, fw);
} }
rss.setEntries(items);
if (bot.getLogger().isDebugEnabled()) {
bot.getLogger().debug("Writing the backlog feed.");
}
output.output(rss, fw);
} else { } else {
bot.getLogger().warn("Unable to generate the backlogs feed. No property configured."); bot.getLogger().warn("Unable to generate the backlogs feed. No property configured.");
} }
} }
} catch (FeedException | IOException e) { } catch (FeedException | IOException e) {
bot.getLogger().warn("Unable to generate the entries feed.", e); bot.getLogger().warn("Unable to generate the entries feed.", e);
} finally {
try {
if (fw != null) {
fw.close();
}
} catch (Exception ignore) {
; // Do nothing
}
} }
} else { } else {
bot.getLogger() bot.getLogger()

View file

@ -67,7 +67,7 @@ public class EntryComment implements Serializable {
*/ */
@SuppressWarnings("UnusedDeclaration") @SuppressWarnings("UnusedDeclaration")
protected EntryComment() { protected EntryComment() {
; // Required for serialization. // Required for serialization.
} }
/** /**

View file

@ -266,14 +266,14 @@ public class EntryLink implements Serializable {
* @return The tags as a comma-delimited string. * @return The tags as a comma-delimited string.
*/ */
public final String getPinboardTags() { public final String getPinboardTags() {
final StringBuilder tags = new StringBuilder(nick); final StringBuilder pinboardTags = new StringBuilder(nick);
for (final Object tag : this.tags) { for (final SyndCategory tag : tags) {
tags.append(','); pinboardTags.append(',');
tags.append(((SyndCategoryImpl) tag).getName()); pinboardTags.append(tag.getName());
} }
return tags.toString(); return pinboardTags.toString();
} }
/** /**

View file

@ -57,6 +57,7 @@ import java.util.*;
* @created Jan 31, 2004 * @created Jan 31, 2004
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("WeakerAccess")
@Version(properties = "version.properties", className = "ReleaseInfo") @Version(properties = "version.properties", className = "ReleaseInfo")
public class Mobibot extends PircBot { public class Mobibot extends PircBot {
/** /**
@ -182,7 +183,6 @@ public class Mobibot extends PircBot {
* @param logsDirPath The path to the logs directory. * @param logsDirPath The path to the logs directory.
* @param p The bot's properties. * @param p The bot's properties.
*/ */
@SuppressWarnings("WeakerAccess")
public Mobibot(final String nickname, final String channel, final String logsDirPath, final Properties p) { public Mobibot(final String nickname, final String channel, final String logsDirPath, final Properties p) {
System.getProperties().setProperty("sun.net.client.defaultConnectTimeout", String.valueOf(CONNECT_TIMEOUT)); System.getProperties().setProperty("sun.net.client.defaultConnectTimeout", String.valueOf(CONNECT_TIMEOUT));
System.getProperties().setProperty("sun.net.client.defaultReadTimeout", String.valueOf(CONNECT_TIMEOUT)); System.getProperties().setProperty("sun.net.client.defaultReadTimeout", String.valueOf(CONNECT_TIMEOUT));
@ -210,7 +210,7 @@ public class Mobibot extends PircBot {
today = Utils.today(); today = Utils.today();
} }
} catch (IOException ignore) { } catch (IOException ignore) {
; // Do nothing. // Do nothing.
} catch (FeedException e) { } catch (FeedException e) {
logger.error("An error occurred while parsing the '" + EntriesMgr.CURRENT_XML + "' file.", e); logger.error("An error occurred while parsing the '" + EntriesMgr.CURRENT_XML + "' file.", e);
} }
@ -219,7 +219,7 @@ public class Mobibot extends PircBot {
try { try {
EntriesMgr.loadBacklogs(logsDir + EntriesMgr.NAV_XML, history); EntriesMgr.loadBacklogs(logsDir + EntriesMgr.NAV_XML, history);
} catch (IOException ignore) { } catch (IOException ignore) {
; // Do nothing. // Do nothing.
} catch (FeedException e) { } catch (FeedException e) {
logger.error("An error occurred while parsing the '" + EntriesMgr.NAV_XML + "' file.", e); logger.error("An error occurred while parsing the '" + EntriesMgr.NAV_XML + "' file.", e);
} }
@ -335,30 +335,24 @@ public class Mobibot extends PircBot {
// Redirect the stdout and stderr // Redirect the stdout and stderr
if (!line.hasOption(Commands.DEBUG_ARG.charAt(0))) { if (!line.hasOption(Commands.DEBUG_ARG.charAt(0))) {
PrintStream stdout = null; try (final PrintStream stdout = new PrintStream(new FileOutputStream(
logsDir + channel.substring(1) + '.' + Utils.today() + ".log", true))) {
try { System.setOut(stdout);
stdout = new PrintStream(new FileOutputStream(
logsDir + channel.substring(1) + '.' + Utils.today() + ".log", true));
} catch (IOException e) { } catch (IOException e) {
System.err.println("Unable to open output (stdout) log file."); System.err.println("Unable to open output (stdout) log file.");
e.printStackTrace(System.err); e.printStackTrace(System.err);
System.exit(1); System.exit(1);
} }
PrintStream stderr = null;
try { try (final PrintStream stderr = new PrintStream(
stderr = new PrintStream( new FileOutputStream(logsDir + nickname + ".err", true))) {
new FileOutputStream(logsDir + nickname + ".err", true)); System.setErr(stderr);
} catch (IOException e) { } catch (IOException e) {
System.err.println("Unable to open error (stderr) log file."); System.err.println("Unable to open error (stderr) log file.");
e.printStackTrace(System.err); e.printStackTrace(System.err);
System.exit(1); System.exit(1);
} }
System.setOut(stdout);
System.setErr(stderr);
} }
// Create the bot // Create the bot
@ -378,7 +372,7 @@ public class Mobibot extends PircBot {
try { try {
Thread.sleep((long) (secs * 1000)); Thread.sleep((long) (secs * 1000));
} catch (InterruptedException ignore) { } catch (InterruptedException ignore) {
; // Do nothing // Do nothing.
} }
} }
@ -387,7 +381,7 @@ public class Mobibot extends PircBot {
* *
* @param action The action. * @param action The action.
*/ */
final public void action(final String action) { public final void action(final String action) {
action(ircChannel, action); action(ircChannel, action);
} }
@ -580,7 +574,7 @@ public class Mobibot extends PircBot {
* @param help The help string. * @param help The help string.
* @return The indented help string. * @return The indented help string.
*/ */
final public String helpIndent(final String help) { public final String helpIndent(final String help) {
return helpIndent(help, true); return helpIndent(help, true);
} }
@ -624,7 +618,7 @@ public class Mobibot extends PircBot {
} else if (lcTopic.equals(Commands.VIEW_CMD)) { } else if (lcTopic.equals(Commands.VIEW_CMD)) {
send(sender, "To list or search the current URL posts:"); send(sender, "To list or search the current URL posts:");
send(sender, helpIndent(getNick() + ": " + Commands.VIEW_CMD) + " [<start>] [<query>]"); send(sender, helpIndent(getNick() + ": " + Commands.VIEW_CMD) + " [<start>] [<query>]");
} else if (lcTopic.equals(ircChannel.substring(1).toLowerCase())) { } else if (lcTopic.equalsIgnoreCase(ircChannel.substring(1))) {
send(sender, "To list the last 5 posts from the channel's weblog:"); send(sender, "To list the last 5 posts from the channel's weblog:");
send(sender, helpIndent(getNick() + ": " + ircChannel.substring(1))); send(sender, helpIndent(getNick() + ": " + ircChannel.substring(1)));
} else if (lcTopic.equals(Commands.RECAP_CMD)) { } else if (lcTopic.equals(Commands.RECAP_CMD)) {
@ -1390,9 +1384,9 @@ public class Mobibot extends PircBot {
* @param isPrivate Set to <code>true</code> if the response should be sent as a private message. * @param isPrivate Set to <code>true</code> if the response should be sent as a private message.
*/ */
private void recapResponse(final String sender, final boolean isPrivate) { private void recapResponse(final String sender, final boolean isPrivate) {
if (recap.size() > 0) { if (recap.isEmpty()) {
for (final String recap : recap) { for (final String r : recap) {
send(sender, recap, isPrivate); send(sender, r, isPrivate);
} }
} else { } else {
send(sender, "Sorry, nothing to recap.", true); send(sender, "Sorry, nothing to recap.", true);
@ -1574,7 +1568,7 @@ public class Mobibot extends PircBot {
final int max = entries.size(); final int max = entries.size();
int i = 0; int i = 0;
if (!(lcArgs.length() > 0) && (max > MAX_ENTRIES)) { if ((lcArgs.length() <= 0) && (max > MAX_ENTRIES)) {
i = max - MAX_ENTRIES; i = max - MAX_ENTRIES;
} }
@ -1598,7 +1592,7 @@ public class Mobibot extends PircBot {
i = 0; i = 0;
} }
} catch (NumberFormatException ignore) { } catch (NumberFormatException ignore) {
; // Do nothing // Do nothing.
} }
} }

View file

@ -67,13 +67,13 @@ public class Tell {
private static final String SER_EXT = ".ser"; private static final String SER_EXT = ".ser";
// The bot instance. // The bot instance.
final private Mobibot bot; private final Mobibot bot;
// The maximum number of days to keep messages. // The maximum number of days to keep messages.
final private int maxDays; private final int maxDays;
// The message maximum queue size. // The message maximum queue size.
final private int maxSize; private final int maxSize;
// The messages queue. // The messages queue.
private final List<TellMessage> messages = new CopyOnWriteArrayList<>(); private final List<TellMessage> messages = new CopyOnWriteArrayList<>();
@ -139,13 +139,14 @@ public class Tell {
* @param cmds The commands string. * @param cmds The commands string.
*/ */
public void response(final String sender, final String cmds) { public void response(final String sender, final String cmds) {
final String arrow = " --> ";
if (!Utils.isValidString(cmds)) { if (!Utils.isValidString(cmds)) {
helpResponse(sender); helpResponse(sender);
} else if (cmds.startsWith(Commands.VIEW_CMD)) { } else if (cmds.startsWith(Commands.VIEW_CMD)) {
if (bot.isOp(sender) && cmds.equals(Commands.VIEW_CMD + ' ' + TELL_ALL_KEYWORD)) { if (bot.isOp(sender) && cmds.equals(Commands.VIEW_CMD + ' ' + TELL_ALL_KEYWORD)) {
if (messages.size() > 0) { if (messages.isEmpty()) {
for (final TellMessage message : messages) { for (final TellMessage message : messages) {
bot.send(sender, Utils.bold(message.getSender()) + " --> " + Utils.bold(message.getRecipient()) bot.send(sender, Utils.bold(message.getSender()) + arrow + Utils.bold(message.getRecipient())
+ " [ID: " + message.getId() + ", " + " [ID: " + message.getId() + ", "
+ (message.isReceived() ? "DELIVERED" : "QUEUED") + ']', + (message.isReceived() ? "DELIVERED" : "QUEUED") + ']',
true); true);
@ -165,14 +166,14 @@ public class Tell {
if (message.isReceived()) { if (message.isReceived()) {
bot.send(sender, bot.send(sender,
Utils.bold(message.getSender()) + " --> " + Utils.bold(message.getRecipient()) Utils.bold(message.getSender()) + arrow + Utils.bold(message.getRecipient())
+ " [" + Utils.utcDateTime(message.getReceived()) + ", ID: " + " [" + Utils.utcDateTime(message.getReceived()) + ", ID: "
+ message.getId() + ", DELIVERED]", + message.getId() + ", DELIVERED]",
true); true);
} else { } else {
bot.send(sender, bot.send(sender,
Utils.bold(message.getSender()) + " --> " + Utils.bold(message.getRecipient()) Utils.bold(message.getSender()) + arrow + Utils.bold(message.getRecipient())
+ " [" + Utils.utcDateTime(message.getQueued()) + ", ID: " + " [" + Utils.utcDateTime(message.getQueued()) + ", ID: "
+ message.getId() + ", QUEUED]", + message.getId() + ", QUEUED]",
true); true);

View file

@ -47,7 +47,7 @@ public class TellMessage implements Serializable {
private static final long serialVersionUID = 2L; private static final long serialVersionUID = 2L;
private final String id; private final String id;
private final String message; private final String message;
final private LocalDateTime queued; private final LocalDateTime queued;
private final String recipient; private final String recipient;
private final String sender; private final String sender;
private boolean isNotified; private boolean isNotified;
@ -176,4 +176,4 @@ public class TellMessage implements Serializable {
received = LocalDateTime.now(Clock.systemUTC()); received = LocalDateTime.now(Clock.systemUTC());
isReceived = true; isReceived = true;
} }
} }

View file

@ -52,8 +52,7 @@ final class TellMessagesMgr {
* *
* @throws UnsupportedOperationException If the constructor is called. * @throws UnsupportedOperationException If the constructor is called.
*/ */
private TellMessagesMgr() private TellMessagesMgr() {
throws UnsupportedOperationException {
throw new UnsupportedOperationException("Illegal constructor call."); throw new UnsupportedOperationException("Illegal constructor call.");
} }
@ -98,7 +97,7 @@ final class TellMessagesMgr {
return ((List<TellMessage>) input.readObject()); return ((List<TellMessage>) input.readObject());
} }
} catch (FileNotFoundException ignore) { } catch (FileNotFoundException ignore) {
; // Do nothing. // Do nothing.
} catch (IOException e) { } catch (IOException e) {
logger.error("An IO error occurred loading the messages queue.", e); logger.error("An IO error occurred loading the messages queue.", e);
} catch (Exception e) { } catch (Exception e) {

View file

@ -46,14 +46,13 @@ import java.util.Date;
* @created 2014-04-26 * @created 2014-04-26
* @since 1.0 * @since 1.0
*/ */
final public class Utils { public final class Utils {
/** /**
* Disables the default constructor. * Disables the default constructor.
* *
* @throws UnsupportedOperationException If the constructor is called. * @throws UnsupportedOperationException If the constructor is called.
*/ */
private Utils() private Utils() {
throws UnsupportedOperationException {
throw new UnsupportedOperationException("Illegal constructor call."); throw new UnsupportedOperationException("Illegal constructor call.");
} }

View file

@ -90,4 +90,4 @@ public class Calc extends AbstractModule {
bot.send(sender, "To solve a mathematical calculation:"); bot.send(sender, "To solve a mathematical calculation:");
bot.send(sender, bot.helpIndent(bot.getNick() + ": " + CALC_CMD + " <calculation>")); bot.send(sender, bot.helpIndent(bot.getNick() + ": " + CALC_CMD + " <calculation>"));
} }
} }

View file

@ -55,7 +55,7 @@ import java.util.TreeMap;
* @created Feb 11, 2004 * @created Feb 11, 2004
* @since 1.0 * @since 1.0
*/ */
final public class CurrencyConverter extends AbstractModule { public final class CurrencyConverter extends AbstractModule {
/** /**
* The currency command. * The currency command.
*/ */
@ -73,7 +73,7 @@ final public class CurrencyConverter extends AbstractModule {
private static final String EXCHANGE_TABLE_URL = "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml"; private static final String EXCHANGE_TABLE_URL = "http://www.ecb.int/stats/eurofxref/eurofxref-daily.xml";
// The last exchange rates table publication date. // The last exchange rates table publication date.
private static String pubDate = ""; private String pubDate = "";
/** /**
* Creates a new {@link CurrencyConverter} instance. * Creates a new {@link CurrencyConverter} instance.

View file

@ -43,7 +43,7 @@ import java.security.SecureRandom;
* @created 2014-04-28 * @created 2014-04-28
* @since 1.0 * @since 1.0
*/ */
final public class Dice extends AbstractModule { public final class Dice extends AbstractModule {
/** /**
* The dice command. * The dice command.
*/ */

View file

@ -51,7 +51,7 @@ import java.nio.charset.StandardCharsets;
* @created Feb 7, 2004 * @created Feb 7, 2004
* @since 1.0 * @since 1.0
*/ */
final public class GoogleSearch extends AbstractModule { public final class GoogleSearch extends AbstractModule {
/** /**
* The google command. * The google command.
*/ */

View file

@ -48,7 +48,7 @@ import java.nio.charset.StandardCharsets;
* @created 2014-04-20 * @created 2014-04-20
* @since 1.0 * @since 1.0
*/ */
final public class Joke extends AbstractModule { public final class Joke extends AbstractModule {
/** /**
* The joke command. * The joke command.
*/ */

View file

@ -45,7 +45,7 @@ import java.net.UnknownHostException;
* @created 2014-04-26 * @created 2014-04-26
* @since 1.0 * @since 1.0
*/ */
final public class Lookup extends AbstractModule { public final class Lookup extends AbstractModule {
/** /**
* The lookup command. * The lookup command.
*/ */

View file

@ -46,7 +46,7 @@ import java.io.IOException;
* @created Feb 7, 2004 * @created Feb 7, 2004
* @since 1.0 * @since 1.0
*/ */
final public class StockQuote extends AbstractModule { public final class StockQuote extends AbstractModule {
/** /**
* The quote command. * The quote command.
*/ */

View file

@ -43,17 +43,17 @@ import twitter4j.conf.ConfigurationBuilder;
* @created Sept 10, 2008 * @created Sept 10, 2008
* @since 1.0 * @since 1.0
*/ */
final public class Twitter extends AbstractModule { public final class Twitter extends AbstractModule {
/** /**
* The twitter command. * The twitter command.
*/ */
public final static String TWITTER_CMD = "twitter"; public static final String TWITTER_CMD = "twitter";
// The property keys. // The property keys.
private final static String CONSUMER_KEY_PROP = "twitter-consumerKey"; private static final String CONSUMER_KEY_PROP = "twitter-consumerKey";
private final static String CONSUMER_SECRET_PROP = "twitter-consumerSecret"; private static final String CONSUMER_SECRET_PROP = "twitter-consumerSecret";
private final static String TOKEN_PROP = "twitter-token"; private static final String TOKEN_PROP = "twitter-token";
private final static String TOKEN_SECRET_PROP = "twitter-tokenSecret"; private static final String TOKEN_SECRET_PROP = "twitter-tokenSecret";
/** /**
* Creates a new {@link Twitter} instance. * Creates a new {@link Twitter} instance.

View file

@ -43,7 +43,7 @@ import java.security.SecureRandom;
* @created 2014-04-28 * @created 2014-04-28
* @since 1.0 * @since 1.0
*/ */
final public class War extends AbstractModule { public final class War extends AbstractModule {
/** /**
* The war command * The war command
*/ */
@ -95,7 +95,7 @@ final public class War extends AbstractModule {
if (i < y) { if (i < y) {
bot.action("lost."); bot.action("lost.");
} else if (i > y) { } else {
bot.action("wins."); bot.action("wins.");
} }
} }

View file

@ -47,7 +47,7 @@ import java.util.TreeMap;
* @created 2014-04-27 * @created 2014-04-27
* @since 1.0 * @since 1.0
*/ */
final public class WorldTime extends AbstractModule { public final class WorldTime extends AbstractModule {
/** /**
* The time command. * The time command.
*/ */