问题描述
fortify 工具扫描提示
问题出现的环境背景及自己尝试过哪些方法
代码由客户总部使用fortify工具扫描,扫描策略不详。
相关代码
public static String simpleHttpMapRequest(String location, Map requestMap) {
String resultString = "";
SslContextFactory sslContextFactory = new SslContextFactory();
HttpClient httpClient = new HttpClient(sslContextFactory);
try {
httpClient.start();
Request request = httpClient.POST(location);
if (requestMap != null) for (Object entryObj : requestMap.entrySet()) {
Map.Entry requestEntry = (Map.Entry) entryObj;
if(requestEntry!=null){
request.param(requestEntry.getKey() != null ? requestEntry.getKey().toString() : null,requestEntry.getValue() != null ? requestEntry.getValue().toString() : null);
}
}
ContentResponse response = request.send();
resultString = StringUtilities.toStringCleanBom(response.getContent());
} catch (Exception e) {
throw new BaseException("Error in http client request", e);
} finally {
try {
httpClient.stop();
} catch (Exception e) {
logger.error("Error stopping http client", e);
}
}
return resultString;
}
你期待的结果是什么?实际看到的错误信息又是什么?
request.param(requestEntry.getKey() != null ? requestEntry.getKey().toString() : null,requestEntry.getValue() != null ? requestEntry.getValue().toString() : null);
自己结合上下文反复查看后觉得没有问题,请各位帮忙看看
最后那里如果真的啥都没有,就会形成这个结果:
request.param(null);