作者darkk6 (CJV)
看板java
标题Re: [J2ME] 撰写蓝芽(JSR82)时的错误
时间Fri Aug 28 13:29:00 2009
结果是这样:
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