Bug 7979 - Combo's getText() does not return previous setText() setting on Italian Win2K
Summary: Combo's getText() does not return previous setText() setting on Italian Win2K
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows 2000
: P2 major (vote)
Target Milestone: 2.0 M2   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-01-21 20:03 EST by Yen Lu CLA
Modified: 2002-03-07 10:39 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Yen Lu CLA 2002-01-21 20:03:47 EST
In an Italian Win2K system, WSAD's web services tool fills a Combo object with 
values and then calls the setText() method with a string which is in the list.
Immediately afterwards, we call the getText() method expecting to get back the 
string which we had just set. However, we get something different.

So far, we've only seen this on an Italian Win2K system.
Comment 1 Mike Wilson CLA 2002-01-22 12:18:48 EST
Please clarify what "Something different" means. Ideally provide a test case 
including an example string and the resulting changed output. Also see the 
discussion in bug report 7709 to see if this is applicable.
Comment 2 Yen Lu CLA 2002-01-22 12:25:23 EST
"Something different":

For example, we populate the Combo with items A, B, C and D. we then call the 
Combo's setText("B"). Immediately afterwards, we call the Combo's getText() and 
the return value is "C". I will try to put together a testcase.
Comment 3 Steve Northover CLA 2002-01-22 14:37:39 EST
Here is some code that shows this working on English Windows.  Can you try it 
on Italian?


public static void main (String [] args) {
	Display display = new Display ();
	Shell shell = new Shell (display);
	Combo combo = new Combo (shell, SWT.READ_ONLY);
	combo.setItems (new String [] {"A", "B", "C", "D"});
	combo.setText ("B");
	combo.pack ();
	shell.open ();
	System.out.println ("Text=" + combo.getText ());
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}
Comment 4 Yen Lu CLA 2002-01-22 15:19:09 EST
Steve,

The test program you appended works in both Italian and English Win2K. I don't 
know if the fact that our Combo runs in the context of a Wizard may have any 
effect but I'm continuing to reduce it to a small, reproduceable test case.

Thanks for your help so far.

Regards,
Yen Lu
Comment 5 Yen Lu CLA 2002-01-22 17:30:20 EST
We've narrowed this down. Our guess is that the implementation of the setText() 
method only compares a certain number of characters before declaring a match. 
There were two strings in our list with the first four words being the same. 
Here's the testcase:

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.SWT;

public class TestClass
{
  public static void main(String args[])
  {
    Display display = new Display();
    Shell shell = new Shell(display);
    Combo combo = new Combo(shell,SWT.READ_ONLY);
    System.out.println(combo.LIMIT);
    combo.setItems(new String[]{"Servizio Web URL","EJB Web service","Servizio 
Web bean Java di struttura","Servizio Web bean Java","Servizio Web DADX"});
    combo.setText("Servizio Web bean Java");
    System.out.println(combo.getText());
    combo.pack();
    shell.open();
    System.out.println("Text = " + combo.getText());
    while (!shell.isDisposed())
    {
      if (display.readAndDispatch())
        display.sleep();
    }
    display.dispose();
  }

The output from this program is on Windows 2000 (both English and Italian) is:

2147483647
Servizio Web bean Java di struttura
Text = Servizio Web bean Java di struttura

As you can see, the string we actually got is a superset of the string we set 
the Combo to. This in addition to the fact that the superset string appears 
first in the list suggests to me that only a partial comparison is being 
performed.

The code printing the Combo.LIMIT suggests to me that the strings should be 
small enough to make a sufficiently good comparison and not require any partial 
comparisons.
Comment 6 Steve Northover CLA 2002-01-22 17:52:05 EST
Fixed > 20020122.