code: private static PrintWriter initWriter(String category)
     {
        PrintWriter pw = null;
        File file = null;
        try
        {
           file =
              new File(PrivilegedSystemHelper.getProperty("user.dir"), "Statistics" + category + "-"
                 + System.currentTimeMillis() + ".csv");
           file.createNewFile();
           pw = new PrintWriter(file);
        }
        catch (IOException e)
        {
           LOG.error("Cannot create the file for the statistics " + category
              + " in the user directory, we will try to create it in the temp directory", e);
           try
           {
              file =
                 PrivilegedFileHelper.createTempFile("Statistics" + category, "-" + System.currentTimeMillis() + ".csv");
              pw = new PrintWriter(file);
           }
           catch (IOException e1)
           {
              LOG.error("Cannot create the file for the statistics " + category, e1);
           }
        }
        if (file != null)
        {
           LOG.info("The file for the statistics " + category + " is " + file.getPath());
        }
        return pw;
     }
docs: Initialize the {@link PrintWriter}.
  It will first try to create the file in the user directory, if it cannot, it will try
  to create it in the temporary folder.
  @return the corresponding {@link PrintWriter}