wu-sheng commented on code in PR #609:
URL: https://github.com/apache/skywalking-java/pull/609#discussion_r1325383193


##########
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 = Math.max(lengthLimited, 
Integer.valueOf(properties.getProperty(lengthKey, "0")));
+                            }

Review Comment:
   I think `max` would be a little tricky. As we provided a configuration item, 
I would prefer to use the configuration value to override static codes as 
always. 
   Could you explain why do you code as `max`?



-- 
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]

Reply via email to