Cleanup - Redundant String.format

This commit is contained in:
Jetz
2024-08-10 12:21:50 -04:00
parent daa9d59a67
commit 9bbe4805a3
11 changed files with 18 additions and 18 deletions

View File

@@ -218,7 +218,7 @@ public final class CardDb implements ICardDatabase, IDeckGenPool {
CardRequest request = fromPreferredArtEntry(preferredArt, isFoil); CardRequest request = fromPreferredArtEntry(preferredArt, isFoil);
if (request != null) // otherwise, simply discard it and go on. if (request != null) // otherwise, simply discard it and go on.
return request; return request;
System.err.println(String.format("[LOG]: Faulty Entry in Preferred Art for Card %s - Please check!", cardName)); System.err.printf("[LOG]: Faulty Entry in Preferred Art for Card %s - Please check!%n", cardName);
} }
} }
// finally, check whether any between artIndex and CollectorNumber has been set // finally, check whether any between artIndex and CollectorNumber has been set

View File

@@ -234,7 +234,7 @@ public enum FControl implements KeyEventDispatcher {
FModel.getQuest().load(QuestDataIO.loadData(data)); FModel.getQuest().load(QuestDataIO.loadData(data));
} catch(IOException ex) { } catch(IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
System.out.println(String.format("Error loading quest data (%s).. skipping for now..", questname)); System.err.printf("Error loading quest data (%s).. skipping for now..%n", questname);
} }
} }

View File

