U 关掉转换图片类型警告日志

This commit is contained in:
天爱有情
2022-08-15 17:13:16 +08:00
parent c19dc82f7c
commit e288dc9b91
@@ -119,18 +119,18 @@ public abstract class AbstractImageCaptchaGenerator implements ImageCaptchaGener
} }
public String beforeTransform(BufferedImage bufferedImage, String formatType) { public String beforeTransform(BufferedImage bufferedImage, String formatType) {
int type = bufferedImage.getType(); // int type = bufferedImage.getType();
if (BufferedImage.TYPE_4BYTE_ABGR == type) { // if (BufferedImage.TYPE_4BYTE_ABGR == type) {
// png , 如果转换的是jpg的话 // // png , 如果转换的是jpg的话
if (CaptchaImageUtils.isJpeg(formatType)) { // if (CaptchaImageUtils.isJpeg(formatType)) {
// bufferedImage为 png 但是转换的图片为 jpg // // bufferedImage为 png 但是转换的图片为 jpg
if (log.isWarnEnabled()) { // if (log.isWarnEnabled()) {
log.warn("图片验证码转换警告, 原图为 png格式时,指定转换的图片为jpg格式时可能会导致转换异常,如果转换的图片为出现错误,请设置指定转换的类型与原图的类型一致"); // log.warn("图片验证码转换警告, 原图为 png格式时,指定转换的图片为jpg格式时可能会导致转换异常,如果转换的图片为出现错误,请设置指定转换的类型与原图的类型一致");
} else { // } else {
System.err.println("图片验证码转换警告, 原图为 png格式时,指定转换的图片为jpg格式时可能会导致转换异常,如果转换的图片为出现错误,请设置指定转换的类型与原图的类型一致"); // System.err.println("图片验证码转换警告, 原图为 png格式时,指定转换的图片为jpg格式时可能会导致转换异常,如果转换的图片为出现错误,请设置指定转换的类型与原图的类型一致");
} // }
} // }
} // }
// 其它的暂时不考虑 // 其它的暂时不考虑
return null; return null;
} }