publicclassProcessor{publicvoidexecute(ProcessDataprocessData){if(processData==null||processData.getInput()==null){logger.error("processData is error");return;}List<FavoratePolicy>policies=fetchPolicies(processData);if(policies==null||policies.isEmpty()){logger.error("can not fetch favorate policies");return;}for(FavoratePolicypolicy:policies){//handle policy}}}
publicclassProcessor{publicvoidexecute(ProcessDataprocessData){try{checkArgument(processData!=null&&processData.getInput()!=null,"processData is error");List<FavoratePolicy>policies=fetchPolicies(processData);checkArgument(policies!=null&&(!policies.isEmpty()),"can not fetch favorate policies");for(FavoratePolicypolicy:policies){//handle policy}}catch(IllegalArgumentExceptionex){logger.error(ex.getMessage());}}}