@@ -60,11 +60,11 @@ public enum CSubmenuQuestLoadData implements ICDoc {
arrQuests.clear(); arrQuests.clear();
for (final File f : arrFiles) { for (final File f : arrFiles) {
try { try {
System.out.println(String.format("About to load quest (%s)... ", f.getName())); System.out.printf("About to load quest (%s)... %n", f.getName());
arrQuests.put(f.getName(), QuestDataIO.loadData(f)); arrQuests.put(f.getName(), QuestDataIO.loadData(f));
} catch(IOException ex) { } catch(IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
System.out.println(String.format("Error loading quest data (%s).. skipping for now..", f.getName())); System.err.printf("Error loading quest data (%s).. skipping for now..%n", f.getName());
restorableQuests.add(f.getName()); restorableQuests.add(f.getName());
} }
} }

View File

@@ -1371,7 +1371,7 @@ public class Graphics {
Dtransforms.removeFirst(); Dtransforms.removeFirst();
transformCount--; transformCount--;
if (transformCount != Dtransforms.size()) { if (transformCount != Dtransforms.size()) {
System.err.println(String.format("Stack count: %d, transformCount: %d", Dtransforms.size(), transformCount)); System.err.printf("Stack count: %d, transformCount: %d%n", Dtransforms.size(), transformCount);
transformCount = 0; transformCount = 0;
Dtransforms.clear(); Dtransforms.clear();
} }

View File

@@ -85,7 +85,7 @@ public class LoadQuestScreen extends LaunchScreen {
try { try {
arrQuests.put(f.getName(), QuestDataIO.loadData(f)); arrQuests.put(f.getName(), QuestDataIO.loadData(f));
} catch (IOException e) { } catch (IOException e) {
System.err.println(String.format("Failed to load quest '%s'", f.getName())); System.err.printf("Failed to load quest '%s'%n", f.getName());
// Failed to load last quest, don't continue with quest loading stuff // Failed to load last quest, don't continue with quest loading stuff
return; return;
} }

View File

@@ -127,7 +127,7 @@ public class QuestMenu extends FPopupMenu implements IVQuestStats {
try { try {
FModel.getQuest().load(QuestDataIO.loadData(data)); FModel.getQuest().load(QuestDataIO.loadData(data));
} catch (IOException e) { } catch (IOException e) {
System.err.println(String.format("Failed to load quest '%s'", questname)); System.err.printf("Failed to load quest '%s'%n", questname);
// Failed to load last quest, don't continue with quest loading stuff // Failed to load last quest, don't continue with quest loading stuff
return; return;
} }

View File

@@ -44,7 +44,7 @@ public class InputSelectEntitiesFromList<T extends GameEntity> extends InputSele
super(controller, Math.min(min, validChoices0.size()), Math.min(max, validChoices0.size()), sa0, tallyType0, tally0); super(controller, Math.min(min, validChoices0.size()), Math.min(max, validChoices0.size()), sa0, tallyType0, tally0);
validChoices = validChoices0; validChoices = validChoices0;
if (min > validChoices.size()) { // pfps does this really do anything useful?? if (min > validChoices.size()) { // pfps does this really do anything useful??
System.out.println(String.format("Trying to choose at least %d things from a list with only %d things!", min, validChoices.size())); System.out.printf("Trying to choose at least %d things from a list with only %d things!%n", min, validChoices.size());
} }
ArrayList<CardView> vCards = new ArrayList<>(); ArrayList<CardView> vCards = new ArrayList<>();
for (T c : validChoices0) { for (T c : validChoices0) {

View File

@@ -37,7 +37,7 @@ public class CompatibleObjectDecoder extends LengthFieldBasedFrameDecoder {
try { try {
var5 = ois.readObject(); var5 = ois.readObject();
} catch (StreamCorruptedException e) { } catch (StreamCorruptedException e) {
System.err.println(String.format("Version Mismatch: %s", e.getMessage())); System.err.printf("Version Mismatch: %s%n", e.getMessage());
} finally { } finally {
ois.close(); ois.close();
} }

View File

@@ -41,7 +41,7 @@ public abstract class GameProtocolHandler<T> extends ChannelInboundHandlerAdapte
if (method == null) { if (method == null) {
//throw new IllegalStateException(String.format("Method %s not found", protocolMethod.name())); //throw new IllegalStateException(String.format("Method %s not found", protocolMethod.name()));
catchedError[0] += String.format("IllegalStateException: Method %s not found (GameProtocolHandler.java Line 43)\n", protocolMethod.name()); catchedError[0] += String.format("IllegalStateException: Method %s not found (GameProtocolHandler.java Line 43)\n", protocolMethod.name());
System.err.println(String.format("Method %s not found", protocolMethod.name())); System.err.printf("Method %s not found%n", protocolMethod.name());
} }
final Object[] args = event.getObjects(); final Object[] args = event.getObjects();
@@ -58,7 +58,7 @@ public abstract class GameProtocolHandler<T> extends ChannelInboundHandlerAdapte
try { try {
method.invoke(toInvoke, args); method.invoke(toInvoke, args);
} catch (final IllegalAccessException | IllegalArgumentException e) { } catch (final IllegalAccessException | IllegalArgumentException e) {
System.err.println(String.format("Unknown protocol method %s with %d args", methodName, args == null ? 0 : args.length)); System.err.printf("Unknown protocol method %s with %d args%n", methodName, args == null ? 0 : args.length);
} catch (final InvocationTargetException e) { } catch (final InvocationTargetException e) {
//throw new RuntimeException(e.getTargetException()); //throw new RuntimeException(e.getTargetException());
catchedError[0] += (String.format("RuntimeException: %s (GameProtocolHandler.java Line 65)\n", e.getTargetException().toString())); catchedError[0] += (String.format("RuntimeException: %s (GameProtocolHandler.java Line 65)\n", e.getTargetException().toString()));
@@ -72,10 +72,10 @@ public abstract class GameProtocolHandler<T> extends ChannelInboundHandlerAdapte
protocolMethod.checkReturnValue(theReply); protocolMethod.checkReturnValue(theReply);
reply = (Serializable) theReply; reply = (Serializable) theReply;
} else if (theReply != null) { } else if (theReply != null) {
System.err.println(String.format("Non-serializable return type %s for method %s, returning null", returnType.getName(), methodName)); System.err.printf("Non-serializable return type %s for method %s, returning null%n", returnType.getName(), methodName);
} }
} catch (final IllegalAccessException | IllegalArgumentException e) { } catch (final IllegalAccessException | IllegalArgumentException e) {
System.err.println(String.format("Unknown protocol method %s with %d args, replying with null", methodName, args == null ? 0 : args.length)); System.err.printf("Unknown protocol method %s with %d args, replying with null%n", methodName, args == null ? 0 : args.length);
} catch (final NullPointerException | InvocationTargetException e) { } catch (final NullPointerException | InvocationTargetException e) {
//throw new RuntimeException(e.getTargetException()); //throw new RuntimeException(e.getTargetException());
catchedError[0] += e.toString(); catchedError[0] += e.toString();

View File

@@ -138,7 +138,7 @@ public enum ProtocolMethod {
} }
return candidate; return candidate;
} catch (final NoSuchMethodException | SecurityException e) { } catch (final NoSuchMethodException | SecurityException e) {
System.err.println(String.format("Warning: class contains no accessible method named %s", name())); System.err.printf("Warning: class contains no accessible method named %s%n", name());
return getMethodNoArgs(); return getMethodNoArgs();
} }
} }
@@ -147,7 +147,7 @@ public enum ProtocolMethod {
try { try {
return mode.toInvoke.getMethod(name(), (Class<?>[]) null); return mode.toInvoke.getMethod(name(), (Class<?>[]) null);
} catch (final NoSuchMethodException | SecurityException e) { } catch (final NoSuchMethodException | SecurityException e) {
System.err.println(String.format("Warning: class contains no accessible arg-less method named %s", name())); System.err.printf("Warning: class contains no accessible arg-less method named %s%n", name());
return null; return null;
} }
} }
@@ -168,7 +168,7 @@ public enum ProtocolMethod {
final Class<?> type = this.args[iArg]; final Class<?> type = this.args[iArg];
if (!ReflectionUtil.isInstance(arg, type)) { if (!ReflectionUtil.isInstance(arg, type)) {
//throw new InternalError(String.format("Protocol method %s: illegal argument (%d) of type %s, %s expected", name(), iArg, arg.getClass().getName(), type.getName())); //throw new InternalError(String.format("Protocol method %s: illegal argument (%d) of type %s, %s expected", name(), iArg, arg.getClass().getName(), type.getName()));
System.err.println(String.format("InternalError: Protocol method %s: illegal argument (%d) of type %s, %s expected (ProtocolMethod.java)", name(), iArg, arg.getClass().getName(), type.getName())); System.err.printf("InternalError: Protocol method %s: illegal argument (%d) of type %s, %s expected (ProtocolMethod.java)%n", name(), iArg, arg.getClass().getName(), type.getName());
} }
} }
} catch (Exception e) { } catch (Exception e) {
@@ -183,7 +183,7 @@ public enum ProtocolMethod {
} }
if (!ReflectionUtil.isInstance(value, returnType)) { if (!ReflectionUtil.isInstance(value, returnType)) {
//throw new IllegalStateException(String.format("Protocol method %s: illegal return object type %s returned by client, expected %s", name(), value.getClass().getName(), getReturnType().getName())); //throw new IllegalStateException(String.format("Protocol method %s: illegal return object type %s returned by client, expected %s", name(), value.getClass().getName(), getReturnType().getName()));
System.err.println(String.format("IllegalStateException: Protocol method %s: illegal return object type %s returned by client, expected %s (ProtocolMethod.java)", name(), value.getClass().getName(), getReturnType().getName())); System.err.printf("IllegalStateException: Protocol method %s: illegal return object type %s returned by client, expected %s (ProtocolMethod.java)%n", name(), value.getClass().getName(), getReturnType().getName());
} }
} }
} }

View File

@@ -338,7 +338,7 @@ public abstract class GuiDownloadService implements Runnable {
} }
catch (final FileNotFoundException fnfe) { catch (final FileNotFoundException fnfe) {
String formatStr = " Error - the LQ picture %s could not be found on the server. [%s] - %s"; String formatStr = " Error - the LQ picture %s could not be found on the server. [%s] - %s";
System.out.println(String.format(formatStr, fileDest.getName(), url, fnfe.getMessage())); System.out.printf((formatStr) + "%n", fileDest.getName(), url, fnfe.getMessage());
} }
catch (final Exception ex) { catch (final Exception ex) {
Log.error("LQ Pictures", "Error downloading pictures", ex); Log.error("LQ Pictures", "Error downloading pictures", ex);