結果是這樣:
java.lang.NullPointerException
at com.sun.kvem.jsr082.bluetooth.DataL2CAPReaderWriter.<init>(+41)
at com.sun.kvem.jsr082.bluetooth.SDPClient$SDPTransport.start(+100)
at com.sun.kvem.jsr082.bluetooth.SDPClient.openTransport(+94)
at com.sun.kvem.jsr082.bluetooth.SDPClient.open(+41)
at com.sun.kvem.jsr082.bluetooth.SDPClient.<init>(+9)
at com.sun.kvem.jsr082.bluetooth.ServiceSearcher.start(+110)
at com.sun.kvem.jsr082.bluetooth.DiscoveryAgentImpl.searchServices(+19)
at javax.bluetooth.DiscoveryAgent.searchServices(+12)
at BTtest.inquiryCompleted(+134)
at com.sun.kvem.jsr082.impl.bluetooth.BTDeviceDiscoverer.notifyDone(+32)
at com.sun.kvem.jsr082.impl.bluetooth.BTDeviceDiscoverer.run(+289)
show 是把字串顯示到 List 的方法
public void inquiryCompleted(int discType)
{
show("-------------------------");
show("尋找完成");
for(int i=0;i<rmDiv.size();i++)
{
show("開始尋找服務...");
int[] attributes = {0x100,0x101,0x102};
UUID[] uidSet=new UUID[1];
uidSet[0]=new UUID(0x1002);//0x1002=PublicBrowseGroup
try{
agent.searchServices(attributes,uidSet,(RemoteDevice)rmDiv.elementAt(i),this);
}
catch(Exception e){System.out.println("SearchService:");
e.printStackTrace();}
break;//只找第一個
}
System.out.println(".....");
}
因為只有 try 這一行,所以應該也只有這邊會出錯吧...
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.123.81.250