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

SECURITY EXCEPTION THROWN WHEN CREATINGFOR SYSTEM RESOURCES (OJDK 613738) URLS

XMLWordPrintable

    • 1.1.6
    • sparc
    • solaris_2.5.1
    • Verified



      Name: diC59631 Date: 01/22/98


      1. a. Create a directory called images
         b. Create two dummy files called "dock.gif" and "undock.gif" in the images directory
         c. Run URLTest.java
         You will see a security exception

      2. Java source code:
      //author ###@###.###
      import java.net.URL;
      public class URLTest
      {
        // main
        public static void main(String[] args)
        {
          try
          {
            // get an URL for the image using ClassLoader.getResource()
            URL url = URLTest.class.getResource("images/dock.gif");
            System.out.println("url = " + url);
            // create a relative URL using the obtained URL
            URL relativeURL = new URL(url, "undock.gif");
            System.out.println("relativeURL = " + relativeURL);
          }
          catch (Exception e)
          {
            e.printStackTrace();
          }
        }

      3. Error messages:
      java.net.MalformedURLException: undock.gif: java.lang.SecurityException: Invalid system resource URL
              at java.net.URL.<init>(URL.java)
              at URLTest.main(URLTest.java:33)
      4. Trace information: See #3 above
      5. Platform: Solaris 2.5.1
                   JDK1.1.6D
                   Oracle tracking number 613738
      (Review ID: 23789)
      ======================================================================

            brenaudsunw Benjamin Renaud (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: