From b2417ac86baa697d84d8d770b9ce41b24d90cb1a Mon Sep 17 00:00:00 2001 From: Alyssa Date: Wed, 30 Oct 2024 23:05:40 +0000 Subject: [PATCH] burn some unused code --- .../main/java/online/util/AccountUtil.java | 70 ----------------- core/src/main/java/util/EncryptionUtil.java | 3 - core/src/main/java/util/StringUtil.java | 75 ------------------- core/src/main/java/util/XmlUtil.java | 42 ++--------- .../main/java/util/PasswordServerUtil.java | 31 -------- 5 files changed, 8 insertions(+), 213 deletions(-) delete mode 100644 client/src/main/java/online/util/AccountUtil.java delete mode 100644 server/src/main/java/util/PasswordServerUtil.java diff --git a/client/src/main/java/online/util/AccountUtil.java b/client/src/main/java/online/util/AccountUtil.java deleted file mode 100644 index 3442c96..0000000 --- a/client/src/main/java/online/util/AccountUtil.java +++ /dev/null @@ -1,70 +0,0 @@ -package online.util; - -import util.DialogUtil; -import util.EncryptionUtil; - -public class AccountUtil -{ - public static boolean validateEmail(String email) - { - int atIndex = email.indexOf('@'); - if (atIndex < 0) - { - DialogUtil.showError("The email address you have entered is not valid."); - return false; - } - - int dotIndex = email.indexOf('.', atIndex); - if (dotIndex < 0 || dotIndex == atIndex+1) - { - DialogUtil.showError("The email address you have entered is not valid."); - return false; - } - -// try -// { -// InternetAddress.parse(email, true); -// } -// catch (Throwable t) -// { -// Debug.stackTraceSilently(t); -// DialogUtil.showError("The email address you have entered is not valid."); -// return false; -// } - - return true; - } - - public static boolean passwordsMatch(char[] passwordOne, char[] passwordTwo) - { - int lengthOne = passwordOne.length; - int lengthTwo = passwordTwo.length; - - if (lengthOne != lengthTwo) - { - return false; - } - - for (int i=0; i getListFromDelims(String delimitedStr, String delimChar) { ArrayList list = new ArrayList<>(); @@ -66,22 +58,6 @@ public static String toDelims(ArrayList list, String delimChar return sb.toString(); } - - public static String toSqlInStatement(ArrayList list, boolean in) - { - StringBuilder sb = new StringBuilder(); - if (!in) - { - sb.append("NOT "); - } - sb.append("IN ("); - - String delimList = "'" + toDelims(list, "','") + "'"; - sb.append(delimList); - sb.append(")"); - - return sb.toString(); - } public static String escapeHtml(String plainText) { @@ -107,55 +83,4 @@ public static String escapeHtml(String plainText) return sb.toString(); } - - public static String convertOrdinalToText(int position) - { - if (position == -1) - { - return ""; - } - - String[] suffixes = new String[] { "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th" }; - - int remainder = position % 100; - if (remainder == 11 - || remainder == 12 - || remainder == 13) - { - //Special cases - return position + "th"; - } - else - { - return position + suffixes[position%10]; - } - } - - public static String reverse(String str) - { - int length = str.length(); - StringBuilder sb = new StringBuilder(length); - - for (int i=length-1; i>=0; i--) - { - char c = str.charAt(i); - sb.append(c); - } - - return sb.toString(); - } - - public static boolean containsNumeric(String s) - { - for (int i=0; i getListFromElement(Element root, String elementName, String attributePrefix) - { - ArrayList ret = new ArrayList<>(); - - NodeList elements = root.getElementsByTagName(elementName); - if (elements.getLength() == 0) - { - Debug.append("No such element: " + elementName); - return ret; - } - - Element element = (Element)elements.item(0); - int i = 0; - String card = element.getAttribute(attributePrefix + "-" + i); - while (!card.isEmpty()) - { - ret.add(card); - i++; - card = element.getAttribute(attributePrefix + "-" + i); - } - - return ret; - } - public static Element getElementIfExists(Element rootElement, String elementName) { NodeList children = rootElement.getElementsByTagName(elementName); diff --git a/server/src/main/java/util/PasswordServerUtil.java b/server/src/main/java/util/PasswordServerUtil.java deleted file mode 100644 index e13507b..0000000 --- a/server/src/main/java/util/PasswordServerUtil.java +++ /dev/null @@ -1,31 +0,0 @@ -package util; - -import java.security.SecureRandom; - -public class PasswordServerUtil -{ - private static String passwordCharacters = "abcdefghijklmnopqrstuvwxyz0123456789$%!\"&*()#@[]?"; - - public static String generateRandomPassword() - { - SecureRandom random = new SecureRandom(); - int length = passwordCharacters.length(); - - String s = ""; - for (int i=0; i