Removed imports

Fixed vulnerability issue with Pair

Fixed database connection issue with MySQLDatabaseHandler
This commit is contained in:
Tastybento 2018-02-10 13:51:11 -08:00
parent 65d34f5842
commit 84e3ae3e8b
5 changed files with 125 additions and 127 deletions

View File

@ -1,7 +1,5 @@
package us.tastybento.bskyblock.api.placeholders.hooks; package us.tastybento.bskyblock.api.placeholders.hooks;
import java.util.regex.Pattern;
import us.tastybento.bskyblock.BSkyBlock; import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.commands.User; import us.tastybento.bskyblock.api.commands.User;
import us.tastybento.bskyblock.api.placeholders.Placeholder; import us.tastybento.bskyblock.api.placeholders.Placeholder;

View File

@ -378,8 +378,6 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
InstantiationException, IllegalAccessException, InstantiationException, IllegalAccessException,
IntrospectionException, InvocationTargetException, NoSuchMethodException { IntrospectionException, InvocationTargetException, NoSuchMethodException {
// Try to connect to the database
try (Connection connection = databaseConnecter.createConnection()) {
// insertQuery is created in super from the createInsertQuery() method // insertQuery is created in super from the createInsertQuery() method
try (PreparedStatement preparedStatement = connection.prepareStatement(insertQuery)) { try (PreparedStatement preparedStatement = connection.prepareStatement(insertQuery)) {
// Get the uniqueId. As each class extends DataObject, it must have this method in it. // Get the uniqueId. As each class extends DataObject, it must have this method in it.
@ -496,7 +494,6 @@ public class MySQLDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
preparedStatement.executeBatch(); preparedStatement.executeBatch();
} }
} }
}
/** /**
* Serializes values if required to go into a database. * Serializes values if required to go into a database.

View File

@ -1,14 +1,15 @@
package us.tastybento.bskyblock.lists; package us.tastybento.bskyblock.lists;
import org.bukkit.Bukkit;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.placeholders.Placeholder;
import us.tastybento.bskyblock.api.placeholders.PlaceholderBuilder;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.bukkit.Bukkit;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.placeholders.Placeholder;
import us.tastybento.bskyblock.api.placeholders.PlaceholderBuilder;
public class Placeholders { public class Placeholders {
public static final Placeholder PLUGIN_NAME = new PlaceholderBuilder().identifier("bsb_plugin_name").value((user) -> BSkyBlock.getInstance().getDescription().getName()).build(); public static final Placeholder PLUGIN_NAME = new PlaceholderBuilder().identifier("bsb_plugin_name").value((user) -> BSkyBlock.getInstance().getDescription().getName()).build();

View File

@ -2,8 +2,8 @@ package us.tastybento.bskyblock.util;
public class Pair<X, Z> { public class Pair<X, Z> {
public X x; public final X x;
public Z z; public final Z z;
public Pair(X x, Z z) { public Pair(X x, Z z) {
this.x = x; this.x = x;

View File

@ -3,17 +3,19 @@
*/ */
package us.tastybento.bskyblock.database.mysql; package us.tastybento.bskyblock.database.mysql;
import static org.junit.Assert.*; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.sql.Statement;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Statement;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;