title: Java file.createNewFile file not created and no exceptions thrown
body: <p>The following code does not always create the file. 
  As far as I noticed, the first time this code has run, though no exception is thrown and createdFileSucceeded == true, the file doesn't get created.</p>
  
  <p>I run the code on Windows, java 6. </p>
  
  <p>Any input could be helpful</p>
  
  <pre><code>File file = new File(tmpDir, fileName);
  
  try {
  if (tmpDir == null) {
    String environmentHomePath // = somePath;
    tmpDir = new File(environmentHomePath, "SampleDumps");
  
    if (! tmpDir.exists() || ! tmpDir.isDirectory()) {
      boolean mkdirSucceeded = tmpDir.mkdir();
      if (! mkdirSucceeded) {
        throw new IOException("Failed creating directory: '" + tmpDir.getAbsolutePath() + "'");
      }
    }
  }
  
  if (file.exists()) {
    boolean deleteFileSucceeded = file.delete(); 
    if (! deleteFileSucceeded) {
      throw new IOException("Unable to delete pre existing sample file: '" + fileName + "'");
    }
  }
  
  boolean createFileSucceeded = file.createNewFile();
  if (! createFileSucceeded) {
    throw new IOException("Unable to create sample file: '" + fileName + "'");
  }
  
  fw = new FileWriter(file);
  bw = new BufferedWriter(fw);
  
  StringBuilder sb = new StringBuilder("something...");
  
  bw.write(sb.toString());
  bw.flush();
  }
  catch (IOException ioe) {
  log.warn("Unable to file invalid sample to file: '" + fileName + "'", ioe);
  }
  finally {
  if (bw != null) {
    try {
      bw.close();
    } catch (IOException e) {
      log.warn("Unable to close Writer to file: '" + fileName + "'", e);
    }
  }
  else if (fw != null) {
    try {
      fw.close();
    } catch (IOException e) {
      log.warn("Unable to close Writer to file: '" + fileName + "'", e);
    }
  }
  }
  </code></pre>