I am trying to add exception e in this ArrayList “returnObjRoleRecord” ArrayList is defined properly in above code, Here is my code where I am getting error:
catch(Exception e){
e.printStackTrace();
if(i>0){
returnObjRoleRecord.add(e);
}
else{
returnObjRoleRecord=e;
}
I am getting this error: Typed variable declaration : Error in method invocation: Method add(java.lang.NullPointerException) not found in class'java.lang.NullPointerException'
Could anyone Please explain why it is trying to find .add() method in this class java.lang.NullPointerException