Closed Bug 44462 Opened 25 years ago Closed 25 years ago

Wrong url loaded by Webclient in some cases

Categories

(Core Graveyard :: Java APIs to WebShell, defect, P3)

x86
Windows NT
defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: avm, Assigned: edburns)

Details

Attachments

(2 files)

In some cases the test application, that uses Webclient API loads URLs with some garbage. For exmple when i try to load "www.sun.com/" via Navigation.loadURL then really "www.sun.com/sdajkfgas_SomeGarbage_dfrfdf" loaded. Supposed reason: When constructing wsLoadURLEvent webclient use the buffer of PRUnichar to construct nsString. But early this PRUnichar array was recieved via env->GetStringChars(inString,0) and may be or may be NOT 0-terminated. And when constructing nsString from not 0-terminated string we can get some GARBAGE from memory. This problem is well reproduced with jdk1.2.2SE, latest Webclient and Mozilla M16. Also this problem can be reproduced with jdk1.2.2 and Mozilla M13
Accept
Status: NEW → ASSIGNED
I can't reproduce this. And your explanation doesn't fit the code. We just get back a string: PRUnichar* urlStringChars = (PRUnichar *) ::util_GetStringChars(env, urlString); This goes to env->GetStringChars(). We have no control over what this returns. If there is garbage, it's a JNI bug. Can you please help me reproduce this?
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → WORKSFORME
Yes, this bug is hard to reproduce. But this is not jni bug, but documented jni feature: env->GetStringChars() can return 0-terminated OR not 0-terminated array. And in our case we must use additional "length" parameter to construct right nsString from PRUnichar array. In attachment please see the simple jni testcase, that shows that array, returned by env->GetStringChars is not 0-terminated. To run this testcase please untar it, build under win32 and run NativeTest class.
Additional info: testcase from 07/31/00 05:39 in .tar.gz format
Attached patch Supposed fix.Splinter Review
The fix looks fine, but the only thing that remains is to make it compatible with webclient in StarOffice. I can do that.
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
Fix checked in.
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
*** Bug 59242 has been marked as a duplicate of this bug. ***
VERIFIED with JAVADEV_6_1_20010831 and Netscape61_RELEASE.
Status: RESOLVED → VERIFIED
QA Contact: geetha.vaidyanaathan → avm
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: