JDK-6559445 : Java applets do not work with IE7 "Protect mode ON" on windows Vista.
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2007-05-18
  • Updated: 2011-02-16
  • Resolved: 2007-05-21
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
Java Plug-in 1.6.0_01, Java Plug-in 1.6.0_02-ea

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows [Version 6.0.6000]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Internet Explorer 7 with Protected Mode ON

A DESCRIPTION OF THE PROBLEM :
It seems like applets are having less permission to access files in IE7 running on Windows Vista. It is even stricter in Protected mode On.

We have couple of applets which write files in %APPDATA% folder under a particular directory. This was not working in Protected mode ON, but was writing the files in Protected mode OFF. We used System.getenv() to get the environment variable and constructed the full path.

Now the problem is that FileOutputStream.write() does not write the file in the given location. The location is some thing like this "C:\Users\<user name>\AppData\Roaming\<file name>". There is NO exception thrown from the code. We checked that FileOutputStream.getFD().valid() is returning 'true'.

Problem is reproducible with both JRE 1.5_06 and 1.6_01.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
File written to the APPDATA directory.
ACTUAL -
File not written to the APPDATA folder. Also there is no exception thrown from FileOutputStream.write()

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
public static void writeFile(byte[] buf, String filename)
{
      String parent_dir = System.getenv("APPDATA");
      String finalPath = parent_dir + filename;

      java.io.FileOutputStream fout = null;

      try
      {

         fout = new java.io.FileOutputStream(finalPath);

         fout.write(buf);
         fout.flush();
      }
      catch (IOException ex)
      {
         ex.printStackTrace();
      }

      finally
      {
         try
         {
            if(fout!=null)
            {
               fout.close();
            }
         }
         catch(IOException e)
         {
            // ensure the program to run more safely. It's not necessary to log
            // the exception.
         }
      }

   }
}
---------- END SOURCE ----------

Comments
WORK AROUND write to appdata/locallow directory instead
21-05-2007