Code cleanup.

This commit is contained in:
Erik C. Thauvin 2019-05-27 00:08:05 -07:00
parent 43e31ddf63
commit 19898d2c1c
6 changed files with 10 additions and 9 deletions

View file

@ -4,6 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>Erik's Ruleset</description> <description>Erik's Ruleset</description>
<!-- BEST PRACTICES -->
<rule ref="category/java/bestpractices.xml/AvoidStringBufferField"/> <rule ref="category/java/bestpractices.xml/AvoidStringBufferField"/>
<rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/> <rule ref="category/java/bestpractices.xml/AvoidUsingHardCodedIP"/>
<rule ref="category/java/bestpractices.xml/CheckResultSet"/> <rule ref="category/java/bestpractices.xml/CheckResultSet"/>
@ -103,7 +104,7 @@
<rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody"/> <rule ref="category/java/documentation.xml/UncommentedEmptyMethodBody"/>
<!-- ERRORPRONE --> <!-- ERROR PRONE -->
<rule ref="category/java/errorprone.xml/AssignmentInOperand"> <rule ref="category/java/errorprone.xml/AssignmentInOperand">
<properties> <properties>
<property name="allowWhile" value="true"/> <property name="allowWhile" value="true"/>

View file

@ -99,7 +99,7 @@ import java.util.StringTokenizer;
* @since 1.0 * @since 1.0
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Version(properties = "version.properties", template = "mobibot.mustache", className = "ReleaseInfo") @Version(properties = "version.properties", className = "ReleaseInfo")
public class Mobibot extends PircBot { public class Mobibot extends PircBot {
// The default port. // The default port.
@ -1653,10 +1653,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 viewResponse(final String sender, final String args, final boolean isPrivate) { private void viewResponse(final String sender, final String args, final boolean isPrivate) {
String lcArgs = args.toLowerCase(Constants.LOCALE);
if (!entries.isEmpty()) { if (!entries.isEmpty()) {
final int max = entries.size(); final int max = entries.size();
String lcArgs = args.toLowerCase(Constants.LOCALE);
int i = 0; int i = 0;
if ((lcArgs.length() <= 0) && (max > MAX_ENTRIES)) { if ((lcArgs.length() <= 0) && (max > MAX_ENTRIES)) {

View file

@ -54,6 +54,7 @@ import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collection;
import java.util.List; import java.util.List;
/** /**
@ -99,7 +100,7 @@ public final class EntriesMgr {
* @throws IOException If the file was not found or could not be read. * @throws IOException If the file was not found or could not be read.
* @throws FeedException If an error occurred while reading the feed. * @throws FeedException If an error occurred while reading the feed.
*/ */
public static void loadBacklogs(final String file, final List<String> history) public static void loadBacklogs(final String file, final Collection<String> history)
throws IOException, FeedException { throws IOException, FeedException {
history.clear(); history.clear();
@ -131,7 +132,7 @@ public final class EntriesMgr {
* @throws FeedException If an error occurred while reading the feed. * @throws FeedException If an error occurred while reading the feed.
*/ */
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
public static String loadEntries(final String file, final String channel, final List<EntryLink> entries) public static String loadEntries(final String file, final String channel, final Collection<EntryLink> entries)
throws IOException, FeedException { throws IOException, FeedException {
entries.clear(); entries.clear();

View file

@ -44,7 +44,7 @@ import java.time.LocalDateTime;
*/ */
public class EntryComment implements Serializable { public class EntryComment implements Serializable {
// The serial version UID. // The serial version UID.
static final long serialVersionUID = 6957415292233553224L; static final long serialVersionUID = 1L;
// The creation date. // The creation date.
private final LocalDateTime date = LocalDateTime.now(); private final LocalDateTime date = LocalDateTime.now();

View file

@ -52,7 +52,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/ */
public class EntryLink implements Serializable { public class EntryLink implements Serializable {
// The serial version UID. // The serial version UID.
static final long serialVersionUID = 3676245542270899086L; static final long serialVersionUID = 1L;
// The link's comments // The link's comments
private final List<EntryComment> comments = new CopyOnWriteArrayList<>(); private final List<EntryComment> comments = new CopyOnWriteArrayList<>();

View file

@ -45,7 +45,7 @@ import java.util.regex.Pattern;
* @since 1.0 * @since 1.0
*/ */
public class ModuleException extends Exception { public class ModuleException extends Exception {
private static final long serialVersionUID = -3036774290621088107L; private static final long serialVersionUID = 1L;
private final String debugMessage; private final String debugMessage;
private final Pattern urlPattern = Pattern.compile("(https?://\\S+)(\\?\\S+)"); private final Pattern urlPattern = Pattern.compile("(https?://\\S+)(\\?\\S+)");