#fixed code
                              private Writer fileNameToOutputWriter(String fileName) throws IOException {
    if (fileName == null) {
      return null;
    }
    if (testMode) {
      return new StringWriter();
    }

    return streamToOutputWriter(filenameToOutputStream(fileName));
  }
#vulnerable code 
                              private Writer fileNameToOutputWriter(String fileName) throws IOException {
    if (fileName == null) {
      return null;
    }
    if (testMode) {
      return new StringWriter();
    }
    return streamToOutputWriter(new FileOutputStream(fileName));
  } 
                            #location 8 
                            #vulnerability type RESOURCE_LEAK