为什么执行这段代码时?提示NullPointerException?

 

String sql="select DM,DMMS,SM from ODS_ZXGL_SRC.bm_jafs where qybz = 1 and dmyyfw like '%,8%' order by xssx";
List <Map<String, Object>>list = this.getService().getObjectList(sql);
StringBuilder sb = new StringBuilder();
sb.append("[");
  if (list.size()>0) {
    for (int i=0;i<list.size();i++) {
Map<String, Object> map = list.get(i);
if (i!=0) {
   sb.append(",");
}
sb.append("{\"id\":\"").append(map.get("DM").toString()).append("\",");
sb.append("\"text\":\"").append(map.get("SM").toString()).append("---").append(map.get("DMMS").toString()).append("\"");
sb.append("}");
System.out.println("capacity=="+sb.capacity());
}
     }
sb.append("]");
this.responseJsonData(sb.toString(), response);

capacity==70
capacity==142
capacity==286
capacity==286
capacity==286
capacity==574
capacity==574
capacity==574
capacity==574
capacity==574
capacity==574
capacity==574
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==1150
capacity==2302
capacity==2302
输出结果如上,这错误是说sb大小不足了吗?

你可能感兴趣的:(java,jvm)