[GitHub] [commons-lang] coveralls edited a comment on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
coveralls edited a comment on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-523302164 [![Coverage Status](https://coveralls.io/builds/25329391/badge)](https://coveralls.io/builds/25329391) Coverage decreased (-0.2%) to 95.175% when pulling **856e9b3d5fac403f8a1d4f9cb6e279376b052f04 on YuyuZha0:master** into **f0534ba8547ab5a9c64c4cecf0fa98fefa7ccc1d on apache:master**. 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 With regards, Apache Git Services
[GitHub] [commons-lang] coveralls edited a comment on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
coveralls edited a comment on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-523302164 [![Coverage Status](https://coveralls.io/builds/25329178/badge)](https://coveralls.io/builds/25329178) Coverage decreased (-0.2%) to 95.175% when pulling **0b8c40709fc00bd30b89c4e46a0c8494dacf17a2 on YuyuZha0:master** into **f0534ba8547ab5a9c64c4cecf0fa98fefa7ccc1d on apache:master**. 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 With regards, Apache Git Services
[GitHub] [commons-lang] YuyuZha0 commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
YuyuZha0 commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-524597564 @kinow Thanks for the carefully reviewing ! Nice weekend, isn't it? I will edit the code later follow your advice. Currently I was on the performance, I've tried more cases, here is the result: ``` Benchmark (arrayLen) Mode Cnt Score Error Units StringSplitBenchmark.testCommonsLang3Split 10 avgt 25 499.547 ± 10.716 ns/op StringSplitBenchmark.testCommonsLang3Split 30 avgt 25 1502.510 ± 16.956 ns/op StringSplitBenchmark.testCommonsLang3Split 50 avgt 25 2467.303 ± 18.970 ns/op StringSplitBenchmark.testFastSplitUtils 10 avgt 25 396.252 ± 4.653 ns/op StringSplitBenchmark.testFastSplitUtils 30 avgt 25 1145.600 ± 5.604 ns/op StringSplitBenchmark.testFastSplitUtils 50 avgt 25 1885.414 ± 4.121 ns/op StringSplitBenchmark.testGuavaSplit 10 avgt 25 565.904 ± 5.483 ns/op StringSplitBenchmark.testGuavaSplit 30 avgt 25 1665.049 ± 81.051 ns/op StringSplitBenchmark.testGuavaSplit 50 avgt 25 2758.394 ± 7.684 ns/op ``` Cases is shown bellow: ``` import com.google.common.base.Splitter; import org.apache.commons.lang3.StringUtils; import org.openjdk.jmh.annotations.*; import java.util.ArrayList; import java.util.List; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import java.util.function.Supplier; /** * * @author zhaoyuyu * @since 2019-08-21 **/ @OutputTimeUnit(TimeUnit.NANOSECONDS) @BenchmarkMode(Mode.AverageTime) @Warmup(iterations = 5, time = 5) @Measurement(iterations = 5, time = 5) public class StringSplitBenchmark { private static final char separator = '@'; private static final Splitter splitter = Splitter.on(separator); @Benchmark public String[] testCommonsLang3Split(StringSupplier stringSupplier) { return StringUtils.splitPreserveAllTokens(stringSupplier.get(), separator); } @Benchmark public String[] testFastSplitUtils(StringSupplier stringSupplier) { return FastSplitUtils.splitPreserveAllTokens(stringSupplier.get(), separator); } @Benchmark public String[] testGuavaSplit(StringSupplier supplier) { return splitter.splitToList(supplier.get()).toArray(new String[0]); } @State(Scope.Thread) public static class StringSupplier implements Supplier { @Param({"10", "30", "50"}) private int arrayLen; private String[] array; private int index = 0; @Setup public void setup() { List list = new ArrayList<>(1000); ThreadLocalRandom random = ThreadLocalRandom.current(); for (int i = 0; i < 1000; i++) { String s = StringUtils.join( random.ints(arrayLen).toArray(), separator ); list.add(s); } this.array = list.toArray(new String[0]); } @Override public String get() { if (index >= array.length) index = 0; return array[index++]; } } } ``` The reason why I propose this optimization is that sometimes these methods are really under heavily usage(In my case, I use splitPreserveAllTokens for log processing, the method would be called **billions** of times every day). So for me, the performance is really important. The StringUtils is widely used, any edition must be cautiously, so I fully understand you warring. In computer science, everything would be a trade off, it's really a hard choice. 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 With regards, Apache Git Services
[GitHub] [commons-lang] YuyuZha0 commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
YuyuZha0 commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#discussion_r317380867 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -7434,7 +7434,7 @@ public static String rotate(final String str, final int shift) { return ArrayUtils.EMPTY_STRING_ARRAY; } final char[] c = str.toCharArray(); -final List list = new ArrayList<>(); +final SplitBuffer buffer = SPLIT_BUFFER_THREAD_LOCAL.get().getBuffer(); Review comment: The SplitBuffer instance is not a List instance anymore, leave it with a name "list" would be misleading I think. 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 With regards, Apache Git Services
[GitHub] [commons-lang] YuyuZha0 commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
YuyuZha0 commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#discussion_r317380836 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -7968,9 +7968,145 @@ public static String rotate(final String str, final int shift) { } } if (match || preserveAllTokens && lastMatch) { -list.add(str.substring(start, i)); +buffer.add(str.substring(start, i)); +} +return buffer.toArray(); +} + +private static final ThreadLocal SPLIT_BUFFER_THREAD_LOCAL += new ThreadLocal() { +@Override +protected SplitBufferThreadLocalHelper initialValue() { +return new SplitBufferThreadLocalHelper(); +} +}; + +// Private class act as a buffer while splitting. +// "SplitBufferThreadLocalHelper" is constructed as a thread local variable so it is +// thread safe. The "splitBuffer" field acts as a buffer to hold the temporary +// representation of string split segments. It is shared by all +// calls to splitByCharacterType() or splitByWholeSeparatorWorker() +// or splitWorker(String) or splitWorker(char) and its variants in that particular thread. +private static final class SplitBufferThreadLocalHelper { + +private final SplitBuffer splitBuffer = new SplitBuffer(); + +SplitBuffer getBuffer(){ +splitBuffer.reset(); +return splitBuffer; +} +} + +//buffer class +private static final class SplitBuffer { + +/** + * Default initial capacity. + */ +private static final int DEFAULT_CAPACITY = 10; + +/** + * Shared empty array instance used for default sized empty instances. We + * distinguish this from EMPTY_ELEMENTDATA to know how much to inflate when + * first element is added. + */ +private static final String[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {}; + +/** + * The maximum size of array to allocate (unless necessary). + * Some VMs reserve some header words in an array. + * Attempts to allocate larger arrays may result in + * OutOfMemoryError: Requested array size exceeds VM limit + */ +private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; + +private String[] elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA; +private int size = 0; + +private static int hugeCapacity(int minCapacity) { +if (minCapacity < 0) {// overflow +throw new OutOfMemoryError(); +} +return (minCapacity > MAX_ARRAY_SIZE) +? Integer.MAX_VALUE +: MAX_ARRAY_SIZE; +} + +String get(int index) { +return elementData[index]; +} + +void add(String e) { +add(e, elementData, size); +} + +/** + * This helper method split out from add(E) to keep method + * bytecode size under 35 (the -XX:MaxInlineSize default value), + * which helps when add(E) is called in a C1-compiled loop. + */ +private void add(String e, Object[] elementData, int s) { +if (s == elementData.length) { +elementData = grow(size + 1); +} +elementData[s] = e; +size = s + 1; +} + +/** + * Increases the capacity to ensure that it can hold at least the + * number of elements specified by the minimum capacity argument. + * + * @param minCapacity the desired minimum capacity + * @throws OutOfMemoryError if minCapacity is less than zero + */ +private String[] grow(int minCapacity) { +String[] newElementData = new String[newCapacity(minCapacity)]; +System.arraycopy(elementData, 0, newElementData, 0, elementData.length); +return elementData = newElementData; +} + +/** + * Returns a capacity at least as large as the given minimum capacity. + * Returns the current capacity increased by 50% if that suffices. + * Will not return a capacity greater than MAX_ARRAY_SIZE unless + * the given minimum capacity is greater than MAX_ARRAY_SIZE. + * + * @param minCapacity the desired minimum capacity + * @throws OutOfMemoryError if minCapacity is less than zero + */ +private int newCapacity(int minCapacity) { +// overflow-conscious code +int oldCapacity = elementData.length; +int newCapacity = oldCapacity + (oldCapacity >> 1); +if (newCapacity - minCapacity <= 0) { +if (elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA) { +return Math.max(DEFAULT_CAPACITY, m
[jira] [Commented] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915135#comment-16915135 ] Silence Tai commented on LANG-1475: --- Okay, I understand. Thank you for your reminder. > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Assignee: Bruno P. Kinoshita >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915133#comment-16915133 ] Bruno P. Kinoshita commented on LANG-1475: -- Thanks for updating the ticket [~Tai] (I had completely forgotten about it). I've moved it back to Resolved/Fixed. Normally issues are moved to Closed after the release happens. > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Assignee: Bruno P. Kinoshita >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-524595539 >At the time, the code used in the list, and the subsequent commits were improved, so I was concerned at the time. It seems that many problems have been solved now. Ah, got it! Sorry, I lost track of the changes since my first comment. Thanks for clarifying. 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 With regards, Apache Git Services
[jira] [Resolved] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bruno P. Kinoshita resolved LANG-1475. -- Resolution: Fixed > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Assignee: Bruno P. Kinoshita >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Reopened] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bruno P. Kinoshita reopened LANG-1475: -- Assignee: Bruno P. Kinoshita > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Assignee: Bruno P. Kinoshita >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] Stzx commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
Stzx commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-524595452 > @Stzx > > > I am worried that some problems will still be caused by using the clear method. such as > > I think this does not apply here. The instance that was a `List` would now be a `SplitBuffer`, i.e. > > ``` > final SplitBuffer buffer = SPLIT_BUFFER_THREAD_LOCAL.get().getBuffer(); > ``` > > https://github.com/apache/commons-lang/pull/443/files#diff-3f4c835875ddc8a211c0272e8be51394R7902-R7903 > > So `buffer` doesn't need to respect the `List`/`ArrayList` contracts. @kinow At the time, the code used in the list, and the subsequent commits were improved, so I was concerned at the time. It seems that many problems have been solved now. 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 With regards, Apache Git Services
[jira] [Resolved] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Silence Tai resolved LANG-1475. --- Resolution: Fixed > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915130#comment-16915130 ] Silence Tai commented on LANG-1475: --- In git master. > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Closed] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Silence Tai closed LANG-1475. - > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Work logged] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?focusedWorklogId=300802&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300802 ] ASF GitHub Bot logged work on LANG-1475: Author: ASF GitHub Bot Created on: 25/Aug/19 02:21 Start Date: 25/Aug/19 02:21 Worklog Time Spent: 10m Work Description: Stzx commented on pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException URL: https://github.com/apache/commons-lang/pull/441#discussion_r317379946 ## File path: src/changes/changes.xml ## @@ -61,6 +61,7 @@ The type attribute can be add,update,fix,remove. checkstyle.version 8.18 -> 8.23. junit-jupiter 5.5.0 -> 5.5.1. Added Functions.as*, and tests thereof, as suggested by Peter Verhas +StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException. Review comment: Ok, thank you for your work for this.👍 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: 300802) Time Spent: 1h (was: 50m) > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 1h > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] Stzx commented on a change in pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException
Stzx commented on a change in pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException URL: https://github.com/apache/commons-lang/pull/441#discussion_r317379946 ## File path: src/changes/changes.xml ## @@ -61,6 +61,7 @@ The type attribute can be add,update,fix,remove. checkstyle.version 8.18 -> 8.23. junit-jupiter 5.5.0 -> 5.5.1. Added Functions.as*, and tests thereof, as suggested by Peter Verhas +StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException. Review comment: Ok, thank you for your work for this.👍 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 With regards, Apache Git Services
[jira] [Work logged] (LANG-1478) ClassUtils getAbbreviatedName uses len one character shorter
[ https://issues.apache.org/jira/browse/LANG-1478?focusedWorklogId=300798&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300798 ] ASF GitHub Bot logged work on LANG-1478: Author: ASF GitHub Bot Created on: 25/Aug/19 01:45 Start Date: 25/Aug/19 01:45 Worklog Time Spent: 10m Work Description: kinow commented on issue #445: LANG-1478 class name abbreviation fix URL: https://github.com/apache/commons-lang/pull/445#issuecomment-524593280 @verhas I think this and #446 are good to be included in the next release. Just need you to address the review feedback and update both branches. If you could rebase it onto `master` as well, please. I've just fixed the Checkstyle issues, and Travis build should pass for both :+1: Thanks Bruno 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: 300798) Time Spent: 50m (was: 40m) > ClassUtils getAbbreviatedName uses len one character shorter > > > Key: LANG-1478 > URL: https://issues.apache.org/jira/browse/LANG-1478 > Project: Commons Lang > Issue Type: Bug >Affects Versions: 3.9 >Reporter: Peter Verhas >Assignee: Bruno P. Kinoshita >Priority: Minor > Time Spent: 50m > Remaining Estimate: 0h > > The {{ClassUtils}} method {{getAbbreviatedName}} calculates the required > lenght one character short. That way > {code} > final String ANY_CLASS_FULL_NAME = ""; > assertEquals("ANY_CLASS_FULL_NAME ", > ClassUtils.getAbbreviatedName(ANY_CLASS_FULL_NAME , ANY_CLASS_FULL_NAME > .length())); > {code} > will abbreviate the class name, although we are asking exactly the same > number of characters as they are there. The solution is that > {code} > if (availableSpace > 0) { > {code} > has to be modified to > {code} > if (availableSpace >= 0) { > {code} > 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.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] kinow commented on issue #445: LANG-1478 class name abbreviation fix
kinow commented on issue #445: LANG-1478 class name abbreviation fix URL: https://github.com/apache/commons-lang/pull/445#issuecomment-524593280 @verhas I think this and #446 are good to be included in the next release. Just need you to address the review feedback and update both branches. If you could rebase it onto `master` as well, please. I've just fixed the Checkstyle issues, and Travis build should pass for both :+1: Thanks Bruno 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow merged pull request #447: Fix checkstyle violations (tabs, missing spaces after commas, missing javadocs)
kinow merged pull request #447: Fix checkstyle violations (tabs, missing spaces after commas, missing javadocs) URL: https://github.com/apache/commons-lang/pull/447 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#discussion_r317378861 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -7968,9 +7968,145 @@ public static String rotate(final String str, final int shift) { } } if (match || preserveAllTokens && lastMatch) { -list.add(str.substring(start, i)); +buffer.add(str.substring(start, i)); +} +return buffer.toArray(); +} + +private static final ThreadLocal SPLIT_BUFFER_THREAD_LOCAL += new ThreadLocal() { +@Override +protected SplitBufferThreadLocalHelper initialValue() { +return new SplitBufferThreadLocalHelper(); +} +}; + +// Private class act as a buffer while splitting. +// "SplitBufferThreadLocalHelper" is constructed as a thread local variable so it is +// thread safe. The "splitBuffer" field acts as a buffer to hold the temporary +// representation of string split segments. It is shared by all +// calls to splitByCharacterType() or splitByWholeSeparatorWorker() +// or splitWorker(String) or splitWorker(char) and its variants in that particular thread. +private static final class SplitBufferThreadLocalHelper { + +private final SplitBuffer splitBuffer = new SplitBuffer(); + +SplitBuffer getBuffer(){ +splitBuffer.reset(); +return splitBuffer; +} +} + +//buffer class +private static final class SplitBuffer { + +/** + * Default initial capacity. + */ +private static final int DEFAULT_CAPACITY = 10; + +/** + * Shared empty array instance used for default sized empty instances. We + * distinguish this from EMPTY_ELEMENTDATA to know how much to inflate when + * first element is added. + */ +private static final String[] DEFAULTCAPACITY_EMPTY_ELEMENTDATA = {}; + +/** + * The maximum size of array to allocate (unless necessary). + * Some VMs reserve some header words in an array. + * Attempts to allocate larger arrays may result in + * OutOfMemoryError: Requested array size exceeds VM limit + */ +private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; + +private String[] elementData = DEFAULTCAPACITY_EMPTY_ELEMENTDATA; +private int size = 0; + +private static int hugeCapacity(int minCapacity) { +if (minCapacity < 0) {// overflow +throw new OutOfMemoryError(); +} +return (minCapacity > MAX_ARRAY_SIZE) +? Integer.MAX_VALUE +: MAX_ARRAY_SIZE; +} + +String get(int index) { +return elementData[index]; +} + +void add(String e) { +add(e, elementData, size); +} + +/** + * This helper method split out from add(E) to keep method + * bytecode size under 35 (the -XX:MaxInlineSize default value), + * which helps when add(E) is called in a C1-compiled loop. + */ +private void add(String e, Object[] elementData, int s) { +if (s == elementData.length) { +elementData = grow(size + 1); +} +elementData[s] = e; +size = s + 1; +} + +/** + * Increases the capacity to ensure that it can hold at least the + * number of elements specified by the minimum capacity argument. + * + * @param minCapacity the desired minimum capacity + * @throws OutOfMemoryError if minCapacity is less than zero + */ +private String[] grow(int minCapacity) { +String[] newElementData = new String[newCapacity(minCapacity)]; +System.arraycopy(elementData, 0, newElementData, 0, elementData.length); +return elementData = newElementData; +} + +/** + * Returns a capacity at least as large as the given minimum capacity. + * Returns the current capacity increased by 50% if that suffices. + * Will not return a capacity greater than MAX_ARRAY_SIZE unless + * the given minimum capacity is greater than MAX_ARRAY_SIZE. + * + * @param minCapacity the desired minimum capacity + * @throws OutOfMemoryError if minCapacity is less than zero + */ +private int newCapacity(int minCapacity) { +// overflow-conscious code +int oldCapacity = elementData.length; +int newCapacity = oldCapacity + (oldCapacity >> 1); +if (newCapacity - minCapacity <= 0) { +if (elementData == DEFAULTCAPACITY_EMPTY_ELEMENTDATA) { +return Math.max(DEFAULT_CAPACITY, minC
[GitHub] [commons-lang] kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#discussion_r317378886 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -7968,9 +7968,145 @@ public static String rotate(final String str, final int shift) { } } if (match || preserveAllTokens && lastMatch) { -list.add(str.substring(start, i)); +buffer.add(str.substring(start, i)); +} +return buffer.toArray(); +} + +private static final ThreadLocal SPLIT_BUFFER_THREAD_LOCAL += new ThreadLocal() { +@Override +protected SplitBufferThreadLocalHelper initialValue() { +return new SplitBufferThreadLocalHelper(); +} +}; + +// Private class act as a buffer while splitting. +// "SplitBufferThreadLocalHelper" is constructed as a thread local variable so it is +// thread safe. The "splitBuffer" field acts as a buffer to hold the temporary +// representation of string split segments. It is shared by all +// calls to splitByCharacterType() or splitByWholeSeparatorWorker() +// or splitWorker(String) or splitWorker(char) and its variants in that particular thread. +private static final class SplitBufferThreadLocalHelper { + +private final SplitBuffer splitBuffer = new SplitBuffer(); + +SplitBuffer getBuffer(){ +splitBuffer.reset(); +return splitBuffer; +} +} + +//buffer class +private static final class SplitBuffer { Review comment: `StringUtils` is a long class, with high maintenance cost already as-is. Adding an extra class increases the maintenance. I would prefer to avoid it if possible. If we really need to add it, we **must** provide good documentation. Reading the name of the class, and the single comment `buffer class` gives too much room for interpretation. IOW, I would have to read the code to understand what this class does, how it works, and whether I should use it or not. 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#discussion_r317378979 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -7434,7 +7434,7 @@ public static String rotate(final String str, final int shift) { return ArrayUtils.EMPTY_STRING_ARRAY; } final char[] c = str.toCharArray(); -final List list = new ArrayList<>(); +final SplitBuffer buffer = SPLIT_BUFFER_THREAD_LOCAL.get().getBuffer(); Review comment: Leaving the variable name `list` would have reduced the changes to review I think? 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on a change in pull request #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#discussion_r317378898 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -7968,9 +7968,145 @@ public static String rotate(final String str, final int shift) { } } if (match || preserveAllTokens && lastMatch) { -list.add(str.substring(start, i)); +buffer.add(str.substring(start, i)); +} +return buffer.toArray(); +} + +private static final ThreadLocal SPLIT_BUFFER_THREAD_LOCAL += new ThreadLocal() { +@Override +protected SplitBufferThreadLocalHelper initialValue() { +return new SplitBufferThreadLocalHelper(); +} +}; + +// Private class act as a buffer while splitting. +// "SplitBufferThreadLocalHelper" is constructed as a thread local variable so it is +// thread safe. The "splitBuffer" field acts as a buffer to hold the temporary +// representation of string split segments. It is shared by all +// calls to splitByCharacterType() or splitByWholeSeparatorWorker() +// or splitWorker(String) or splitWorker(char) and its variants in that particular thread. Review comment: Comments like this are ignored by Javadoc tools and IDE's, and only available when a developer reads the source code. 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-524592946 @jochenw >@kinow Strongly opposed to accepting this PR: I don't have studied this in detail, but in my oppinion we'd loose thread safety here. Split methods, and similar simple stuff should always be thread safe, unless there is a very good reason. It appears to be that the solution proposed by @YuyuZha0 would be thread-safe, though I haven't really tried much of the code to confirm. From what I understand, the suggestion here is to use a single data structure per thread (see previous comments about a `ThreadLocal`), following the approach used by the JVM's `BigDecimal`. While it seems like it would indeed improve performance, I also feel like opposing the change but from a maintainability point of view. `StringUtils` has well over 5K lines, and the more we keep adding to it, the harder it gets to maintain. And there is the risk of missing some other use case and having issues in multi-threaded environments as you suggested - even though we have the ThreadLocal, I haven't checked other variables used, or if there is any other possibility of other issues. 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-524592784 @Stzx >I am worried that some problems will still be caused by using the clear method. such as I think this does not apply here. The instance that was a `List` would now be a `SplitBuffer`, i.e. ``` final SplitBuffer buffer = SPLIT_BUFFER_THREAD_LOCAL.get().getBuffer(); ``` https://github.com/apache/commons-lang/pull/443/files#diff-3f4c835875ddc8a211c0272e8be51394R7902-R7903 So `buffer` doesn't need to respect the `List`/`ArrayList` contracts. 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th…
kinow commented on issue #443: Optimize string split methods: 1. Use ThreadLocal to make reuse of th… URL: https://github.com/apache/commons-lang/pull/443#issuecomment-524592429 @YuyuZha0 >On my Mac(Intel Core i5, 2.3GHz, openjdk version "11.0.2"), It brings about 17% of performance improvation: I believe there are other methods in Commons Lang that could be optimized by removing branches ([e.g. of what I mean](https://stackoverflow.com/a/16369225)), or by using more specialized data structures. While some users could welcome this optimization, this is not the main goal of Commons Lang (i.e. it is not to offer what is missing in the Java language with the best performance, but yes to provide what is missing in the Java language). And adding it would increase the code readability and maintenance. We should be able to accommodate performance improvements, but I think this one would make a class already complicated to maintain, a bit harder to maintain. 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow opened a new pull request #447: Fix checkstyle violations (tabs, missing spaces after commas, missing javadocs)
kinow opened a new pull request #447: Fix checkstyle violations (tabs, missing spaces after commas, missing javadocs) URL: https://github.com/apache/commons-lang/pull/447 I think some changes slipped with some recent change. Reviewing PR of contributors, it was quite hard to distinguish what was failing due to the contributor's PR. If Travis is happy with this change, will merge it as I think this is a small change (formatting, adding javadocs, commas, replacing tab characters, etc). Cheers Bruno 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow closed pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException
kinow closed pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException URL: https://github.com/apache/commons-lang/pull/441 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 With regards, Apache Git Services
[jira] [Work logged] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?focusedWorklogId=300792&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300792 ] ASF GitHub Bot logged work on LANG-1475: Author: ASF GitHub Bot Created on: 25/Aug/19 00:14 Start Date: 25/Aug/19 00:14 Worklog Time Spent: 10m Work Description: kinow commented on pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException URL: https://github.com/apache/commons-lang/pull/441 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: 300792) Time Spent: 50m (was: 40m) > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 50m > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Work logged] (LANG-1475) StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LANG-1475?focusedWorklogId=300791&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300791 ] ASF GitHub Bot logged work on LANG-1475: Author: ASF GitHub Bot Created on: 25/Aug/19 00:09 Start Date: 25/Aug/19 00:09 Worklog Time Spent: 10m Work Description: kinow commented on pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException URL: https://github.com/apache/commons-lang/pull/441#discussion_r317377957 ## File path: src/changes/changes.xml ## @@ -61,6 +61,7 @@ The type attribute can be add,update,fix,remove. checkstyle.version 8.18 -> 8.23. junit-jupiter 5.5.0 -> 5.5.1. Added Functions.as*, and tests thereof, as suggested by Peter Verhas +StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException. Review comment: Normally the `dev` is a committer, and `due-to` is the PR contributor name/alias. But I will amend this manually in my working copy while merging :+1: 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: 300791) Time Spent: 40m (was: 0.5h) > StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException > -- > > Key: LANG-1475 > URL: https://issues.apache.org/jira/browse/LANG-1475 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Silence Tai >Priority: Major > Fix For: 3.10 > > Original Estimate: 10m > Time Spent: 40m > Remaining Estimate: 0h > > Call > {code:java} StringUtils.unwrap("a", 'a'); {code} > or > {code:java} StringUtils.unwrap("a", "a"); {code} > Throw Exception: > *java.lang.StringIndexOutOfBoundsException: begin 1, end 0, length 1* -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] kinow commented on a change in pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException
kinow commented on a change in pull request #441: [LANG-1475] Fix unwrap StringIndexOutOfBoundsException URL: https://github.com/apache/commons-lang/pull/441#discussion_r317377957 ## File path: src/changes/changes.xml ## @@ -61,6 +61,7 @@ The type attribute can be add,update,fix,remove. checkstyle.version 8.18 -> 8.23. junit-jupiter 5.5.0 -> 5.5.1. Added Functions.as*, and tests thereof, as suggested by Peter Verhas +StringUtils.unwrap incorrect throw StringIndexOutOfBoundsException. Review comment: Normally the `dev` is a committer, and `due-to` is the PR contributor name/alias. But I will amend this manually in my working copy while merging :+1: 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 With regards, Apache Git Services
[jira] [Work logged] (LANG-1474) JavaDoc was not updated of isAnyXXX in StringUtils
[ https://issues.apache.org/jira/browse/LANG-1474?focusedWorklogId=300789&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300789 ] ASF GitHub Bot logged work on LANG-1474: Author: ASF GitHub Bot Created on: 25/Aug/19 00:01 Start Date: 25/Aug/19 00:01 Worklog Time Spent: 10m Work Description: kinow commented on pull request #442: LANG-1474 documentation correction URL: https://github.com/apache/commons-lang/pull/442 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: 300789) Time Spent: 1h (was: 50m) > JavaDoc was not updated of isAnyXXX in StringUtils > -- > > Key: LANG-1474 > URL: https://issues.apache.org/jira/browse/LANG-1474 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Affects Versions: 3.9 > Environment: Any environment. >Reporter: Peter Verhas >Priority: Trivial > Labels: doc_cleanup > Original Estimate: 5m > Time Spent: 1h > Remaining Estimate: 0h > > The behavior of {{isAnyBlank}} and {{isAnyEmpty}} has changed for {{null}} > argument from version 2.5 to 3.9. The documentation, however, was not > changed. It still says > {{ StringUtils.isAnyEmpty((String) null) = true}} > and similarly for {{isAnyBlank}}. -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Work logged] (LANG-1474) JavaDoc was not updated of isAnyXXX in StringUtils
[ https://issues.apache.org/jira/browse/LANG-1474?focusedWorklogId=300790&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300790 ] ASF GitHub Bot logged work on LANG-1474: Author: ASF GitHub Bot Created on: 25/Aug/19 00:01 Start Date: 25/Aug/19 00:01 Worklog Time Spent: 10m Work Description: kinow commented on issue #442: LANG-1474 documentation correction URL: https://github.com/apache/commons-lang/pull/442#issuecomment-524589254 @verhas tested again today, and same behavior in master. Closing the PR, but in case you can confirm it's indeed an issue, feel free to re-open and reply with some step to confirm/reproduce it. Thanks! 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: 300790) Time Spent: 1h (was: 50m) > JavaDoc was not updated of isAnyXXX in StringUtils > -- > > Key: LANG-1474 > URL: https://issues.apache.org/jira/browse/LANG-1474 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Affects Versions: 3.9 > Environment: Any environment. >Reporter: Peter Verhas >Priority: Trivial > Labels: doc_cleanup > Original Estimate: 5m > Time Spent: 1h > Remaining Estimate: 0h > > The behavior of {{isAnyBlank}} and {{isAnyEmpty}} has changed for {{null}} > argument from version 2.5 to 3.9. The documentation, however, was not > changed. It still says > {{ StringUtils.isAnyEmpty((String) null) = true}} > and similarly for {{isAnyBlank}}. -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] kinow commented on issue #442: LANG-1474 documentation correction
kinow commented on issue #442: LANG-1474 documentation correction URL: https://github.com/apache/commons-lang/pull/442#issuecomment-524589254 @verhas tested again today, and same behavior in master. Closing the PR, but in case you can confirm it's indeed an issue, feel free to re-open and reply with some step to confirm/reproduce it. Thanks! 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow closed pull request #442: LANG-1474 documentation correction
kinow closed pull request #442: LANG-1474 documentation correction URL: https://github.com/apache/commons-lang/pull/442 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 With regards, Apache Git Services
[jira] [Commented] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915110#comment-16915110 ] Bruno P. Kinoshita commented on LANG-1480: -- See comment for LANG-1478, on whether this should go in 4.x release line, or 3.x. The answer for that in LANG-1478, applies here as well IMO. > 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: 1h 20m > Remaining Estimate: 22h 40m > > 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)
[jira] [Updated] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bruno P. Kinoshita updated LANG-1480: - Assignee: Bruno P. Kinoshita > 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: 1h 20m > Remaining Estimate: 22h 40m > > 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)
[GitHub] [commons-lang] kinow commented on issue #445: LANG-1478 class name abbreviation fix
kinow commented on issue #445: LANG-1478 class name abbreviation fix URL: https://github.com/apache/commons-lang/pull/445#issuecomment-524589141 @Stzx >I think I should add javaDoc at the same time, add a new example. +1, added a review comment for @verhas . And @verhas , thanks a lot for your contributions, we should be able to merge them soon (unless we need to wait for a major release, then I will update JIRA issues accordingly) 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 With regards, Apache Git Services
[jira] [Work logged] (LANG-1478) ClassUtils getAbbreviatedName uses len one character shorter
[ https://issues.apache.org/jira/browse/LANG-1478?focusedWorklogId=300788&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300788 ] ASF GitHub Bot logged work on LANG-1478: Author: ASF GitHub Bot Created on: 24/Aug/19 23:58 Start Date: 24/Aug/19 23:58 Worklog Time Spent: 10m Work Description: kinow commented on issue #445: LANG-1478 class name abbreviation fix URL: https://github.com/apache/commons-lang/pull/445#issuecomment-524589141 @Stzx >I think I should add javaDoc at the same time, add a new example. +1, added a review comment for @verhas . And @verhas , thanks a lot for your contributions, we should be able to merge them soon (unless we need to wait for a major release, then I will update JIRA issues accordingly) 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: 300788) Time Spent: 40m (was: 0.5h) > ClassUtils getAbbreviatedName uses len one character shorter > > > Key: LANG-1478 > URL: https://issues.apache.org/jira/browse/LANG-1478 > Project: Commons Lang > Issue Type: Bug >Affects Versions: 3.9 >Reporter: Peter Verhas >Assignee: Bruno P. Kinoshita >Priority: Minor > Time Spent: 40m > Remaining Estimate: 0h > > The {{ClassUtils}} method {{getAbbreviatedName}} calculates the required > lenght one character short. That way > {code} > final String ANY_CLASS_FULL_NAME = ""; > assertEquals("ANY_CLASS_FULL_NAME ", > ClassUtils.getAbbreviatedName(ANY_CLASS_FULL_NAME , ANY_CLASS_FULL_NAME > .length())); > {code} > will abbreviate the class name, although we are asking exactly the same > number of characters as they are there. The solution is that > {code} > if (availableSpace > 0) { > {code} > has to be modified to > {code} > if (availableSpace >= 0) { > {code} > 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.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=300785&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300785 ] ASF GitHub Bot logged work on LANG-1480: Author: ASF GitHub Bot Created on: 24/Aug/19 23:54 Start Date: 24/Aug/19 23:54 Worklog Time Spent: 10m Work Description: kinow commented on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#issuecomment-524588806 I think you need to include tests for this change. See the bot comment about coverage decreasing. Can we do anything about that? 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: 300785) Remaining Estimate: 22h 50m (was: 23h) Time Spent: 1h 10m (was: 1h) > 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 >Priority: Major > Original Estimate: 24h > Time Spent: 1h 10m > Remaining Estimate: 22h 50m > > 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)
[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=300786&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300786 ] ASF GitHub Bot logged work on LANG-1480: Author: ASF GitHub Bot Created on: 24/Aug/19 23:54 Start Date: 24/Aug/19 23:54 Worklog Time Spent: 10m Work Description: kinow commented on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#issuecomment-524588806 I think you need to include tests for this change. See the bot comment about coverage decreasing. Can we do anything about that? Or if you could confirm this is not related, please. 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: 300786) Remaining Estimate: 22h 40m (was: 22h 50m) Time Spent: 1h 20m (was: 1h 10m) > 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 >Priority: Major > Original Estimate: 24h > Time Spent: 1h 20m > Remaining Estimate: 22h 40m > > 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)
[GitHub] [commons-lang] kinow edited a comment on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …
kinow edited a comment on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#issuecomment-524588806 I think you need to include tests for this change. See the bot comment about coverage decreasing. Can we do anything about that? Or if you could confirm this is not related, please. 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow edited a comment on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …
kinow edited a comment on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#issuecomment-524588806 I think you need to include tests for this change. See the bot comment about coverage decreasing. Can we do anything about that? 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …
kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317377567 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -178,8 +179,22 @@ public void test_getAbbreviatedName_Class_ZeroLen() { @Test public void test_getAbbreviatedName_String() { assertEquals("", ClassUtils.getAbbreviatedName((String) null, 1)); +assertEquals("", ClassUtils.getAbbreviatedName("", 1)); assertEquals("WithoutPackage", ClassUtils.getAbbreviatedName("WithoutPackage", 1)); assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", 1)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("org.apache.commons.lang3.ClassUtils", 18)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("o.a.c.l.ClassUtils", 18)); +assertEquals("o..c.l.ClassUtils", ClassUtils.getAbbreviatedName("o..c.l.ClassUtils", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 1)); +assertEquals("..", ClassUtils.getAbbreviatedName("..", 1)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 2)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 3)); +assertEquals("java.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", Integer.MAX_VALUE)); +assertEquals("j.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length() - 1)); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length() - 1)); Review comment: I think you are not testing the bug you found? There is no test for a call to `getAbbreviatedName` with class name as a `String`, and length as the exact length of that `String`. 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 With regards, Apache Git Services
[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=300784&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300784 ] ASF GitHub Bot logged work on LANG-1480: Author: ASF GitHub Bot Created on: 24/Aug/19 23:53 Start Date: 24/Aug/19 23:53 Worklog Time Spent: 10m Work Description: kinow commented on pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317377567 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -178,8 +179,22 @@ public void test_getAbbreviatedName_Class_ZeroLen() { @Test public void test_getAbbreviatedName_String() { assertEquals("", ClassUtils.getAbbreviatedName((String) null, 1)); +assertEquals("", ClassUtils.getAbbreviatedName("", 1)); assertEquals("WithoutPackage", ClassUtils.getAbbreviatedName("WithoutPackage", 1)); assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", 1)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("org.apache.commons.lang3.ClassUtils", 18)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("o.a.c.l.ClassUtils", 18)); +assertEquals("o..c.l.ClassUtils", ClassUtils.getAbbreviatedName("o..c.l.ClassUtils", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 1)); +assertEquals("..", ClassUtils.getAbbreviatedName("..", 1)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 2)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 3)); +assertEquals("java.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", Integer.MAX_VALUE)); +assertEquals("j.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length() - 1)); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length() - 1)); Review comment: I think you are not testing the bug you found? There is no test for a call to `getAbbreviatedName` with class name as a `String`, and length as the exact length of that `String`. 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: 300784) Remaining Estimate: 23h (was: 23h 10m) Time Spent: 1h (was: 50m) > 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 >Priority: Major > Original Estimate: 24h > Time Spent: 1h > Remaining Estimate: 23h > > 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)
[jira] [Commented] (LANG-1478) ClassUtils getAbbreviatedName uses len one character shorter
[ https://issues.apache.org/jira/browse/LANG-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915109#comment-16915109 ] Bruno P. Kinoshita commented on LANG-1478: -- Sent a message to the mailing list, asking whether this needs to go in 4.x, or if we can include in the next 3.x release. > ClassUtils getAbbreviatedName uses len one character shorter > > > Key: LANG-1478 > URL: https://issues.apache.org/jira/browse/LANG-1478 > Project: Commons Lang > Issue Type: Bug >Affects Versions: 3.9 >Reporter: Peter Verhas >Assignee: Bruno P. Kinoshita >Priority: Minor > Time Spent: 0.5h > Remaining Estimate: 0h > > The {{ClassUtils}} method {{getAbbreviatedName}} calculates the required > lenght one character short. That way > {code} > final String ANY_CLASS_FULL_NAME = ""; > assertEquals("ANY_CLASS_FULL_NAME ", > ClassUtils.getAbbreviatedName(ANY_CLASS_FULL_NAME , ANY_CLASS_FULL_NAME > .length())); > {code} > will abbreviate the class name, although we are asking exactly the same > number of characters as they are there. The solution is that > {code} > if (availableSpace > 0) { > {code} > has to be modified to > {code} > if (availableSpace >= 0) { > {code} > 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.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] kinow commented on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …
kinow commented on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#issuecomment-524588806 I think you need to include tests for this change. See the bot comment about coverage decreasing, and a comment I've added about the missing test for the bug you described here. 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 With regards, Apache Git Services
[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=300783&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300783 ] ASF GitHub Bot logged work on LANG-1480: Author: ASF GitHub Bot Created on: 24/Aug/19 23:49 Start Date: 24/Aug/19 23:49 Worklog Time Spent: 10m Work Description: kinow commented on issue #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#issuecomment-524588806 I think you need to include tests for this change. See the bot comment about coverage decreasing, and a comment I've added about the missing test for the bug you described here. 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: 300783) Remaining Estimate: 23h 10m (was: 23h 20m) Time Spent: 50m (was: 40m) > 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 >Priority: Major > Original Estimate: 24h > Time Spent: 50m > Remaining Estimate: 23h 10m > > 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)
[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=300781&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300781 ] ASF GitHub Bot logged work on LANG-1480: Author: ASF GitHub Bot Created on: 24/Aug/19 23:48 Start Date: 24/Aug/19 23:48 Worklog Time Spent: 10m Work Description: kinow commented on pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317377567 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -178,8 +179,22 @@ public void test_getAbbreviatedName_Class_ZeroLen() { @Test public void test_getAbbreviatedName_String() { assertEquals("", ClassUtils.getAbbreviatedName((String) null, 1)); +assertEquals("", ClassUtils.getAbbreviatedName("", 1)); assertEquals("WithoutPackage", ClassUtils.getAbbreviatedName("WithoutPackage", 1)); assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", 1)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("org.apache.commons.lang3.ClassUtils", 18)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("o.a.c.l.ClassUtils", 18)); +assertEquals("o..c.l.ClassUtils", ClassUtils.getAbbreviatedName("o..c.l.ClassUtils", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 1)); +assertEquals("..", ClassUtils.getAbbreviatedName("..", 1)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 2)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 3)); +assertEquals("java.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", Integer.MAX_VALUE)); +assertEquals("j.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length() - 1)); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length() - 1)); Review comment: I think you are not testing the bug you found? There is no test for a call to `getAbbreviatedName` with class name as a `String`, and length as the exact length of that `String`. 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: 300781) Remaining Estimate: 23.5h (was: 23h 40m) Time Spent: 0.5h (was: 20m) > 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 >Priority: Major > Original Estimate: 24h > Time Spent: 0.5h > Remaining Estimate: 23.5h > > 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)
[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=300782&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300782 ] ASF GitHub Bot logged work on LANG-1480: Author: ASF GitHub Bot Created on: 24/Aug/19 23:48 Start Date: 24/Aug/19 23:48 Worklog Time Spent: 10m Work Description: kinow commented on pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317377606 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -433,11 +432,13 @@ public static String getAbbreviatedName(final Class cls, final int len) { * "java.lang.String" 5"j.l.String" * "java.lang.String"15"j.lang.String" * "java.lang.String"30"java.lang.String" + * "org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils" * * @param className the className to get the abbreviated name for, may be {@code null} * @param len the desired length of the abbreviated name - * @return the abbreviated name or an empty string - * @throws IllegalArgumentException if len <= 0 + * @return the abbreviated name or an empty string if the specified + * class name is {@code null} or empty string + * @throws IllegalArgumentException if {@code len <= 0} Review comment: Thanks for updating the docs! 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: 300782) Remaining Estimate: 23h 20m (was: 23.5h) Time Spent: 40m (was: 0.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 >Priority: Major > Original Estimate: 24h > Time Spent: 40m > Remaining Estimate: 23h 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)
[jira] [Work logged] (LANG-1480) ClassUtils. getAbbreviatedName(String ,int) returns too long result
[ https://issues.apache.org/jira/browse/LANG-1480?focusedWorklogId=300780&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-300780 ] ASF GitHub Bot logged work on LANG-1480: Author: ASF GitHub Bot Created on: 24/Aug/19 23:48 Start Date: 24/Aug/19 23:48 Worklog Time Spent: 10m Work Description: kinow commented on pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317376951 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -16,19 +16,11 @@ */ package org.apache.commons.lang3; +import org.apache.commons.lang3.mutable.MutableObject; + import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang3.mutable.MutableObject; +import java.util.*; Review comment: This won't pass checkstyle I think. You will need to replace the `*` by explicit imports. See Travis builds failing, this part is due to this change: >[ERROR] src/main/java/org/apache/commons/lang3/ClassUtils.java:[23] (imports) AvoidStarImport: Using the '.*' form of import should be avoided - java.util.*. 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: 300780) Remaining Estimate: 23.5h (was: 23h 40m) Time Spent: 0.5h (was: 20m) > 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 >Priority: Major > Original Estimate: 24h > Time Spent: 0.5h > Remaining Estimate: 23.5h > > 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)
[GitHub] [commons-lang] kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …
kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317376951 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -16,19 +16,11 @@ */ package org.apache.commons.lang3; +import org.apache.commons.lang3.mutable.MutableObject; + import java.lang.reflect.Method; import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang3.mutable.MutableObject; +import java.util.*; Review comment: This won't pass checkstyle I think. You will need to replace the `*` by explicit imports. See Travis builds failing, this part is due to this change: >[ERROR] src/main/java/org/apache/commons/lang3/ClassUtils.java:[23] (imports) AvoidStarImport: Using the '.*' form of import should be avoided - java.util.*. 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …
kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317377606 ## File path: src/main/java/org/apache/commons/lang3/ClassUtils.java ## @@ -433,11 +432,13 @@ public static String getAbbreviatedName(final Class cls, final int len) { * "java.lang.String" 5"j.l.String" * "java.lang.String"15"j.lang.String" * "java.lang.String"30"java.lang.String" + * "org.apache.commons.lang3.ClassUtils"18"o.a.c.l.ClassUtils" * * @param className the className to get the abbreviated name for, may be {@code null} * @param len the desired length of the abbreviated name - * @return the abbreviated name or an empty string - * @throws IllegalArgumentException if len <= 0 + * @return the abbreviated name or an empty string if the specified + * class name is {@code null} or empty string + * @throws IllegalArgumentException if {@code len <= 0} Review comment: Thanks for updating the docs! 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length …
kinow commented on a change in pull request #446: LANG-1480 getAbbreviatedName refactored to create appropriate length … URL: https://github.com/apache/commons-lang/pull/446#discussion_r317377567 ## File path: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java ## @@ -178,8 +179,22 @@ public void test_getAbbreviatedName_Class_ZeroLen() { @Test public void test_getAbbreviatedName_String() { assertEquals("", ClassUtils.getAbbreviatedName((String) null, 1)); +assertEquals("", ClassUtils.getAbbreviatedName("", 1)); assertEquals("WithoutPackage", ClassUtils.getAbbreviatedName("WithoutPackage", 1)); assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", 1)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("org.apache.commons.lang3.ClassUtils", 18)); +assertEquals("o.a.c.l.ClassUtils", ClassUtils.getAbbreviatedName("o.a.c.l.ClassUtils", 18)); +assertEquals("o..c.l.ClassUtils", ClassUtils.getAbbreviatedName("o..c.l.ClassUtils", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 18)); +assertEquals(".", ClassUtils.getAbbreviatedName(".", 1)); +assertEquals("..", ClassUtils.getAbbreviatedName("..", 1)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 2)); +assertEquals("...", ClassUtils.getAbbreviatedName("...", 3)); +assertEquals("java.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", Integer.MAX_VALUE)); +assertEquals("j.lang.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.lang.String".length() - 1)); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length())); +assertEquals("j.l.String", ClassUtils.getAbbreviatedName("java.lang.String", "j.l.String".length() - 1)); Review comment: I think you are not testing the bug you found? There is no test for a call to `getAbbreviatedName` with class name as a `String`, and length as the exact length of that `String`. 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 With regards, Apache Git Services
[jira] [Updated] (LANG-1478) ClassUtils getAbbreviatedName uses len one character shorter
[ https://issues.apache.org/jira/browse/LANG-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bruno P. Kinoshita updated LANG-1478: - Assignee: Bruno P. Kinoshita > ClassUtils getAbbreviatedName uses len one character shorter > > > Key: LANG-1478 > URL: https://issues.apache.org/jira/browse/LANG-1478 > Project: Commons Lang > Issue Type: Bug >Affects Versions: 3.9 >Reporter: Peter Verhas >Assignee: Bruno P. Kinoshita >Priority: Minor > Time Spent: 0.5h > Remaining Estimate: 0h > > The {{ClassUtils}} method {{getAbbreviatedName}} calculates the required > lenght one character short. That way > {code} > final String ANY_CLASS_FULL_NAME = ""; > assertEquals("ANY_CLASS_FULL_NAME ", > ClassUtils.getAbbreviatedName(ANY_CLASS_FULL_NAME , ANY_CLASS_FULL_NAME > .length())); > {code} > will abbreviate the class name, although we are asking exactly the same > number of characters as they are there. The solution is that > {code} > if (availableSpace > 0) { > {code} > has to be modified to > {code} > if (availableSpace >= 0) { > {code} > 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.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Updated] (LANG-1478) ClassUtils getAbbreviatedName uses len one character shorter
[ https://issues.apache.org/jira/browse/LANG-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Bruno P. Kinoshita updated LANG-1478: - Affects Version/s: 3.9 > ClassUtils getAbbreviatedName uses len one character shorter > > > Key: LANG-1478 > URL: https://issues.apache.org/jira/browse/LANG-1478 > Project: Commons Lang > Issue Type: Bug >Affects Versions: 3.9 >Reporter: Peter Verhas >Priority: Minor > Time Spent: 0.5h > Remaining Estimate: 0h > > The {{ClassUtils}} method {{getAbbreviatedName}} calculates the required > lenght one character short. That way > {code} > final String ANY_CLASS_FULL_NAME = ""; > assertEquals("ANY_CLASS_FULL_NAME ", > ClassUtils.getAbbreviatedName(ANY_CLASS_FULL_NAME , ANY_CLASS_FULL_NAME > .length())); > {code} > will abbreviate the class name, although we are asking exactly the same > number of characters as they are there. The solution is that > {code} > if (availableSpace > 0) { > {code} > has to be modified to > {code} > if (availableSpace >= 0) { > {code} > 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.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (LANG-1478) ClassUtils getAbbreviatedName uses len one character shorter
[ https://issues.apache.org/jira/browse/LANG-1478?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16915106#comment-16915106 ] Bruno P. Kinoshita commented on LANG-1478: -- Oh, I see what you mean. {code:java} System.out.println(ClassUtils.getAbbreviatedName("ab.de.Ghij", className.length())); // 10 // prints a.de.Ghij {code} So when you get the abbreviated name passing the exact length of the class name, it is indeed one character short. I agree it is annoying having to use `className.length() + 1`... but I suspect we could have some users using it. I will approve the PR, but will ask in the mailing list before merging it first, to check whether we will need to wait for a major release - as this could break someone else's code. > ClassUtils getAbbreviatedName uses len one character shorter > > > Key: LANG-1478 > URL: https://issues.apache.org/jira/browse/LANG-1478 > Project: Commons Lang > Issue Type: Bug >Reporter: Peter Verhas >Priority: Minor > Time Spent: 0.5h > Remaining Estimate: 0h > > The {{ClassUtils}} method {{getAbbreviatedName}} calculates the required > lenght one character short. That way > {code} > final String ANY_CLASS_FULL_NAME = ""; > assertEquals("ANY_CLASS_FULL_NAME ", > ClassUtils.getAbbreviatedName(ANY_CLASS_FULL_NAME , ANY_CLASS_FULL_NAME > .length())); > {code} > will abbreviate the class name, although we are asking exactly the same > number of characters as they are there. The solution is that > {code} > if (availableSpace > 0) { > {code} > has to be modified to > {code} > if (availableSpace >= 0) { > {code} > 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.) -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] kinow merged pull request #439: Improvement JavaVersion get method
kinow merged pull request #439: Improvement JavaVersion get method URL: https://github.com/apache/commons-lang/pull/439 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 With regards, Apache Git Services
[GitHub] [commons-lang] kinow merged pull request #425: RandomUtils : comment error
kinow merged pull request #425: RandomUtils : comment error URL: https://github.com/apache/commons-lang/pull/425 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 With regards, Apache Git Services
[jira] [Resolved] (JEXL-312) @NoJexl fails to disallow method call
[ https://issues.apache.org/jira/browse/JEXL-312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Biestro resolved JEXL-312. Resolution: Fixed Changeset: 71d185007d8ba0a935fe4ac084822784a19bcffa Author:henrib Date: 2019-08-24 15:47 Message: JEXL-312: create explicit cache miss entry when method is disallowed by @NoJexl > @NoJexl fails to disallow method call > - > > Key: JEXL-312 > URL: https://issues.apache.org/jira/browse/JEXL-312 > Project: Commons JEXL > Issue Type: Bug >Affects Versions: 3.1 >Reporter: Henri Biestro >Assignee: Henri Biestro >Priority: Critical > Fix For: 3.2 > > > When a method is overriden through a class hierarchy, the @NoJexl annotation > fails and lets a user call a method that should not be permitted. > -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Created] (JEXL-312) @NoJexl fails to disallow method call
Henri Biestro created JEXL-312: -- Summary: @NoJexl fails to disallow method call Key: JEXL-312 URL: https://issues.apache.org/jira/browse/JEXL-312 Project: Commons JEXL Issue Type: Bug Affects Versions: 3.1 Reporter: Henri Biestro Assignee: Henri Biestro Fix For: 3.2 When a method is overriden through a class hierarchy, the @NoJexl annotation fails and lets a user call a method that should not be permitted. -- This message was sent by Atlassian Jira (v8.3.2#803003)
[jira] [Commented] (MATH-1490) Percentile computational accuracy issue
[ https://issues.apache.org/jira/browse/MATH-1490?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16914937#comment-16914937 ] Gilles commented on MATH-1490: -- I've done it. So: {noformat} $ git diff MATH_3_3 MATH_3_4 -- src/main/java/org/apache/commons/math3/stat/descriptive/rank/Percentile.java {noformat} displays a large number of changes between v3.3 and v3.4 (in order to add new features). I'm not too surprised that this could entail a 1e-15 relative change of the output. Moreover, the unit tests show an expected level of precision much lower than that (although I admit that it's not clear why). {quote}it breaks my existing code. I got an incompatible error. {quote} Could you elaborate a little? > Percentile computational accuracy issue > --- > > Key: MATH-1490 > URL: https://issues.apache.org/jira/browse/MATH-1490 > Project: Commons Math > Issue Type: Bug >Affects Versions: 3.4, 3.4.1, 3.5, 3.6, 3.6.1 > Environment: System: Linux testinglab 4.4.0-131-generic > #157~14.04.1-Ubuntu > Java version "1.8.0_191" > Java(TM) SE Runtime Environment (build 1.8.0_191-b12) > Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode) > > >Reporter: xia0c >Assignee: Rob Tompkins >Priority: Major > Labels: performance > Attachments: BugDemo.java > > > The percentile method works well on the older versions, e.g., the version > before 3.4. However, when I update commons-math to the newer version, there > produces a computational accuracy issue. There is a backward compatibility > bug behind it. -- This message was sent by Atlassian Jira (v8.3.2#803003)
[GitHub] [commons-lang] dimitrovchi commented on issue #437: Add GenericArrayType support to TypeUtils.containsTypeVariables
dimitrovchi commented on issue #437: Add GenericArrayType support to TypeUtils.containsTypeVariables URL: https://github.com/apache/commons-lang/pull/437#issuecomment-524529307 The same **false-positive** build failure happened to https://travis-ci.org/apache/commons-lang/jobs/575873214 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 With regards, Apache Git Services
[GitHub] [commons-lang] dimitrovchi commented on issue #437: Add GenericArrayType support to TypeUtils.containsTypeVariables
dimitrovchi commented on issue #437: Add GenericArrayType support to TypeUtils.containsTypeVariables URL: https://github.com/apache/commons-lang/pull/437#issuecomment-524529097 I've added the test: https://github.com/apache/commons-lang/pull/437/files Please look at CI logs again: the logs show checkstyle rules violations in `Functions.java` but I didn't change that file: ``` [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[148] (javadoc) JavadocMethod: Expected @return tag. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[148,59] (javadoc) JavadocMethod: Expected @param tag for 'pRunnable'. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[149,5] (whitespace) FileTabCharacter: File contains tab characters (this is the first instance). [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[161] (javadoc) JavadocMethod: Expected @return tag. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[161,20] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[161,64] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[161,68] (javadoc) JavadocMethod: Expected @param tag for 'pConsumer'. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[174] (javadoc) JavadocMethod: Expected @return tag. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[174,20] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[174,64] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[174,68] (javadoc) JavadocMethod: Expected @param tag for 'pCallable'. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187] (javadoc) JavadocMethod: Expected @return tag. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187,20] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187,22] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187,23] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187,40] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187,79] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187,82] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[187,86] (javadoc) JavadocMethod: Expected @param tag for 'pConsumer'. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200] (javadoc) JavadocMethod: Expected @return tag. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200,20] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200,21] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200,22] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200,35] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200,68] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200,70] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[200,74] (javadoc) JavadocMethod: Expected @param tag for 'pFunction'. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213] (javadoc) JavadocMethod: Expected @return tag. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213,20] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213,22] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213,23] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213,25] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213,26] (javadoc) JavadocMethod: Expected @param tag for ''. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213,42] (whitespace) WhitespaceAfter: ',' is not followed by whitespace. [ERROR] src/main/java/org/apache/commons/lang3/Functions.java:[213