Details
-
Bug
-
Status: In Progress
-
Minor
-
Resolution: Unresolved
-
3.9
-
None
-
None
-
None
Description
The ClassUtils method getAbbreviatedName calculates the required lenght one character short. That way
final String ANY_CLASS_FULL_NAME = "...."; assertEquals("ANY_CLASS_FULL_NAME ", ClassUtils.getAbbreviatedName(ANY_CLASS_FULL_NAME , ANY_CLASS_FULL_NAME .length()));
will abbreviate the class name, although we are asking exactly the same number of characters as they are there. The solution is that
if (availableSpace > 0) {
has to be modified to
if (availableSpace >= 0) {
since the value zero means that we exactly used up the available character width.
This is just a quick fix for this issue, but generally, the algorithm is faulty. It runs many times out of the desired length. It actually uses the len parameter, not as the desired final length but rather a length for which what is out of the range on the left that has to be abbreviated. For that, the code could be much simpler. (See LANG-1480.)
Attachments
Issue Links
- is part of
-
LANG-1480 ClassUtils. getAbbreviatedName(String ,int) returns too long result
- Resolved
- links to