Now with slightly better error handling.

This commit is contained in:
dchandler 2002-10-28 03:17:28 +00:00
parent 0ad135f8f1
commit 8433369d60
2 changed files with 400 additions and 398 deletions

View file

@ -27,6 +27,8 @@ import java.awt.event.KeyEvent;
import javax.swing.text.*;
import java.awt.font.*;
import org.thdl.util.ThdlDebug;
/**
* Interfaces between Extended Wylie and the TibetanMachineWeb fonts.
* To do this this must first read the code table, which lives in "tibwn.ini",
@ -232,10 +234,11 @@ public class TibetanMachineWeb {
if (null != keyboard_url) {
try {
TibetanKeyboard kb = new TibetanKeyboard(keyboard_url);
setKeyboard(kb);
setKeyboard(kb); // this can't throw the InvalidKeyboardException
}
catch (TibetanKeyboard.InvalidKeyboardException ike) {
System.out.println("invalid keyboard file or file not found");
System.out.println("invalid keyboard file or file not found: " + keyboard_url.toString());
ThdlDebug.noteIffyCode();
setKeyboard(keyboard);
}
}
@ -473,17 +476,16 @@ public static boolean setKeyboard(TibetanKeyboard kb) {
* if there was an error
*/
public static boolean setKeyboard(URL url) {
TibetanKeyboard kb;
try {
kb = new TibetanKeyboard(url);
TibetanKeyboard kb = new TibetanKeyboard(url);
if (setKeyboard(kb))
return true;
else
return false;
}
catch (TibetanKeyboard.InvalidKeyboardException ike) {
System.out.println("can't create this keyboard");
System.out.println("can't create the keyboard associated with " + url);
ThdlDebug.noteIffyCode();
return false;
}
}