Project: SWT
Bug 42259 StringIndexOutOfBoundsException in FontData.getLocale()
Reported: 2003-08-29 12:07:25 | Status: resolved fixed

If the lang, country, and variant fields are all null in a FontData, the getLocale() method on win32 will throw a StringIndexOutOfBoundsException. The following program will generate the exception on my WinXP box: import org.eclipse.swt.widgets.*; import org.eclipse.swt.graphics.*; public class FontDataGetLocaleBug { public static void main(String[] args) { final Display display = new Display(); FontData[] fds = display.getFontList(null, true); for (int i=0; i<fds.length; ++i) fds[i].getLocale(); display.dispose(); }}

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/graphics/FontData.java bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/FontData.java bundles/org.eclipse.swt/Eclipse SWT/motif/org/eclipse/swt/graphics/FontData.java bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/graphics/FontData.java bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/FontData.java