Don't Pass & Return Null β
Returning null from methods is bad, but passing null into methods is worse.
Unless you are working with an API which expects you to pass null, you should avoid passing null in
your code whenever possible.
#CleanCode #Exception #Null
Returning null from methods is bad, but passing null into methods is worse.
Unless you are working with an API which expects you to pass null, you should avoid passing null in
your code whenever possible.
#CleanCode #Exception #Null
π¦ Grab The Stack Trace Of An Exception π¦
Checking your code for errors is one of the most Painstaking β and frustrating β parts of the development process. ππ»ββοΈ
Itβs also horrendously Time-Consuming, particularly if youβve a pesky error whose source isnβt immediately clear. π‘
Using this code, you can more easily track down where an Exception is occurring β and bring yourself that much closer to being rid of it. β
Code
#java #exception #error #trick
@ProgrammingTip
Checking your code for errors is one of the most Painstaking β and frustrating β parts of the development process. ππ»ββοΈ
Itβs also horrendously Time-Consuming, particularly if youβve a pesky error whose source isnβt immediately clear. π‘
Using this code, you can more easily track down where an Exception is occurring β and bring yourself that much closer to being rid of it. β
Code
Exception e = β¦;
java.io.StringWriter sw = new java.io.StringWriter();
e.printStackTrace(new java.io.PrintWriter(sw));
String trace = sw.getBuffer().toString();
#java #exception #error #trick
@ProgrammingTip