removed NumberFormatException, IllegalArgumentException,UnsupportedOperationException, NullPointerException throws from method signatures

This commit is contained in:
Rsl1122 2017-08-16 10:53:38 +03:00
parent bf21aae791
commit 0c210f4877
10 changed files with 32 additions and 12 deletions

View File

@ -70,7 +70,7 @@ public class RegisterCommand extends SubCommand {
return true;
}
private void consoleRegister(String[] args, ISender sender, String notEnoughArgsMsg) throws NumberFormatException, PassEncryptUtil.CannotPerformOperationException {
private void consoleRegister(String[] args, ISender sender, String notEnoughArgsMsg) throws PassEncryptUtil.CannotPerformOperationException {
if (Check.isTrue(args.length >= 3, notEnoughArgsMsg, sender)) {
int permLevel;
permLevel = Integer.parseInt(args[2]);

View File

@ -200,10 +200,11 @@ public abstract class PluginData {
* @param uuid UUID of the player the value belongs to.
* @return Long, Integer, Double, Boolean or String, return -1 if the player
* has no value.
* @throws UnsupportedOperationException if implementing class has not overridden the method.
*/
public abstract Serializable getValue(UUID uuid);
public Map<UUID, Serializable> getValues(Collection<UUID> uuids) throws UnsupportedOperationException {
public Map<UUID, Serializable> getValues(Collection<UUID> uuids) {
throw new UnsupportedOperationException("Not overridden.");
}

View File

@ -83,7 +83,13 @@ public class GamemodePart extends RawData {
}
}
public void addTo(String gm, long amount) throws IllegalArgumentException {
/**
* Adds time to a gamemode.
* @param gm Name of Gamemode
* @param amount milliseconds to add
* @throws IllegalArgumentException if gm is null
*/
public void addTo(String gm, long amount) {
Verify.nullCheck(gm);
switch (gm) {
case "SURVIVAL":

View File

@ -48,7 +48,14 @@ public class KillPart extends RawData {
addValue("avgplayerkills", MathUtils.averageLong(playerKillAmount, playerCount));
}
public void addKills(UUID uuid, List<KillData> kills) throws IllegalArgumentException {
/**
* Adds kills to the dataset.
*
* @param uuid Player whose kills are being added
* @param kills all kills of a player
* @throws IllegalArgumentException if kills is null
*/
public void addKills(UUID uuid, List<KillData> kills) {
Verify.nullCheck(kills);
playerKills.put(uuid, kills);
}

View File

@ -45,7 +45,7 @@ public class GMTimes extends TimeKeeper {
* @param times 1-4 time parameters.
* @throws IllegalArgumentException If any parameter is null.
*/
public void setAllGMTimes(long... times) throws IllegalArgumentException {
public void setAllGMTimes(long... times) {
Verify.nullCheck(times);
String[] gms = GMTimesTable.getGMKeyArray();
int size = times.length;

View File

@ -44,7 +44,13 @@ public abstract class TimeKeeper {
this(new HashMap<>());
}
public void setTime(String state, long time) throws IllegalArgumentException {
/**
* Sets a specific time for a state.
* @param state State to set
* @param time Time in ms the state has been active for
* @throws IllegalArgumentException If given state is null
*/
public void setTime(String state, long time) {
times.put(Verify.nullCheck(state), time);
}

View File

@ -255,7 +255,7 @@ public abstract class Database {
* @throws SQLException If a database error occurs.
* @throws NullPointerException If the database has not initialized tables.
*/
public void saveCommandUse(Map<String, Integer> data) throws SQLException, NullPointerException {
public void saveCommandUse(Map<String, Integer> data) throws SQLException {
commandUseTable.saveCommandUse(data);
}

View File

@ -1,5 +1,6 @@
package main.java.com.djrapitops.plan.database.tables;
import com.djrapitops.plugin.utilities.Verify;
import main.java.com.djrapitops.plan.Log;
import main.java.com.djrapitops.plan.database.databases.SQLDB;
import main.java.com.djrapitops.plan.utilities.Benchmark;
@ -77,10 +78,9 @@ public class CommandUseTable extends Table {
/**
* @param data
* @throws SQLException
* @throws NullPointerException
*/
public void saveCommandUse(Map<String, Integer> data) throws SQLException, NullPointerException {
if (data.isEmpty()) {
public void saveCommandUse(Map<String, Integer> data) throws SQLException {
if (Verify.isEmpty(data)) {
return;
}

View File

@ -150,7 +150,7 @@ public class FormatUtils {
* @return parsed double - for example 1,11
* @throws NumberFormatException When wrong format
*/
public static int parseVersionNumber(String versionString) throws NumberFormatException {
public static int parseVersionNumber(String versionString) {
return FormattingUtils.parseVersionNumber(versionString);
}

View File

@ -158,7 +158,7 @@ public class PassEncryptUtil {
}
}
private static byte[] fromBase64(String hex) throws IllegalArgumentException {
private static byte[] fromBase64(String hex) {
return DatatypeConverter.parseBase64Binary(hex);
}