wu-sheng commented on code in PR #609:
URL: https://github.com/apache/skywalking-java/pull/609#discussion_r1326662957
##########
apm-commons/apm-util/src/main/java/org/apache/skywalking/apm/util/ConfigInitializer.java:
##########
@@ -85,9 +85,16 @@ private static void initNextLevel(Properties properties,
Class<?> recentConfigTy
} else {
// Convert the value into real type
final Length lengthDefine =
field.getAnnotation(Length.class);
- if (lengthDefine != null && propertyValue.length() >
lengthDefine.value()) {
- StringUtil.cut(propertyValue,
lengthDefine.value());
- System.err.printf("The config value will be
truncated , because the length max than %d : %s -> %s%n", lengthDefine.value(),
configKey, propertyValue);
+ if (lengthDefine != null) {
+ int lengthLimited = lengthDefine.value();
+ String lengthKey = String.format("%s#length",
configKey);
+ if (properties.containsKey(lengthKey)) {
+ lengthLimited =
Integer.valueOf(properties.getProperty(lengthKey, "0"));
Review Comment:
I think we are better to try catch the `Integer#valueOf` and `system.err` if
type cast fails. WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]