mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-10 23:47:29 +00:00
fix: 替换 e.printStackTrace() 和 System.out.println 为 logger 调用
- HttpProxyVerticle: err.printStackTrace() / e.printStackTrace() -> LOGGER.error() - RouterHandlerFactory: 5处 printStackTrace() -> LOGGER.error() - CommonUtil: e.printStackTrace() -> LOGGER.error() - ReflectionUtil: 新增 LOGGER,3处 printStackTrace() -> LOGGER.error() - CreateDatabase: e.printStackTrace() -> LOGGER.error() - URLUtil: 新增 LOGGER,e.printStackTrace() -> LOGGER.error() - LzTool: e.printStackTrace() -> log.error() - MkwTool: 3处 System.out.println + 1处 printStackTrace -> log.debug()/log.error() - PdbTool: e.printStackTrace() -> log.error() - ParserApi: t.printStackTrace() -> log.error() - CacheManager: 2处 Throwable::printStackTrace -> LOGGER.error() - QQTool: 3处 System.out.println -> log.debug() - FjTool: System.out.println -> log.debug()
This commit is contained in:
@@ -180,7 +180,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
if (ctx.statusCode() == 503 || ctx.failure() == null) {
|
||||
doFireJsonResultResponse(ctx, JsonResult.error("未知异常, 请联系管理员"), 503);
|
||||
} else {
|
||||
ctx.failure().printStackTrace();
|
||||
LOGGER.error("路由处理失败", ctx.failure());
|
||||
doFireJsonResultResponse(ctx, JsonResult.error(ctx.failure().getMessage()), 500);
|
||||
}
|
||||
});
|
||||
@@ -199,7 +199,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
try {
|
||||
ReflectionUtil.invokeWithArguments(method, instance, sock);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("WebSocket处理异常", e);
|
||||
}
|
||||
});
|
||||
if (url.endsWith("*")) {
|
||||
@@ -323,7 +323,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
parameterValueList.put(k, entity);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("实体类绑定异常: {}", typeName, e);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -366,7 +366,7 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
Object entity = ParamUtil.multiMapToEntity(queryParams, aClass);
|
||||
parameterValueList.put(k, entity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("参数绑定异常: {}", v.getRight().getName(), e);
|
||||
}
|
||||
} else if (parameterValueList.get(k) == null
|
||||
&& JsonObject.class.getName().equals(v.getRight().getName())) {
|
||||
@@ -418,7 +418,6 @@ public class RouterHandlerFactory implements BaseHttpApi {
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("请求处理异常", e);
|
||||
doFireJsonResultResponse(ctx, JsonResult.error("服务器内部错误"), 500);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class CommonUtil {
|
||||
appVersion = properties.getProperty("app.version") + "build" + properties.getProperty("build");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("读取app.properties失败", e);
|
||||
}
|
||||
}
|
||||
return appVersion;
|
||||
|
||||
@@ -25,6 +25,9 @@ import java.net.URL;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static cn.qaiu.vx.core.util.ConfigConstant.BASE_LOCATIONS;
|
||||
|
||||
/**
|
||||
@@ -36,6 +39,8 @@ import static cn.qaiu.vx.core.util.ConfigConstant.BASE_LOCATIONS;
|
||||
*/
|
||||
public final class ReflectionUtil {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ReflectionUtil.class);
|
||||
|
||||
// 缓存Reflections实例,避免重复扫描(每次扫描约35K+值,耗时1-3秒,占用大量内存)
|
||||
private static final Map<String, Reflections> REFLECTIONS_CACHE = new java.util.concurrent.ConcurrentHashMap<>();
|
||||
|
||||
@@ -128,7 +133,7 @@ public final class ReflectionUtil {
|
||||
parameterTypes[j - k]));
|
||||
}
|
||||
} catch (NotFoundException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("获取方法参数失败", e);
|
||||
}
|
||||
return paramMap;
|
||||
}
|
||||
@@ -183,7 +188,7 @@ public final class ReflectionUtil {
|
||||
try {
|
||||
return DateUtils.parseDate(value, fmt);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("日期解析失败: {}", value, e);
|
||||
throw new RuntimeException("无法将格式化日期");
|
||||
}
|
||||
default:
|
||||
@@ -215,7 +220,7 @@ public final class ReflectionUtil {
|
||||
}
|
||||
return arr;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("数组类型转换失败: {}", value, e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ public class HttpProxyVerticle extends AbstractVerticle {
|
||||
);
|
||||
})
|
||||
.onFailure(err -> {
|
||||
err.printStackTrace();
|
||||
LOGGER.error("HTTP请求失败", err);
|
||||
clientRequest.response().setStatusCode(502).end("Bad Gateway: Request failed");
|
||||
});
|
||||
}
|
||||
@@ -222,7 +222,7 @@ public class HttpProxyVerticle extends AbstractVerticle {
|
||||
}
|
||||
return port;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("提取端口失败: {}", urlString, e);
|
||||
// 出现异常时返回 -1,表示提取失败
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user