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

JRE 1.3.0 getDocumentBase.getRef() fails to return URL anchor/reference

XMLWordPrintable

    • beta
    • generic, x86
    • generic, windows_98, windows_nt, windows_xp
    • Verified



      Name: boT120536 Date: 02/08/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      We have a Java 2 Applet that requires access to the # ref/anchor portion of its
      referencing URL. The getRef in the code below executes correctly under
      JRE/Plug-in 1.2.2 (WinNT,Win98,Win95), but returns NULL under JRE/Plug-in 1.3.0
      (WinNT,Win98,Win95).

      This is a serious problem for us that we will need to research.

      Below are (sorry for cut & paste problems):

      JApplet1.java - JApplet that just queries docbase URL info. Compile under 1.3.
      JApplet1.html - HTML to load FRAMES, including the Java 2 Applet above.
      Java2Applet.html - the Bottom frame HTML (Java 2 applet portion)
        TopHolder.html - text to show in the top frame

      Copy all of these to a directory (local/file or web server) and compile
      JApplet1.java.

      Note that the Java 2 applet loading URL includes an anchor
      (src="Java2Applet.html#This_is_the_reference").

      Opening JApplet1.html under MS IE 4/5 with Java Plugin 1.2.2 produces:

      Java(TM) Plug-in: Version 1.2.2.p001
      Using JRE version 1.2.2
        User home directory = C:\WINDOWS
      Proxy Configuration: Manual Configuration
           Proxy: XXX.XX.XXX.X:XX
           Proxy Overrides: XX.XX,<local>
      JAR cache enabled.

      protocol = file
      host =
      filename = /C:/Shared/JApplet1/Java2Applet.html
      port = -1
      ref = This_is_the_reference

      Opening JApplet1.html under MS IE 4/5 with Java Plugin 1.3.0 produces:

      Java(TM) Plug-in: Version 1.3.0-C
      Using JRE version 1.3.0 Java HotSpot(TM) Client VM
        User home directory = C:\WINDOWS
      Proxy Configuration: Manual Configuration
           Proxy: http://XX.XX.XX.XX:XX
           Proxy Overrides: XX.XX,<local>
      JAR cache disabled.

      protocol = file
      host =
      filename = /C:/scatch/JApplet1/
      port = -1
      ref = null

      Note that the exact same code (java & html) produces "This_is_the_reference"
      under 1.2.2 and "null" under 1.3.0.

      JApplet1.java:
      import java.net.*;
      import java.io.*;
      import java.awt.*;
      import javax.swing.*;

      // Little JApplet just to display it codebase info INCLUDING the HTML reference anchor..
      // Seems JRE 1.2.2 displays the anchor & JRE 1.3.0 does not!

      public class JApplet1 extends JApplet {
       public void init() {
          URL aURL = this.getDocumentBase();
          System.out.println("protocol = " + aURL.getProtocol());
          System.out.println("host = " + aURL.getHost());
          System.out.println("filename = " + aURL.getFile());
          System.out.println("port = " + aURL.getPort());
          System.out.println("ref = " + aURL.getRef());
                  
          JLabel urlInfo = new JLabel("<html>"+"protocol = " + aURL.getProtocol()
      + "<BR>"+
              "host = " + aURL.getHost()+ "<BR>"+
              "filename = " + aURL.getFile()+ "<BR>"+
              "port = " + aURL.getPort()+ "<BR>"+
              "ref = " + aURL.getRef());
          getContentPane().add(urlInfo,BorderLayout.CENTER);
          getContentPane().validate();
          getContentPane().setVisible(true);
        }
      }

      JApplet1.html:
      <html>
      <title>Java 2 HTML/URL Reference Display</title>
      <head>
      </head>
      <FRAMESET rows="8%,92%">
      <FRAME src="TopHolder.html" name="TopFrame">
      <FRAME src="Java2Applet.html#This_is_the_reference" name="BottomFrame">
      </FRAMESET>
      </html>

      Java2Applet.html (note: Allows execution under 1.2.2 OR 1.3.0 but installs
      1.3.0 if no Java 2 VM around):
      <html>
      <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
      WIDTH = 100% HEIGHT = 100%
      codebase="http://java.sun.com/products/plugin/1.3/jinstall-13-
      win32.cab#Version=1,2,2,0">
      <PARAM NAME = CODE VALUE = JApplet1.class >
      <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
      <COMMENT>
      <EMBED type="application/x-java-applet;version=1.3" java_CODE =
      JApplet1.class WIDTH = 100% HEIGHT = 100%
      pluginspage="http://java.sun.com/products/plugin/1.3/plugin-install.html">
      <NOEMBED>
      </COMMENT>
      alt="Your browser understands the tag but isn't running the applet, for some
      reason (Java Plug-In 1.2.2+ not available?)."
      Your browser is completely ignoring the applet tag!
      </NOEMBED>
      </EMBED>
      </OBJECT>
      </html>

        TopHolder.html:
      <html>
      <p align="left">
      Bottom Frame will display the referencing HTML / URL information...
      </html>

      Feel free to contact me if you cannot reproduce the problem.
      icsbug
      (Review ID: 109550)
      ======================================================================

            stanleyh Stanley Ho (Inactive)
            bonealsunw Bret O'neal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: