title: ImageIO.write didn't work?
body: <p>Hello I have problem with followed function that should save forwarded bufferedImage on disk. When I run this code there no exception throwed no problems, BufferedImage is transfered to ImageIO.write(img, ext ,fileToSave) file was created, ext is correct but there no image on my disk! After hours i dont have idea what can go wrong. Maybe permission? But i have it to read/write on disk.</p>
  
  <pre><code>  public boolean SaveImage(BufferedImage img)
  {
      JFileChooser FC=new JFileChooser("C:/");
      FC.addChoosableFileFilter(new jpgSaveFilter());
      FC.addChoosableFileFilter(new jpegSaveFilter());
      FC.addChoosableFileFilter(new PngSaveFilter());
      FC.addChoosableFileFilter(new gifSaveFilter());
      FC.addChoosableFileFilter(new BMPSaveFilter());
      FC.addChoosableFileFilter(new wbmpSaveFilter()); 
  
      int retrival=FC.showSaveDialog(null);
  
      if (retrival == FC.APPROVE_OPTION) 
         {
  
              String ext="";
  
              String extension=FC.getFileFilter().getDescription();
  
             if(extension.equals("*.jpg,*.JPG"))
            { 
                ext=".jpg";
            }
            if(extension.equals("*.png,*.PNG"))
            { 
                ext=".png";
            }
            if(extension.equals("*.gif,*.GIF"))
            { 
                ext=".gif";
            }
            if(extension.equals("*.wbmp,*.WBMP"))
            { 
                ext=".wbmp";
            }
            if(extension.equals("*.jpeg,*.JPEG"))
            { 
                ext=".jpeg";
            }
            if(extension.equals("*.bmp,*.BMP"))
            { 
                ext=".bmp";
            }
  
            File fileToSave = FC.getSelectedFile();
            try{
                ImageIO.write(img, ext ,fileToSave);
  
            }
            catch (IOException e) {
                  e.printStackTrace();
              }
            catch(Exception ex)
            {
                System.out.println(ex.getMessage());
                return false;
            }
            return true;
         }
      return false;
  }
  </code></pre>
  
  <p>Thanks for help!</p>