If it is the first line where you use that Writer, yes, it might be null. The code quoted doesn't show where you instantiate it. In fact Writers should be opened as local variables, and closed in a finally block, to release access to the File. Brian Legg gave a little example in
this thread. You will have to look at older examples quoted from that thread and see where I made a mistake in a post to work out the whole thing. If you have difficulty following those old threads, I shall give an example later.