[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=313723&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-313723 ]
ASF GitHub Bot logged work on LANG-1480: ---------------------------------------- Author: ASF GitHub Bot Created on: 17/Sep/19 14:28 Start Date: 17/Sep/19 14:28 Worklog Time Spent: 10m Work Description: garydgregory commented on pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r325199931 ########## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ########## @@ -424,7 +424,14 @@ public static String getAbbreviatedName(final Class<?> cls, final int len) { * significant loss of meaning.</p> * <p>The abbreviated class name will always include the complete package hierarchy. * If enough space is available, rightmost sub-packages will be displayed in full - * length.</p> + * length. The abbreviated package names will be shortened to a single character.</p> + * <p>Only package names are shortened, the class simple name remains untouched. (See examples.)</p> + * <p>The result will be longer than the desired length only if all the package names + * shortened to a single character plus the class simple name with the separating dots + * together are longer than the desired length. In other words, when the class name + * cannot be shortened to the desired length without significant loss of meaning.</p> + * <p>If the class name can be shortened without significant loss of meaning then Review comment: I do not think we should talk about "loss of meaning" as to me, abbreviating implies "loss of meaning" by design ;-) Just describe what it does. IMO a list would be better to describe the different use cases. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 313723) Remaining Estimate: 20h 20m (was: 20.5h) Time Spent: 3h 40m (was: 3.5h) > ClassUtils. getAbbreviatedName(String ,int) returns too long result > ------------------------------------------------------------------- > > Key: LANG-1480 > URL: https://issues.apache.org/jira/browse/LANG-1480 > Project: Commons Lang > Issue Type: Bug > Components: lang.* > Affects Versions: 3.9 > Environment: Environment independent. > Reporter: Peter Verhas > Assignee: Bruno P. Kinoshita > Priority: Major > Original Estimate: 24h > Time Spent: 3h 40m > Remaining Estimate: 20h 20m > > In some cases, the algorithm decides incorrectly when to which package names > to abbreviate. For example, abbreviating > {{org.apache.commons.lang3.ClassUtils}} to the length 18 will result > {{o.a.c.lang3.ClassUtils}} (22 characters) instead of {{o.a.c.l.ClassUtils}} > (18 characters as requested). The reason for this is that the algorithm > starts from the right and goes to the left abbreviating the packages and > starts to abbreviate the packages when it runs out of the available space. > Instead, the algorithm should start from the left and abbreviate all packages > that would result in a too-long string without abbreviating the package name. -- This message was sent by Atlassian Jira (v8.3.2#803003)