forked from MagicBane/Server
Removed unused code.
This commit is contained in:
@@ -17,13 +17,6 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
public class MiscUtils {
|
public class MiscUtils {
|
||||||
|
|
||||||
// no need to recompile these each call, put them in object scope and
|
|
||||||
// compile just once.
|
|
||||||
private static final Pattern lastNameRegex = Pattern
|
|
||||||
.compile("^[A-Za-z][-'A-Za-z\\x20]*$");
|
|
||||||
private static final Pattern firstNameRegex = Pattern
|
|
||||||
.compile("^[A-Za-z]+$");
|
|
||||||
|
|
||||||
public static boolean checkIfFirstNameInvalid(String firstName) {
|
public static boolean checkIfFirstNameInvalid(String firstName) {
|
||||||
if ((firstName == null) || (firstName.length() == 0)
|
if ((firstName == null) || (firstName.length() == 0)
|
||||||
|| (firstName.length() > MBServerStatics.MAX_NAME_LENGTH)
|
|| (firstName.length() > MBServerStatics.MAX_NAME_LENGTH)
|
||||||
@@ -44,52 +37,4 @@ public class MiscUtils {
|
|||||||
// empty last names are fine, return false
|
// empty last names are fine, return false
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getCallingMethodName() {
|
|
||||||
StackTraceElement e[] = Thread.currentThread().getStackTrace();
|
|
||||||
int numElements = e.length;
|
|
||||||
|
|
||||||
if (numElements < 1) {
|
|
||||||
return "NoStack";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (numElements == 1) {
|
|
||||||
return e[0].getMethodName();
|
|
||||||
} else if (numElements == 2) {
|
|
||||||
return e[1].getMethodName();
|
|
||||||
} else if (numElements == 3) {
|
|
||||||
return e[2].getMethodName();
|
|
||||||
} else {
|
|
||||||
return e[3].getMethodName();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getCallStackAsString() {
|
|
||||||
String out = "";
|
|
||||||
|
|
||||||
StackTraceElement e[] = Thread.currentThread().getStackTrace();
|
|
||||||
int numElements = e.length;
|
|
||||||
|
|
||||||
for (int i = (numElements - 1); i > 1; --i) {
|
|
||||||
|
|
||||||
String[] classStack = e[i].getClassName().split("\\.");
|
|
||||||
String methName = e[i].getMethodName();
|
|
||||||
|
|
||||||
String className = classStack[classStack.length - 1];
|
|
||||||
|
|
||||||
if (methName.equals("<init>")) {
|
|
||||||
methName = className;
|
|
||||||
}
|
|
||||||
|
|
||||||
out += className + '.' + methName + "()";
|
|
||||||
|
|
||||||
if (i > 2) {
|
|
||||||
out += " -> ";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user