Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4252701
Votes 6
Synopsis RFE: getCodeBase() and getDocumentBase() do not behave as documented
Category guides:none
Reported Against 1.2.1
Release Fixed
State 11-Closed, duplicate of 4456393, request for enhancement
Priority: 4-Low
Related Bugs 4456393
Submit Date 08-JUL-1999
Description




The API docs for the Applet class claim that the
getDocumentBase() method returns "the URL of the document in
which the Applet is embedded."  What it actually seems to do is
to return the URL of the directory in which the document resides.
The actual behavior seems more in line with the method name (and
more useful), but does not agree with the docs.

Similarly, the docs for the getCodeBase() method claim that it
returns "the URL of the applet itself."  What it actually seems
to do is to return the value of the codebase parameter from the
applet tag if that was specified, or the same value as
getDocumentBase() otherwise.  Again, the actual behavior seems
more appropriate than that described by the documentation.

Version info:

D:\work\JaMM_2.0>java -version
java version "1.2.1"
Classic VM (build JDK-1.2.1-A, native threads)

D:\work\JaMM_2.0>java -fullversion
java full version "JDK-1.2.1-A"
(Review ID: 85379) 
======================================================================
Work Around
N/A
Evaluation
I've started investigating this, and will resolve the issue soon.

  xxxxx@xxxxx   2001-05-22

It turns out that this bug is closely related to appletviewer bug 4456393. When that bug is fixed, the javadoc in question will also be fixed. I'm closing this as a duplicate.

  xxxxx@xxxxx   2002-01-29
Comments
  
  Include a link with my name & email   

Submitted On 08-JAN-2000
caesium
The behavior of getDocumentBase() is bizarre!
The following tag in the HTML will alter its
return value:
<base href="http://nonExistentSite.com/">
You will get nonExistentSite.com from
getDocumentBase().getHost() !
Whassamatta U?


Submitted On 18-DEC-2000
Joseph_Tate
Not only is the documentation inconsistant, but the 
behavior is inconsistant across environments.  If I call 
getDocumentBase from within appletviewer, I get the entire 
URL, if I call it within Internet Explorer using the JRE 
plugin, I get the base of the document.  If I call it 
within Netscape (Using the plugin), I get the full url, 
protocall, host, path and filename.  Extremely annoying.



PLEASE NOTE: JDK6 is formerly known as Project Mustang