You're never initializing lns
in Protocol
, so it's always a null
reference. You may be able to get away with just changing the declaration to:
private List<String> lns = new ArrayList<String>();
(I've made it private and changed the type to List
just out of habit...)
You should also consider giving it a more readable name - is it meant to represent lines? If so, call it lines
!
(Next, consider why you weren't able to diagnose this yourself. Did you step through this in the debugger? Why did you think there were no null references on line 77? What diagnostic steps did you take in terms of adding extra logging etc? It's important to use errors like this as a learning experience to make future issues more tractable.)