Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6495

[java6][classlib][luni] File.canExecute throws SecurityException when file doesn't have read permission

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.0M1
    • Fix Version/s: 6.0M2
    • Component/s: Classlib
    • Labels:
      None
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Novice

      Description

      Executing file.canExecute with a security policy that grants the file execute permission throws a security exception that the file does not have read permission:

      java.security.AccessControlException: Access denied (java.io.FilePermission /tmp/harmony-test-FileTest/executeFile read)
      at java.security.AccessController.checkPermission(AccessController.java:95)
      at java.lang.SecurityManager.checkPermission(SecurityManager.java:862)
      at java.lang.SecurityManager.checkRead(SecurityManager.java:480)
      at java.io.File.exists(File.java:446)
      at java.io.File.canExecute(File.java:1702)

      According to the spec, a security exception should be thrown only when SecurityManager.checkExec denies access.

      1. 6495.patch
        11 kB
        Catherine Hope

        Activity

        Hide
        chope Catherine Hope added a comment -

        Patch is for Java 6 tree. It inlines the exists method functionality into canExecute but without the security check for read permission. The testcase demonstrates the problem and also checks security exceptions from the other methods.

        Show
        chope Catherine Hope added a comment - Patch is for Java 6 tree. It inlines the exists method functionality into canExecute but without the security check for read permission. The testcase demonstrates the problem and also checks security exceptions from the other methods.
        Hide
        regis_xu Regis Xu added a comment -

        Thanks Catherine!

        Patch was applied at r932003, please verify.

        Show
        regis_xu Regis Xu added a comment - Thanks Catherine! Patch was applied at r932003, please verify.
        Hide
        chope Catherine Hope added a comment -

        Verified

        Show
        chope Catherine Hope added a comment - Verified

          People

          • Assignee:
            regis_xu Regis Xu
            Reporter:
            chope Catherine Hope
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development