迭代器造成堆溢出
OutOfMemoryError java neap space
while (iterator.hasNext()) {
Object rowObj = iterator.next(); //这里千万不能写成hasNext()
if (rowObj == null){
jsonArray.put(new JsonStringObject(null));
}
else if (rowObj.getClass().isArray() || rowObj instanceof Collection){
jsonArray.put(getJsonArray(rowObj,useClassConvert));
}
else {
jsonArray.put(getJsonObject(rowObj,useClassConvert));
}
}
注意坑点
iterator.next(),如果写成iterator.hasNext()就会造成neap space.

浙公网安备 33010602011771号