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

add unit test for URLUtil.checkTargetURL()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 7
    • deploy

      For 6954743 and 7013789

      The goal of this API URLUtil.checkTargetURL() is to check if the source url have the proper permission to access the target url

      The reasonable assertions to test are:
            a) "detects when code loaded remotely wants to access local filesystem" source URL is remote, local is file = return value is false
               a1) if source is remote and valid, the target file is local and invalid then it reutrns false
               a2) if source is remote and valid, the target file is local and valid then it reutrns false
               a3) if source is remote and invalid, the target file is local and invalid then it reutrns false
               a4) if source is remote and invalid, the target file is local and valid then it reutrns false

            b) "both source and target are remote are ok" = return value is true
               b1) if source is remote and valid, the target is remote invalid it reutrns true
               b2) if source is remote and valid, the target is remote valid it reutrns true
               b3) if source is remote and invalid, the target is remote invalid it reutrns true
               b4) if source is remote and invalid, the target is remote valid it reutrns true

            c) if source is local file based and target is also local file based, it returns true
            d) "source is not accessible and target is remote" = return true
            e) "source is not accessible and target is local"= return false
            f) target is not accessible, source is arbitrary = return true
            g) for unknow protocol, for now we could not test for we could not even go into the checkTargetURL method for the URL constructor restrictions

            albertz Albert Zhang (Inactive)
            albertz Albert Zhang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: