Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5093952

File.setReadOnly clears write permission but leaves execute permissions intact

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      calling a setReadOnly() on file or directory having 777 permission removes the write permission but leaves execute permission intact.
      r_x r_x r_x

      Tried on RH Linux Advanced Server 3.0 and Solaris-9 using Tiger-rc Build 63

      How to reproduce the stuff:-

      create a sample file say check.txt
      give 777 permission

      compile and execute below mentioned code:-
      import java.io.*;
      import java.util.*;


      public class Test4 {

          public void check() {
            try {
                 File file = new File("check.txt");
                 System.out.println("Going to make it read only:"+file.setReadOnly());
                                
            } catch(Exception e) {
                 e.printStackTrace();
            }
          
          }


          public static void main(String args[]) {
             Test4 ref = new Test4();
             ref.check();
          
          }

      }

      After executing check the permission on check.txt file using ls -la

        Attachments

          Activity

            People

            Assignee:
            iris Iris Clark
            Reporter:
            jsinghsunw Jit Singh (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: