1
2
3
4
5
6
7
8
9
10
11
12
|
protected <T> List<BusinessItemData> itemMap2ItemList(Map<Integer, Map<String, Object>> docBusinessItems,Class<T> item){
List<BusinessItemData> businessItems = null ;
if (MapUtils.isNotEmpty(docBusinessItems)) {
businessItems = new ArrayList<BusinessItemData>(docBusinessItems.size());
for ( int orderNo : docBusinessItems.keySet()) {
Map<String, Object> docItemAttrs = docBusinessItems.get(orderNo);
BusinessItemData tmp = (BusinessItemData) DocumentUtils.backendFill2frontend(item,docItemAttrs);
businessItems.add(orderNo- 1 ,tmp);
}
}
return businessItems;
}
|
碰到了诡异的bug ,在本地单元测试 没问题, 但是拿到测试机上就出错,在地8行报数组越界,太诡异了。本地启动tomcat debug一点问题都没有,没办法只能换中方法
1
2
3
4
5
6
7
8
9
10
11
12
|
protected <T> List<BusinessItemData> itemMap2ItemList(Map<Integer, Map<String, Object>> docBusinessItems,Class<T> item){
BusinessItemData[] businessItems = null ;
if (MapUtils.isNotEmpty(docBusinessItems)) {
businessItems = new BusinessItemData[docBusinessItems.size()];
for ( int orderNo : docBusinessItems.keySet()) {
Map<String, Object> docItemAttrs = docBusinessItems.get(orderNo);
BusinessItemData tmp = (BusinessItemData) DocumentUtils.backendFill2frontend(item,docItemAttrs);
businessItems[orderNo- 1 ] = tmp;
}
}
return Arrays.asList(businessItems);
} |