sonar issue私有空getGtcj(字符串gtcj状态值,字符串strArchiveReqd)抛出异常{ XPathHelper激活配置解析器= null;尝试{激活配置解析器=配置实用程序.获取示例().获取配置解析器(新的URL((V21常量.文件+系统.获取属性(V21常量.用户目录)+“/vServe 21/配置/激活参数. xml”)));{日志错误(e.getMessage());}
StringBuffer useGTCJSolution = new StringBuffer();
useGTCJSolution.append(XPathConstants.ACTIVATION_CONFIG_ACTIVATION_PARAM)
.append("/parameter[@name = '").append(XPathConstants.TAG_NAME_USE_GTCJ_SOLUTION)
.append("']");
String useGTCJSolutionStr = activationConfigParser.evaluateXPath(useGTCJSolution.toString());
log.debug("useGTCJSolutionStr value:" + useGTCJSolutionStr);
if (useGTCJSolutionStr != null && useGTCJSolutionStr.trim().equalsIgnoreCase(V21Constants.YES)
&& (gtcjStatusValue.equalsIgnoreCase(Statuses.ACTIVATION_SUCCESS)
|| gtcjStatusValue.equalsIgnoreCase(Statuses.ROLLBACK_SUCCESS)
|| gtcjStatusValue.equalsIgnoreCase("Rollback Failure"))) {
log.debug("No need to archive and send response from here.");
} else {
log.debug("inside GTCJSolution for GTCJ orders...Archiving and sending response xml");
if (strArchiveReqd != null && "Yes".equalsIgnoreCase(strArchiveReqd)) {
archiveXML(responseFileName, V21Constants.VIF_ARCHIVE_RESPONSE_XML_PATH);
}
// sending the response XML
response = new Response();
response.sendResponseXML(properties, responseXml, bNBSConnectivityFlag, queueName, address);
}
}
我发现catch后面应该有finally块,但是我不知道要在finally块里面添加什么。或者有其他的解决方案吗?请帮助
1条答案
按热度按时间nbewdwxp1#
你应该把你所有的代码放在这个try catch语句中,并在catch中抛出一些可以理解的异常,比如抛出new IllegalArgumentException(“错误的配置文件”)