使用sonar扫描项目代码时提示如下信息:
Either re-interrupt this method or rethrow the "InterruptedException"
问题代码如下:
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
logger.error("休眠1秒失败,请核查", e);
}
解决:
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
logger.error("休眠1秒失败,请核查", e);Thread.currentThread().interrupt();
}