No that's not right. You have copy pasted your code wrong. Line 22 is just constructing an object of type email template. That line cannot throw NPE. Don't make me look at line 22, because of the way you copy pasted, the line numbers might have changed. Also, that doesn't help you learn how to solve the problem for yourself. Look at line 22 in your own
IDE. That will point you to the right place
Generally, any time you get a stack trace,
you should go to the exact line that threw the exception and try to figure out why it threw that exception. This is no different. An NPE simply means you tried to call a method on a reference that is null. You need to find out what variable is null in this case.