I am designing a database table, which will log Java exception messages.
For this case (and also out of interest) I want to know the (max.) message sizes I will encounter.
At the moment I am only interested in standard java language exceptions.
- Is there any technical limitation on the message size?
- What are the message lengths of the most common exceptions?
- What is the average message length of all standard java exceptions?
- Did the messages change a lot between different Java Versions?
Example:
try {
//Some code, which throws an Exception
} catch(Exception ex) {
String msg = ex.toString(); //Use toString, because sometimes there is no message
int size = msg.length(); //How large can this be?
}
Throwable toString() implementation:
public String toString() {
String var1 = this.getClass().getName();
String var2 = this.getLocalizedMessage();
return var2 != null ? var1 + ": " + var2 : var1;
}
Thanks for the replies. Bonus question: Is there a list with all the java language exception messages (in English), so I do not have to check the source files manually?
Exceptionmessages. If you can, test it in a dev / test environment and if you need more, go back and increase the limit before pushing to prod.