trycatch 只包含容易出异常的地方
private void addOnce( Shop shop) { try { ChainStoreAddRequest request = new ChainStoreAddRequest(); ChainStoreAddInfo chainStoreAddInfo = new ChainStoreAddInfo(); chainStoreAddInfo.setName(shop.getShopName()); chainStoreAddInfo.setContactPhone(shop.getPhoneNum()); chainStoreAddInfo.setAddress(shop.getAddress()); chainStoreAddInfo.setLongitude(shop.getLongitude().toString()); chainStoreAddInfo.setLatitude(shop.getLatitude().toString()); request.setChainStore(chainStoreAddInfo); ChainStoreAddResponse response = client.execute(request); System.out.println(response.getData()); } catch (Exception e) { System.out.println(e); } } private void addOnce( Shop shop) { ChainStoreAddRequest request = new ChainStoreAddRequest(); ChainStoreAddInfo chainStoreAddInfo = new ChainStoreAddInfo(); chainStoreAddInfo.setName(shop.getShopName()); chainStoreAddInfo.setContactPhone(shop.getPhoneNum()); chainStoreAddInfo.setAddress(shop.getAddress()); chainStoreAddInfo.setLongitude(shop.getLongitude().toString()); chainStoreAddInfo.setLatitude(shop.getLatitude().toString()); request.setChainStore(chainStoreAddInfo); try { ChainStoreAddResponse response = client.execute(request); System.out.println(response.getData()); } catch (Exception e) { System.out.println(e); } }