스레드가 실행되는 동안 발생하는 스레드를 캐치 예외 예외로 해야합니다.
나는 새로운 예외를 던지려고했지만 "보고되지 않은 예외 ... 잡히거나 던져 져야합니다."라는 오류가 표시되지만 .2 그럴 수 없다면 그 이유는 무엇입니까? 이유를 설명 할 수 있다면 캐치 예외 스레드 외부 스레드
여기
try {
log("Connecting to Module..");
int no = searchdevices.getSelectedIndex();
String Selectaddress = searchdevices.getString(no);
String name = Selectaddress.substring(0, 6);
String add = Selectaddress.substring(Selectaddress.indexOf("$") + 1);
if (no == -1) {
Alert al = new Alert("Warning", "" + no, null, AlertType.WARNING);
al.setTimeout(3000);
display.setCurrent(al);
}
final String fdata2 = "btspp://" + add + ":1;master=false;encrypt=false;authenticate=false";
finalurl = fdata2;
fbtname = name;
// fbtadd = add;
new Thread(new Runnable() {
public void run() {
try {
isConnOpen = true;
stream = (StreamConnection) Connector.open(fdata2);
in = stream.openInputStream();
out = stream.openOutputStream();
url2 = fdata2;
GoTo_Success();
} catch (IOException ex) {
throw new Exception();//in side exception
}
}
}).start();
} catch (Exception e) {
log("Please switch on bluetooth and then try again"); // want to catch here..
}
가 감사 내 코드입니다.
예외를 발생시키려는 코드를 보여주십시오. –
코드를 넣습니다. – Nirav