title: BufferedWriter does not detect read only directory
body: <p>I have a java application that reads and writes csv files. I have created a read only directory on my Mac that my application will try to write a csv file to. I did this with chmod 000. No file gets created but no error is thrown either. Furthermore, checking that the file was created with Files.notExists() returns False. My application needs to detect that no csv was created to inform the user. What is going on here?</p>
  <pre><code>public void writeCSV(String fileName, List&lt;String&gt; results) throws IOException {
      // fileName = &quot;~/no_write/results.csv&quot;
  
      try(CSVPrinter printer = new CSVPrinter(Files.newBufferedWriter(Paths.get(fileName)), CSVFormat.DEFAULT.withHeader(header)) {
          for (String result : results) {
              printer.printRecord(result);
          }
      }
  
      if (Files.notExists(Paths.get(fileName))) { // returns False but no_write directory is empty
          throw new IOException();
      }
  
      if (!Files.exists(Paths.get(fileName))) { // Files.exists returns True
          throw new IOException();
      }
  }
  </code></pre>