[GitHub] [commons-io] garydgregory merged pull request #177: Minor improvements
garydgregory merged pull request #177: URL: https://github.com/apache/commons-io/pull/177 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527451&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527451 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 23/Dec/20 01:26 Start Date: 23/Dec/20 01:26 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547590065 ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -195,6 +196,7 @@ static int lastIndexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: sorry. my fault for mixing. 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: 527451) Time Spent: 2.5h (was: 2h 20m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 2.5h > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #682: [LANG-1631] - Check if Character is defined
arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547590065 ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -195,6 +196,7 @@ static int lastIndexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: sorry. my fault for mixing. 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527450&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527450 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 23/Dec/20 01:25 Start Date: 23/Dec/20 01:25 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547589700 ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -195,6 +196,7 @@ static int lastIndexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: ah, I see, this is a new line, and the other mods are updates. ok, I'll take a look tomorrow probably... 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: 527450) Time Spent: 2h 20m (was: 2h 10m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 2h 20m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] garydgregory commented on a change in pull request #682: [LANG-1631] - Check if Character is defined
garydgregory commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547589700 ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -195,6 +196,7 @@ static int lastIndexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: ah, I see, this is a new line, and the other mods are updates. ok, I'll take a look tomorrow probably... 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
[GitHub] [commons-io] coveralls commented on pull request #177: Minor improvement:
coveralls commented on pull request #177: URL: https://github.com/apache/commons-io/pull/177#issuecomment-749833218 [![Coverage Status](https://coveralls.io/builds/35904089/badge)](https://coveralls.io/builds/35904089) Coverage remained the same at 88.637% when pulling **1f7efc2eb0d5dfb3cbbb46aa4267e7388a2bc099 on arturobernalg:feature/minor_improvement** into **d27ef15251242febe1558902a04e417b546ff8b7 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
[GitHub] [commons-io] arturobernalg opened a new pull request #177: Minor improvement:
arturobernalg opened a new pull request #177: URL: https://github.com/apache/commons-io/pull/177 * Unnecessary conversion to String * Add final * Use Standard Charset object * Redundant 'close()' 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527372&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527372 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 21:22 Start Date: 22/Dec/20 21:22 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547511368 ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -109,6 +109,7 @@ static int indexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: idem @garydgregory ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -195,6 +196,7 @@ static int lastIndexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: mm . Maybe it's my fault. The idea it's exit the loop and return -1 (NOT_FOUND) if not found the charset 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: 527372) Time Spent: 2h 10m (was: 2h) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 2h 10m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #682: [LANG-1631] - Check if Character is defined
arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547511368 ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -109,6 +109,7 @@ static int indexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: idem @garydgregory ## File path: src/main/java/org/apache/commons/lang3/CharSequenceUtils.java ## @@ -195,6 +196,7 @@ static int lastIndexOf(final CharSequence cs, final int searchChar, int start) { return i; } } +return NOT_FOUND; Review comment: mm . Maybe it's my fault. The idea it's exit the loop and return -1 (NOT_FOUND) if not found the charset 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
[jira] [Resolved] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary D. Gregory resolved LANG-1544. --- Fix Version/s: 3.12 Resolution: Fixed [~nagy_peter] In git master; please verify and close this ticket. > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Fix For: 3.12 > > Time Spent: 3h 40m > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527345&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527345 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 20:12 Start Date: 22/Dec/20 20:12 Worklog Time Spent: 10m Work Description: garydgregory merged pull request #680: URL: https://github.com/apache/commons-lang/pull/680 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: 527345) Time Spent: 3h 40m (was: 3.5h) > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 3h 40m > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] garydgregory merged pull request #680: [LANG-1544] MethodUtils.invokeMethod NullPointerException in case of null in args list
garydgregory merged pull request #680: URL: https://github.com/apache/commons-lang/pull/680 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527343&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527343 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 20:10 Start Date: 22/Dec/20 20:10 Worklog Time Spent: 10m Work Description: garydgregory removed a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749752800 @arturobernalg Now, I'm confused. There are now no changes here for "Check if Character is defined". 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: 527343) Time Spent: 2h (was: 1h 50m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 2h > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] garydgregory removed a comment on pull request #682: [LANG-1631] - Check if Character is defined
garydgregory removed a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749752800 @arturobernalg Now, I'm confused. There are now no changes here for "Check if Character is defined". 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527342&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527342 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 20:09 Start Date: 22/Dec/20 20:09 Worklog Time Spent: 10m Work Description: garydgregory commented on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749752800 @arturobernalg Now, I'm confused. There are now no changes here for "Check if Character is defined". 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: 527342) Time Spent: 1h 50m (was: 1h 40m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 1h 50m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] garydgregory commented on pull request #682: [LANG-1631] - Check if Character is defined
garydgregory commented on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749752800 @arturobernalg Now, I'm confused. There are now no changes here for "Check if Character is defined". 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
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527305&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527305 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 18:13 Start Date: 22/Dec/20 18:13 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #680: URL: https://github.com/apache/commons-lang/pull/680#issuecomment-749221904 [![Coverage Status](https://coveralls.io/builds/35897811/badge)](https://coveralls.io/builds/35897811) Coverage increased (+0.003%) to 95.02% when pulling **dcc01d911c1f0433f49123ef15873e386b5d45a8 on mdbuck77:LANG-1544_MethodUtils_Throws_NPE** into **c9e825e823e30c5b1e3ddc9de5e8fd0094d52ee5 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 Issue Time Tracking --- Worklog Id: (was: 527305) Time Spent: 3.5h (was: 3h 20m) > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 3.5h > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527306&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527306 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 18:13 Start Date: 22/Dec/20 18:13 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35897806/badge)](https://coveralls.io/builds/35897806) Coverage increased (+0.0006%) to 95.015% when pulling **599fefad2712e0f1019b2bceecce0da74716201a on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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 Issue Time Tracking --- Worklog Id: (was: 527306) Time Spent: 1h 40m (was: 1.5h) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 1h 40m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls edited a comment on pull request #682: [LANG-1631] - Check if Character is defined
coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35897806/badge)](https://coveralls.io/builds/35897806) Coverage increased (+0.0006%) to 95.015% when pulling **599fefad2712e0f1019b2bceecce0da74716201a on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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
[GitHub] [commons-lang] coveralls edited a comment on pull request #680: [LANG-1544] MethodUtils.invokeMethod NullPointerException in case of null in args list
coveralls edited a comment on pull request #680: URL: https://github.com/apache/commons-lang/pull/680#issuecomment-749221904 [![Coverage Status](https://coveralls.io/builds/35897811/badge)](https://coveralls.io/builds/35897811) Coverage increased (+0.003%) to 95.02% when pulling **dcc01d911c1f0433f49123ef15873e386b5d45a8 on mdbuck77:LANG-1544_MethodUtils_Throws_NPE** into **c9e825e823e30c5b1e3ddc9de5e8fd0094d52ee5 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
[jira] [Work logged] (LANG-1409) Crashes when testing StringUtils and CharSequenceUtils
[ https://issues.apache.org/jira/browse/LANG-1409?focusedWorklogId=527290&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527290 ] ASF GitHub Bot logged work on LANG-1409: Author: ASF GitHub Bot Created on: 22/Dec/20 17:19 Start Date: 22/Dec/20 17:19 Worklog Time Spent: 10m Work Description: subhamgupta26 closed pull request #676: URL: https://github.com/apache/commons-lang/pull/676 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: 527290) Time Spent: 40m (was: 0.5h) > Crashes when testing StringUtils and CharSequenceUtils > -- > > Key: LANG-1409 > URL: https://issues.apache.org/jira/browse/LANG-1409 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Affects Versions: 3.7 > Environment: Ubuntu 16.04.4 LTS, and McOs High Sierra-10.13.5 > Junit-4.12 >Reporter: Mozhan Soltani >Priority: Major > Labels: test > Attachments: CharSequenceUtilsTests.java, StringUtilsTests.java > > Time Spent: 40m > Remaining Estimate: 0h > > The attached test suites for {{org.apache.commons.lang3.StringUtils.java}} > and {{org.apache.commons.lang3.CharSequenceUtils.java}} come from a prototype > I have been working on which combines static analysis and automated test > generation. > The prototype analyses a specified dependency of a project to identify risky > API calls which may potentially lead to runtime exceptions. Runtime > exceptions may occur either because > # an API lacks sufficient documentation,or > # usage of the API does not conform to the specification, or > # API wrapper does not indicate the API specification as part of its own > specification. > The prototype then automatically generates test cases which show how such > exceptions may be triggered. > *Observation:* > For {{commons-lang}}, {{JDK APIs}} were analyzed. It seems that the failing > methods do not handle the potential runtime exceptions which may or may not > have been declared/documented for the JDK APIs they invoke. > *Possible fixes:* > # The failing methods under test could add internal checks on the values > they forward to the {{JDK APIs}}. > # The failing methods could handle the exceptions by adding relevant > try/catch blocks. > # The failing methods under test could specify the potential exceptions by > adding {{@throws}} in their documentation/method signatures. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] subhamgupta26 closed pull request #676: LANG-1409 StringUtils fix for null Locale
subhamgupta26 closed pull request #676: URL: https://github.com/apache/commons-lang/pull/676 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527289&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527289 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 17:18 Start Date: 22/Dec/20 17:18 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547399966 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: mmm - The parentheses was a mistake - The Character in the test there are not valid unicode values - I'll change the test for --> CharBuffer.wrap(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: 527289) Time Spent: 1.5h (was: 1h 20m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 1.5h > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #682: [LANG-1631] - Check if Character is defined
arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547399966 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: mmm - The parentheses was a mistake - The Character in the test there are not valid unicode values - I'll change the test for --> CharBuffer.wrap(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
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527285&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527285 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 17:11 Start Date: 22/Dec/20 17:11 Worklog Time Spent: 10m Work Description: mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547396391 ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getName()) && -Objects.deepEquals(parameterTypes, method.getParameterTypes())) { +for (Method method : methods) { +if (Arrays.deepEquals(method.getParameterTypes(), parameterTypes)) { return method; -} else if (methodName.equals(method.getName()) && -ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { -if ((inexactMatch == null) || (distance(parameterTypes, method.getParameterTypes()) -< distance(parameterTypes, inexactMatch.getParameterTypes( { -inexactMatch = method; -} } +} + +final TreeMap> candidates = new TreeMap<>(); +methods.stream() +.filter(method -> ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) +.forEach(method -> { +final double distance = distance(parameterTypes, method.getParameterTypes()); +List methods1 = candidates.computeIfAbsent(distance, k -> new ArrayList<>()); +methods1.add(method); +}); + +if (candidates.isEmpty()) { +return null; } -return inexactMatch; + +final List bestCandidates = candidates.values().iterator().next(); +if (bestCandidates.size() == 1) { +return bestCandidates.get(0); +} + +final String target = methodName + Arrays.stream(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")); +final String strCandidates = bestCandidates.stream().map(Method::toString).collect(Collectors.joining("\n ")); +throw new IllegalStateException("Found multiple candidates for method " + target + " on class " + cls + ":\n " + strCandidates); } /** * Returns the aggregate number of inheritance hops between assignable argument class types. Returns -1 * if the arguments aren't assignable. Fills a specific purpose for getMatchingMethod and is not generalized. - * @param classArray - * @param toClassArray + * @param classArray the Class array to calculate the distance from. Review comment: Good suggestion. Done. Michael 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: 527285) Time Spent: 3h 20m (was: 3h 10m) > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 3h 20m > Rem
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527282&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527282 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 17:10 Start Date: 22/Dec/20 17:10 Worklog Time Spent: 10m Work Description: mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547395975 ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getName()) && -Objects.deepEquals(parameterTypes, method.getParameterTypes())) { +for (Method method : methods) { +if (Arrays.deepEquals(method.getParameterTypes(), parameterTypes)) { return method; -} else if (methodName.equals(method.getName()) && -ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { -if ((inexactMatch == null) || (distance(parameterTypes, method.getParameterTypes()) -< distance(parameterTypes, inexactMatch.getParameterTypes( { -inexactMatch = method; -} } +} + +final TreeMap> candidates = new TreeMap<>(); +methods.stream() +.filter(method -> ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) +.forEach(method -> { +final double distance = distance(parameterTypes, method.getParameterTypes()); +List methods1 = candidates.computeIfAbsent(distance, k -> new ArrayList<>()); +methods1.add(method); +}); + +if (candidates.isEmpty()) { +return null; } -return inexactMatch; + +final List bestCandidates = candidates.values().iterator().next(); +if (bestCandidates.size() == 1) { +return bestCandidates.get(0); +} + +final String target = methodName + Arrays.stream(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")); +final String strCandidates = bestCandidates.stream().map(Method::toString).collect(Collectors.joining("\n ")); +throw new IllegalStateException("Found multiple candidates for method " + target + " on class " + cls + ":\n " + strCandidates); Review comment: I replaced the newlines with opening and closing brackets. Michael 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: 527282) Time Spent: 2h 50m (was: 2h 40m) > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 2h 50m > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classAr
[GitHub] [commons-lang] mdbuck77 commented on a change in pull request #680: [LANG-1544] MethodUtils.invokeMethod NullPointerException in case of null in args list
mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547396391 ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getName()) && -Objects.deepEquals(parameterTypes, method.getParameterTypes())) { +for (Method method : methods) { +if (Arrays.deepEquals(method.getParameterTypes(), parameterTypes)) { return method; -} else if (methodName.equals(method.getName()) && -ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { -if ((inexactMatch == null) || (distance(parameterTypes, method.getParameterTypes()) -< distance(parameterTypes, inexactMatch.getParameterTypes( { -inexactMatch = method; -} } +} + +final TreeMap> candidates = new TreeMap<>(); +methods.stream() +.filter(method -> ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) +.forEach(method -> { +final double distance = distance(parameterTypes, method.getParameterTypes()); +List methods1 = candidates.computeIfAbsent(distance, k -> new ArrayList<>()); +methods1.add(method); +}); + +if (candidates.isEmpty()) { +return null; } -return inexactMatch; + +final List bestCandidates = candidates.values().iterator().next(); +if (bestCandidates.size() == 1) { +return bestCandidates.get(0); +} + +final String target = methodName + Arrays.stream(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")); +final String strCandidates = bestCandidates.stream().map(Method::toString).collect(Collectors.joining("\n ")); +throw new IllegalStateException("Found multiple candidates for method " + target + " on class " + cls + ":\n " + strCandidates); } /** * Returns the aggregate number of inheritance hops between assignable argument class types. Returns -1 * if the arguments aren't assignable. Fills a specific purpose for getMatchingMethod and is not generalized. - * @param classArray - * @param toClassArray + * @param classArray the Class array to calculate the distance from. Review comment: Good suggestion. Done. Michael 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
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527283&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527283 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 17:10 Start Date: 22/Dec/20 17:10 Worklog Time Spent: 10m Work Description: mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547396104 ## File path: src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java ## @@ -1018,4 +1019,83 @@ public void testDistance() throws Exception { distanceMethod.setAccessible(false); } + +@Test +public void testGetMatchingMethod() throws NoSuchMethodException { + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod"), +GetMatchingMethodClass.class.getMethod("testMethod")); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod", Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.class), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", (Class) null), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod2", (Class) null)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, Long.class), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.class, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", null, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, null), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod4", null, null)); +} + +private static final class GetMatchingMethodClass { +public String testMethod() { +return "testMethod"; +} + +public String testMethod(Long aLong) { Review comment: Done. Michael 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: 527283) Time Spent: 3h (was: 2h 50m) > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 3h > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527284&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527284 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 17:10 Start Date: 22/Dec/20 17:10 Worklog Time Spent: 10m Work Description: mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547396204 ## File path: src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java ## @@ -1018,4 +1019,83 @@ public void testDistance() throws Exception { distanceMethod.setAccessible(false); } + +@Test +public void testGetMatchingMethod() throws NoSuchMethodException { + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod"), +GetMatchingMethodClass.class.getMethod("testMethod")); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod", Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.class), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", (Class) null), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod2", (Class) null)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, Long.class), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.class, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", null, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, null), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod4", null, null)); +} + +private static final class GetMatchingMethodClass { Review comment: Done. Michael 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: 527284) Time Spent: 3h 10m (was: 3h) > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 3h 10m > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] mdbuck77 commented on a change in pull request #680: [LANG-1544] MethodUtils.invokeMethod NullPointerException in case of null in args list
mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547396204 ## File path: src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java ## @@ -1018,4 +1019,83 @@ public void testDistance() throws Exception { distanceMethod.setAccessible(false); } + +@Test +public void testGetMatchingMethod() throws NoSuchMethodException { + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod"), +GetMatchingMethodClass.class.getMethod("testMethod")); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod", Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.class), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", (Class) null), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod2", (Class) null)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, Long.class), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.class, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", null, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, null), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod4", null, null)); +} + +private static final class GetMatchingMethodClass { Review comment: Done. Michael 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
[GitHub] [commons-lang] mdbuck77 commented on a change in pull request #680: [LANG-1544] MethodUtils.invokeMethod NullPointerException in case of null in args list
mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547396104 ## File path: src/test/java/org/apache/commons/lang3/reflect/MethodUtilsTest.java ## @@ -1018,4 +1019,83 @@ public void testDistance() throws Exception { distanceMethod.setAccessible(false); } + +@Test +public void testGetMatchingMethod() throws NoSuchMethodException { + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod"), +GetMatchingMethodClass.class.getMethod("testMethod")); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod", Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", Long.class), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod", (Class) null), +GetMatchingMethodClass.class.getMethod("testMethod", Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod2", (Class) null)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, Long.class), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.class, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", null, Long.TYPE), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.class, Long.TYPE)); + + assertEquals(MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod3", Long.TYPE, null), +GetMatchingMethodClass.class.getMethod("testMethod3", Long.TYPE, Long.class)); + +assertThrows(IllegalStateException.class, +() -> MethodUtils.getMatchingMethod(GetMatchingMethodClass.class, "testMethod4", null, null)); +} + +private static final class GetMatchingMethodClass { +public String testMethod() { +return "testMethod"; +} + +public String testMethod(Long aLong) { Review comment: Done. Michael 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
[GitHub] [commons-lang] mdbuck77 commented on a change in pull request #680: [LANG-1544] MethodUtils.invokeMethod NullPointerException in case of null in args list
mdbuck77 commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547395975 ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getName()) && -Objects.deepEquals(parameterTypes, method.getParameterTypes())) { +for (Method method : methods) { +if (Arrays.deepEquals(method.getParameterTypes(), parameterTypes)) { return method; -} else if (methodName.equals(method.getName()) && -ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { -if ((inexactMatch == null) || (distance(parameterTypes, method.getParameterTypes()) -< distance(parameterTypes, inexactMatch.getParameterTypes( { -inexactMatch = method; -} } +} + +final TreeMap> candidates = new TreeMap<>(); +methods.stream() +.filter(method -> ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) +.forEach(method -> { +final double distance = distance(parameterTypes, method.getParameterTypes()); +List methods1 = candidates.computeIfAbsent(distance, k -> new ArrayList<>()); +methods1.add(method); +}); + +if (candidates.isEmpty()) { +return null; } -return inexactMatch; + +final List bestCandidates = candidates.values().iterator().next(); +if (bestCandidates.size() == 1) { +return bestCandidates.get(0); +} + +final String target = methodName + Arrays.stream(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")); +final String strCandidates = bestCandidates.stream().map(Method::toString).collect(Collectors.joining("\n ")); +throw new IllegalStateException("Found multiple candidates for method " + target + " on class " + cls + ":\n " + strCandidates); Review comment: I replaced the newlines with opening and closing brackets. Michael 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527277&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527277 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 16:59 Start Date: 22/Dec/20 16:59 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547390532 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: Hi @arturobernalg You've not answered all my question. Also why are you building the char[] one char at a time? Why not call CharBuffer.wrap(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: 527277) Time Spent: 1h 20m (was: 1h 10m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 1h 20m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Comment Edited] (JEXL-338) Release 3.2 to Maven Central
[ https://issues.apache.org/jira/browse/JEXL-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253626#comment-17253626 ] Garret Wilson edited comment on JEXL-338 at 12/22/20, 4:59 PM: --- That's exciting to hear. Thanks for the reply, [~henrib]. I might be interested in volunteering, depending on of the project meets my needs. I'd also want to push for support of newer Java features (e.g. iteration on streams and lambas, if not supported). The biggest thing I need to know first of all is if JEXL will allow for the expression {{foo.bar}} not only looking up an object in a context (e.g. {{context.getObject("foo")}}) but also using the context or some strategy to look up the property (e.g. {{context.getProperty(foo, "bar")}}). That's because my object {{foo}} is not a map and has a different way to get properties than simple reflection of getter methods. If you know the answer that let me know; otherwise I'll have to try it out. If it works let's talk more about this Release Manager. was (Author: garretwilson): That's exciting to hear. Thanks for the reply, [~henrib]. I might be interested in volunteering, depending on of the project meets my needs. I'd also want to push for support of newer Java features (e.g. iteration on streams and lambas, if not supported). The biggest thing I need to know first of all is if JEXL will allow for the expression {{foo.bar}} not only looking up an object in a context (e.g. {{context.getObject("foo")}}) but also using the context or some strategy to look up the property (e.g. {{context.getProperty(foo, "bar")}}). That's because my object {{foo}} is not a map and has a different way to get properties than simple reflection of getters. If you know the answer that let me know; otherwise I'll have to try it out. If it works let's talk more about this Release Manager. > Release 3.2 to Maven Central > > > Key: JEXL-338 > URL: https://issues.apache.org/jira/browse/JEXL-338 > Project: Commons JEXL > Issue Type: Wish > Environment: Maven, Eclipse-GIT, Maven Central. >Reporter: Sylke Soong >Priority: Critical > Labels: maven > > Similar to JEXL-220. > JEXL github homepage [https://github.com/apache/commons-jexl] recommends > {noformat} > > org.apache.commons > commons-jexl3 > 3.2 > {noformat} > But Maven central does not have it.. EGIT croaks artefact jar not foundr, > when jexl 3.2 dependency is in the pom. > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-geometry] darkma773r opened a new pull request #124: GEOMETRY-109: renaming BoundarySourceXX.from() to BoundarySourceXX.of()
darkma773r opened a new pull request #124: URL: https://github.com/apache/commons-geometry/pull/124 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
[GitHub] [commons-lang] garydgregory commented on a change in pull request #682: [LANG-1631] - Check if Character is defined
garydgregory commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547390532 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: Hi @arturobernalg You've not answered all my question. Also why are you building the char[] one char at a time? Why not call CharBuffer.wrap(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
[jira] [Commented] (JEXL-338) Release 3.2 to Maven Central
[ https://issues.apache.org/jira/browse/JEXL-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253626#comment-17253626 ] Garret Wilson commented on JEXL-338: That's exciting to hear. Thanks for the reply, [~henrib]. I might be interested in volunteering, depending on of the project meets my needs. I'd also want to push for support of newer Java features (e.g. iteration on streams and lambas, if not supported). The biggest thing I need to know first of all is if JEXL will allow for the expression {{foo.bar}} not only looking up an object in a context (e.g. {{context.getObject("foo")}}) but also using the context or some strategy to look up the property (e.g. {{context.getProperty(foo, "bar")}}). That's because my object {{foo}} is not a map and has a different way to get properties than simple reflection of getters. If you know the answer that let me know; otherwise I'll have to try it out. If it works let's talk more about this Release Manager. > Release 3.2 to Maven Central > > > Key: JEXL-338 > URL: https://issues.apache.org/jira/browse/JEXL-338 > Project: Commons JEXL > Issue Type: Wish > Environment: Maven, Eclipse-GIT, Maven Central. >Reporter: Sylke Soong >Priority: Critical > Labels: maven > > Similar to JEXL-220. > JEXL github homepage [https://github.com/apache/commons-jexl] recommends > {noformat} > > org.apache.commons > commons-jexl3 > 3.2 > {noformat} > But Maven central does not have it.. EGIT croaks artefact jar not foundr, > when jexl 3.2 dependency is in the pom. > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (JEXL-338) Release 3.2 to Maven Central
[ https://issues.apache.org/jira/browse/JEXL-338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253621#comment-17253621 ] Henri Biestro commented on JEXL-338: The project is alive (JIRA and commits). About the release, a Release Manager volunteer is still lacking. > Release 3.2 to Maven Central > > > Key: JEXL-338 > URL: https://issues.apache.org/jira/browse/JEXL-338 > Project: Commons JEXL > Issue Type: Wish > Environment: Maven, Eclipse-GIT, Maven Central. >Reporter: Sylke Soong >Priority: Critical > Labels: maven > > Similar to JEXL-220. > JEXL github homepage [https://github.com/apache/commons-jexl] recommends > {noformat} > > org.apache.commons > commons-jexl3 > 3.2 > {noformat} > But Maven central does not have it.. EGIT croaks artefact jar not foundr, > when jexl 3.2 dependency is in the pom. > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-geometry] arturobernalg commented on a change in pull request #123: Minor Improvement
arturobernalg commented on a change in pull request #123: URL: https://github.com/apache/commons-geometry/pull/123#discussion_r547384785 ## File path: commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTestUtils.java ## @@ -100,28 +96,9 @@ public static void assertSimpleEqualsCases(final Object obj) { Assertions.assertFalse(obj.equals(new Object()), "Object should not equal an instance of different type"); } -Assertions.assertTrue(obj.equals(obj), "Object should equal itself"); -} +Assertions.assertTrue(obj. -/** - * Serializes and then recovers an object from a byte array. Returns the deserialized object. - * - * @param obj object to serialize and recover - * @return the recovered, deserialized object - */ -public static Object serializeAndRecover(final Object obj) { -try { -// serialize the Object -final ByteArrayOutputStream bos = new ByteArrayOutputStream(); -final ObjectOutputStream so = new ObjectOutputStream(bos); -so.writeObject(obj); -// deserialize the Object -final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); -final ObjectInputStream si = new ObjectInputStream(bis); -return si.readObject(); -} catch (final Exception e) { -throw new RuntimeException(e); -} +equals(obj), "Object should equal itself"); Review comment: done 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
[jira] [Commented] (GEOMETRY-111) Metric interface instead of Point/Verctor interface [BREAKING CHANGE]
[ https://issues.apache.org/jira/browse/GEOMETRY-111?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253617#comment-17253617 ] Matt Juntunen commented on GEOMETRY-111: How would this affect the APIs? What would the {{Point}} and {{Vector}} interfaces look like? Can you give a before/after example of how things would be simplified? > Metric interface instead of Point/Verctor interface [BREAKING CHANGE] > - > > Key: GEOMETRY-111 > URL: https://issues.apache.org/jira/browse/GEOMETRY-111 > Project: Apache Commons Geometry > Issue Type: New Feature >Reporter: Baljit Singh >Priority: Major > > Using a Point/Vector interface (especially, the self-bounded/referencing > {{Point>}}), leads to awkward use of Java generics in > other classes. The need is understood in that it makes things "easier" within > the subclasses, but it does make other APIs and method signatures a lot more > complicated. > Instead, I would propose a {{Metric}} interface, with a single method > {{double distance(P start, P end)}}. This makes the API a lot more flexible. > For example, using the same point type ({{Vector3D}}), one can define two > metrics (Euclidean distance for Cartesian space, and angle for Spherical > space). > I understand that it is difficult to prove the usability case, but I'm > speaking from experience, having implemented both ways in other libraries. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arturo Bernal updated LANG-1631: Description: Crash when the the char to be searched value it's out of range >= '\u' <= '\u' Getting the next error --> {code:java} java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936{code} Basically the problem is that when it is verified that the character to search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of the loop. It continues searching but this time values less than or equal to Character.MAX_CODE_POINT was: Crash when the the char to be searched value it's out of range >= '\u' <= '\u' Getting the next error --> {code:java} java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936{code} > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 1h 10m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} > > > Basically the problem is that when it is verified that the character to > search is less than MIN_SUPPLEMENTARY_CODE_POINT, the search is not exited of > the loop. It continues searching but this time values less than or equal to > Character.MAX_CODE_POINT > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-geometry] darkma773r commented on a change in pull request #123: Minor Improvement
darkma773r commented on a change in pull request #123: URL: https://github.com/apache/commons-geometry/pull/123#discussion_r547379511 ## File path: commons-geometry-core/src/test/java/org/apache/commons/geometry/core/partitioning/bsp/AbstractPartitionedRegionBuilderTest.java ## @@ -38,9 +38,7 @@ public void testCtor_invalidTree() { final TestRegionBSPTree tree = new TestRegionBSPTree(true); // act/assert -GeometryTestUtils.assertThrowsWithMessage(() -> { -new TestRegionBuilder(tree); -}, IllegalArgumentException.class, "Tree must be empty"); +GeometryTestUtils.assertThrowsWithMessage(() -> new TestRegionBuilder(tree), IllegalArgumentException.class, "Tree must be empty"); Review comment: This comment applies to all updates of `GeometryTestUtils.assertThrowsWithMessage()`, not just this instance. 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
[GitHub] [commons-geometry] darkma773r commented on a change in pull request #123: Minor Improvement
darkma773r commented on a change in pull request #123: URL: https://github.com/apache/commons-geometry/pull/123#discussion_r547378485 ## File path: commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTestUtils.java ## @@ -100,28 +96,9 @@ public static void assertSimpleEqualsCases(final Object obj) { Assertions.assertFalse(obj.equals(new Object()), "Object should not equal an instance of different type"); } -Assertions.assertTrue(obj.equals(obj), "Object should equal itself"); -} +Assertions.assertTrue(obj. -/** - * Serializes and then recovers an object from a byte array. Returns the deserialized object. - * - * @param obj object to serialize and recover - * @return the recovered, deserialized object - */ -public static Object serializeAndRecover(final Object obj) { -try { -// serialize the Object -final ByteArrayOutputStream bos = new ByteArrayOutputStream(); -final ObjectOutputStream so = new ObjectOutputStream(bos); -so.writeObject(obj); -// deserialize the Object -final ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); -final ObjectInputStream si = new ObjectInputStream(bis); -return si.readObject(); -} catch (final Exception e) { -throw new RuntimeException(e); -} +equals(obj), "Object should equal itself"); Review comment: Remove blank lines. 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527265&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527265 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 16:33 Start Date: 22/Dec/20 16:33 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35895508/badge)](https://coveralls.io/builds/35895508) Coverage increased (+0.007%) to 95.022% when pulling **d21636a09afcf0739c400e01d266c00311bc5d17 on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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 Issue Time Tracking --- Worklog Id: (was: 527265) Time Spent: 1h 10m (was: 1h) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 1h 10m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls edited a comment on pull request #682: [LANG-1631] - Check if Character is defined
coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35895508/badge)](https://coveralls.io/builds/35895508) Coverage increased (+0.007%) to 95.022% when pulling **d21636a09afcf0739c400e01d266c00311bc5d17 on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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
[GitHub] [commons-geometry] darkma773r commented on a change in pull request #122: Miscellaneous (cherry-picked) improvements
darkma773r commented on a change in pull request #122: URL: https://github.com/apache/commons-geometry/pull/122#discussion_r547374247 ## File path: commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/AbstractConvexHyperplaneBoundedRegion.java ## @@ -161,7 +161,7 @@ public String toString() { */ protected > R transformInternal( final Transform transform, final R thisInstance, final Class boundaryType, -final Function, R> factory) { +final Function, R> factory) { Review comment: Okey dokey. 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
[GitHub] [commons-geometry] darkma773r commented on a change in pull request #122: Miscellaneous (cherry-picked) improvements
darkma773r commented on a change in pull request #122: URL: https://github.com/apache/commons-geometry/pull/122#discussion_r547373970 ## File path: commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Bounds3D.java ## @@ -233,7 +233,7 @@ public Builder add(final Vector3D pt) { * @param pts points to add * @return this instance */ -public Builder addAll(final Iterable pts) { +public Builder addAll(final Iterable pts) { Review comment: Users can't create their own `Vector3D` subclasses since the constructor is private. I don't see a reason to prevent use of `Iterable`, though, so I think we should go ahead with this change. 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527262&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527262 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 16:25 Start Date: 22/Dec/20 16:25 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35895329/badge)](https://coveralls.io/builds/35895329) Coverage increased (+0.0006%) to 95.015% when pulling **6efe5c5e8b8595895adcb825c5b3d802b961d88e on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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 Issue Time Tracking --- Worklog Id: (was: 527262) Time Spent: 1h (was: 50m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 1h > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls edited a comment on pull request #682: [LANG-1631] - Check if Character is defined
coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35895329/badge)](https://coveralls.io/builds/35895329) Coverage increased (+0.0006%) to 95.015% when pulling **6efe5c5e8b8595895adcb825c5b3d802b961d88e on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527259&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527259 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 16:18 Start Date: 22/Dec/20 16:18 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35895145/badge)](https://coveralls.io/builds/35895145) Coverage increased (+0.0006%) to 95.015% when pulling **6efe5c5e8b8595895adcb825c5b3d802b961d88e on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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 Issue Time Tracking --- Worklog Id: (was: 527259) Time Spent: 50m (was: 40m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 50m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls edited a comment on pull request #682: [LANG-1631] - Check if Character is defined
coveralls edited a comment on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/35895145/badge)](https://coveralls.io/builds/35895145) Coverage increased (+0.0006%) to 95.015% when pulling **6efe5c5e8b8595895adcb825c5b3d802b961d88e on arturobernalg:bugfix/LANG-1631** into **0a4505fa97ef0ff67d3b932b7e6a015a630275ac 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
[jira] [Updated] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arturo Bernal updated LANG-1631: Component/s: lang.* > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Reporter: Arturo Bernal >Priority: Major > Time Spent: 40m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (LANG-1630) NPE lowerCase and upperCase when locale is null
[ https://issues.apache.org/jira/browse/LANG-1630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253600#comment-17253600 ] Arturo Bernal commented on LANG-1630: - Yep. I saw it later. Thank you > NPE lowerCase and upperCase when locale is null > > > Key: LANG-1630 > URL: https://issues.apache.org/jira/browse/LANG-1630 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > When the parameter Local is null where are getting NPE in the following > method: > * upperCase > * lowerCase > > Add control > > {code:java} > if (locale == null) { >throw new IllegalArgumentException("Locale must not be null"); > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527256&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527256 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 16:11 Start Date: 22/Dec/20 16:11 Worklog Time Spent: 10m Work Description: arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547365219 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: HI @garydgregory sorry for the noise. When I created the PR it seemed logical. But you're right. Better keep the PRs separate 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: 527256) Time Spent: 40m (was: 0.5h) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 40m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg commented on a change in pull request #682: [LANG-1631] - Check if Character is defined
arturobernalg commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547365219 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: HI @garydgregory sorry for the noise. When I created the PR it seemed logical. But you're right. Better keep the PRs separate 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
[jira] [Work logged] (IO-670) IOUtils.contentEquals is of low performance. I will refine it.
[ https://issues.apache.org/jira/browse/IO-670?focusedWorklogId=527253&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527253 ] ASF GitHub Bot logged work on IO-670: - Author: ASF GitHub Bot Created on: 22/Dec/20 15:58 Start Date: 22/Dec/20 15:58 Worklog Time Spent: 10m Work Description: XenoAmess commented on pull request #118: URL: https://github.com/apache/commons-io/pull/118#issuecomment-749616807 > @garydgregory Weekend now. Any news?:) ping? :) 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: 527253) Time Spent: 13h (was: 12h 50m) > IOUtils.contentEquals is of low performance. I will refine it. > -- > > Key: IO-670 > URL: https://issues.apache.org/jira/browse/IO-670 > Project: Commons IO > Issue Type: Improvement >Reporter: Jin Xu >Priority: Critical > Attachments: jmh-result.org.apache.json > > Time Spent: 13h > Remaining Estimate: 0h > > [https://github.com/apache/commons-io/pull/118] -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-io] XenoAmess commented on pull request #118: [IO-670] refine IOUtils.contentEquals(Reader, Reader)
XenoAmess commented on pull request #118: URL: https://github.com/apache/commons-io/pull/118#issuecomment-749616807 > @garydgregory Weekend now. Any news?:) ping? :) 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
[jira] [Updated] (GEOMETRY-111) Metric interface instead of Point/Verctor interface [BREAKING CHANGE]
[ https://issues.apache.org/jira/browse/GEOMETRY-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Baljit Singh updated GEOMETRY-111: -- Summary: Metric interface instead of Point/Verctor interface [BREAKING CHANGE] (was: Metric interface instead of Point interface [BREAKING CHANGE]) > Metric interface instead of Point/Verctor interface [BREAKING CHANGE] > - > > Key: GEOMETRY-111 > URL: https://issues.apache.org/jira/browse/GEOMETRY-111 > Project: Apache Commons Geometry > Issue Type: New Feature >Reporter: Baljit Singh >Priority: Major > > Using a Point interface (especially, the self-bounded/referencing {{Point extends Point>}}), leads to awkward use of Java generics in other classes. > The need is understood in that it makes things "easier" within the > subclasses, but it does make other APIs and method signatures a lot more > complicated. > Instead, I would propose a {{Metric}} interface, with a single method > {{double distance(P start, P end)}}. This makes the API a lot more flexible. > For example, using the same point type ({{Vector3D}}), one can define two > metrics (Euclidean distance for Cartesian space, and angle for Spherical > space). > I understand that it is difficult to prove the usability case, but I'm > speaking from experience, having implemented both ways in other libraries. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (GEOMETRY-111) Metric interface instead of Point/Verctor interface [BREAKING CHANGE]
[ https://issues.apache.org/jira/browse/GEOMETRY-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Baljit Singh updated GEOMETRY-111: -- Description: Using a Point/Vector interface (especially, the self-bounded/referencing {{Point>}}), leads to awkward use of Java generics in other classes. The need is understood in that it makes things "easier" within the subclasses, but it does make other APIs and method signatures a lot more complicated. Instead, I would propose a {{Metric}} interface, with a single method {{double distance(P start, P end)}}. This makes the API a lot more flexible. For example, using the same point type ({{Vector3D}}), one can define two metrics (Euclidean distance for Cartesian space, and angle for Spherical space). I understand that it is difficult to prove the usability case, but I'm speaking from experience, having implemented both ways in other libraries. was: Using a Point interface (especially, the self-bounded/referencing {{Point>}}), leads to awkward use of Java generics in other classes. The need is understood in that it makes things "easier" within the subclasses, but it does make other APIs and method signatures a lot more complicated. Instead, I would propose a {{Metric}} interface, with a single method {{double distance(P start, P end)}}. This makes the API a lot more flexible. For example, using the same point type ({{Vector3D}}), one can define two metrics (Euclidean distance for Cartesian space, and angle for Spherical space). I understand that it is difficult to prove the usability case, but I'm speaking from experience, having implemented both ways in other libraries. > Metric interface instead of Point/Verctor interface [BREAKING CHANGE] > - > > Key: GEOMETRY-111 > URL: https://issues.apache.org/jira/browse/GEOMETRY-111 > Project: Apache Commons Geometry > Issue Type: New Feature >Reporter: Baljit Singh >Priority: Major > > Using a Point/Vector interface (especially, the self-bounded/referencing > {{Point>}}), leads to awkward use of Java generics in > other classes. The need is understood in that it makes things "easier" within > the subclasses, but it does make other APIs and method signatures a lot more > complicated. > Instead, I would propose a {{Metric}} interface, with a single method > {{double distance(P start, P end)}}. This makes the API a lot more flexible. > For example, using the same point type ({{Vector3D}}), one can define two > metrics (Euclidean distance for Cartesian space, and angle for Spherical > space). > I understand that it is difficult to prove the usability case, but I'm > speaking from experience, having implemented both ways in other libraries. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (GEOMETRY-111) Metric interface instead of Point interface [BREAKING CHANGE]
[ https://issues.apache.org/jira/browse/GEOMETRY-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Baljit Singh updated GEOMETRY-111: -- Description: Using a Point interface (especially, the self-bounded/referencing Point>), leads to awkward use of Java generics in other classes. The need is understood in that it makes things "easier" within the subclasses, but it does make other APIs and method signatures a lot more complicated. Instead, I would propose a {{Metric}} interface, with a single method {{double distance(P start, P end)}}. This makes the API a lot more flexible. For example, using the same point type ({{Vector3D}}), one can define two metrics (Euclidean distance for Cartesian space, and angle for Spherical space). I understand that it is difficult to prove the usability case, but I'm speaking from experience, having implemented both ways in other libraries. was: Using a Point interface (especially, the self-bounded/referencing Point>), leads to awkward use of Java generics in other classes. The need is understood in that it makes things "easier" within the subclasses, but it does make other APIs and method signatures a lot more complicated. Instead, I would propose a Metric interface, with a single method `double distance(T start, T end)`. This makes the API a lot more flexible. For example, using the same point type (Vector3D), one can define two metrics (Euclidean distance for Cartesian space, and angle for Spherical space). I understand that it is difficult to prove the usability case, but I'm speaking from experience, having implemented both ways in other libraries. > Metric interface instead of Point interface [BREAKING CHANGE] > - > > Key: GEOMETRY-111 > URL: https://issues.apache.org/jira/browse/GEOMETRY-111 > Project: Apache Commons Geometry > Issue Type: New Feature >Reporter: Baljit Singh >Priority: Major > > Using a Point interface (especially, the self-bounded/referencing Point extends Point>), leads to awkward use of Java generics in other classes. > The need is understood in that it makes things "easier" within the > subclasses, but it does make other APIs and method signatures a lot more > complicated. > Instead, I would propose a {{Metric}} interface, with a single method > {{double distance(P start, P end)}}. This makes the API a lot more flexible. > For example, using the same point type ({{Vector3D}}), one can define two > metrics (Euclidean distance for Cartesian space, and angle for Spherical > space). > I understand that it is difficult to prove the usability case, but I'm > speaking from experience, having implemented both ways in other libraries. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (GEOMETRY-111) Metric interface instead of Point interface [BREAKING CHANGE]
[ https://issues.apache.org/jira/browse/GEOMETRY-111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Baljit Singh updated GEOMETRY-111: -- Description: Using a Point interface (especially, the self-bounded/referencing {{Point>}}), leads to awkward use of Java generics in other classes. The need is understood in that it makes things "easier" within the subclasses, but it does make other APIs and method signatures a lot more complicated. Instead, I would propose a {{Metric}} interface, with a single method {{double distance(P start, P end)}}. This makes the API a lot more flexible. For example, using the same point type ({{Vector3D}}), one can define two metrics (Euclidean distance for Cartesian space, and angle for Spherical space). I understand that it is difficult to prove the usability case, but I'm speaking from experience, having implemented both ways in other libraries. was: Using a Point interface (especially, the self-bounded/referencing Point>), leads to awkward use of Java generics in other classes. The need is understood in that it makes things "easier" within the subclasses, but it does make other APIs and method signatures a lot more complicated. Instead, I would propose a {{Metric}} interface, with a single method {{double distance(P start, P end)}}. This makes the API a lot more flexible. For example, using the same point type ({{Vector3D}}), one can define two metrics (Euclidean distance for Cartesian space, and angle for Spherical space). I understand that it is difficult to prove the usability case, but I'm speaking from experience, having implemented both ways in other libraries. > Metric interface instead of Point interface [BREAKING CHANGE] > - > > Key: GEOMETRY-111 > URL: https://issues.apache.org/jira/browse/GEOMETRY-111 > Project: Apache Commons Geometry > Issue Type: New Feature >Reporter: Baljit Singh >Priority: Major > > Using a Point interface (especially, the self-bounded/referencing {{Point extends Point>}}), leads to awkward use of Java generics in other classes. > The need is understood in that it makes things "easier" within the > subclasses, but it does make other APIs and method signatures a lot more > complicated. > Instead, I would propose a {{Metric}} interface, with a single method > {{double distance(P start, P end)}}. This makes the API a lot more flexible. > For example, using the same point type ({{Vector3D}}), one can define two > metrics (Euclidean distance for Cartesian space, and angle for Spherical > space). > I understand that it is difficult to prove the usability case, but I'm > speaking from experience, having implemented both ways in other libraries. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Created] (GEOMETRY-111) Metric interface instead of Point interface [BREAKING CHANGE]
Baljit Singh created GEOMETRY-111: - Summary: Metric interface instead of Point interface [BREAKING CHANGE] Key: GEOMETRY-111 URL: https://issues.apache.org/jira/browse/GEOMETRY-111 Project: Apache Commons Geometry Issue Type: New Feature Reporter: Baljit Singh Using a Point interface (especially, the self-bounded/referencing Point>), leads to awkward use of Java generics in other classes. The need is understood in that it makes things "easier" within the subclasses, but it does make other APIs and method signatures a lot more complicated. Instead, I would propose a Metric interface, with a single method `double distance(T start, T end)`. This makes the API a lot more flexible. For example, using the same point type (Vector3D), one can define two metrics (Euclidean distance for Cartesian space, and angle for Spherical space). I understand that it is difficult to prove the usability case, but I'm speaking from experience, having implemented both ways in other libraries. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary D. Gregory updated LANG-1544: -- External issue URL: https://github.com/apache/commons-lang/pull/680 > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 2h 40m > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] garydgregory merged pull request #679: Correct markup in Javadoc for unbalanced braces
garydgregory merged pull request #679: URL: https://github.com/apache/commons-lang/pull/679 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
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527237&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527237 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 15:21 Start Date: 22/Dec/20 15:21 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547326472 ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getName()) && -Objects.deepEquals(parameterTypes, method.getParameterTypes())) { +for (Method method : methods) { +if (Arrays.deepEquals(method.getParameterTypes(), parameterTypes)) { return method; -} else if (methodName.equals(method.getName()) && -ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { -if ((inexactMatch == null) || (distance(parameterTypes, method.getParameterTypes()) -< distance(parameterTypes, inexactMatch.getParameterTypes( { -inexactMatch = method; -} } +} + +final TreeMap> candidates = new TreeMap<>(); +methods.stream() +.filter(method -> ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) +.forEach(method -> { +final double distance = distance(parameterTypes, method.getParameterTypes()); +List methods1 = candidates.computeIfAbsent(distance, k -> new ArrayList<>()); +methods1.add(method); +}); + +if (candidates.isEmpty()) { +return null; } -return inexactMatch; + +final List bestCandidates = candidates.values().iterator().next(); +if (bestCandidates.size() == 1) { +return bestCandidates.get(0); +} + +final String target = methodName + Arrays.stream(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")); +final String strCandidates = bestCandidates.stream().map(Method::toString).collect(Collectors.joining("\n ")); +throw new IllegalStateException("Found multiple candidates for method " + target + " on class " + cls + ":\n " + strCandidates); Review comment: Let's not hard-code Linux-specific new-line chars in error messages, but, if you really want new-lines, use `%n` with `String.format()`. ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getNam
[GitHub] [commons-lang] garydgregory commented on a change in pull request #680: [LANG-1544] MethodUtils.invokeMethod NullPointerException in case of null in args list
garydgregory commented on a change in pull request #680: URL: https://github.com/apache/commons-lang/pull/680#discussion_r547326472 ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getName()) && -Objects.deepEquals(parameterTypes, method.getParameterTypes())) { +for (Method method : methods) { +if (Arrays.deepEquals(method.getParameterTypes(), parameterTypes)) { return method; -} else if (methodName.equals(method.getName()) && -ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { -if ((inexactMatch == null) || (distance(parameterTypes, method.getParameterTypes()) -< distance(parameterTypes, inexactMatch.getParameterTypes( { -inexactMatch = method; -} } +} + +final TreeMap> candidates = new TreeMap<>(); +methods.stream() +.filter(method -> ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) +.forEach(method -> { +final double distance = distance(parameterTypes, method.getParameterTypes()); +List methods1 = candidates.computeIfAbsent(distance, k -> new ArrayList<>()); +methods1.add(method); +}); + +if (candidates.isEmpty()) { +return null; } -return inexactMatch; + +final List bestCandidates = candidates.values().iterator().next(); +if (bestCandidates.size() == 1) { +return bestCandidates.get(0); +} + +final String target = methodName + Arrays.stream(parameterTypes).map(String::valueOf).collect(Collectors.joining(",", "(", ")")); +final String strCandidates = bestCandidates.stream().map(Method::toString).collect(Collectors.joining("\n ")); +throw new IllegalStateException("Found multiple candidates for method " + target + " on class " + cls + ":\n " + strCandidates); Review comment: Let's not hard-code Linux-specific new-line chars in error messages, but, if you really want new-lines, use `%n` with `String.format()`. ## File path: src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java ## @@ -742,35 +745,51 @@ public static Method getMatchingMethod(final Class cls, final String methodNa Validate.notNull(cls, "cls"); Validate.notEmpty(methodName, "methodName"); -// Address methods in superclasses -Method[] methodArray = cls.getDeclaredMethods(); -final List> superclassList = ClassUtils.getAllSuperclasses(cls); -for (final Class klass : superclassList) { -methodArray = ArrayUtils.addAll(methodArray, klass.getDeclaredMethods()); -} +final List methods = Arrays.stream(cls.getDeclaredMethods()) +.filter(method -> method.getName().equals(methodName)) +.collect(toList()); + +ClassUtils.getAllSuperclasses(cls).stream() +.map(Class::getDeclaredMethods) +.flatMap(Arrays::stream) +.filter(method -> method.getName().equals(methodName)) +.forEach(methods::add); -Method inexactMatch = null; -for (final Method method : methodArray) { -if (methodName.equals(method.getName()) && -Objects.deepEquals(parameterTypes, method.getParameterTypes())) { +for (Method method : methods) { +if (Arrays.deepEquals(method.getParameterTypes(), parameterTypes)) { return method; -} else if (methodName.equals(method.getName()) && -ClassUtils.isAssignable(parameterTypes, method.getParameterTypes(), true)) { -
[jira] [Commented] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253559#comment-17253559 ] Gary D. Gregory commented on LANG-1544: --- The description needs a stack trace to make it easier for everyone to match up with exceptions in the wild. > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 2.5h > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Comment Edited] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253559#comment-17253559 ] Gary D. Gregory edited comment on LANG-1544 at 12/22/20, 3:13 PM: -- The description needs a stack trace to make it easier for everyone to match up with exceptions seen in the wild. was (Author: garydgregory): The description needs a stack trace to make it easier for everyone to match up with exceptions in the wild. > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 2.5h > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-geometry] singhbaljit commented on a change in pull request #122: Miscellaneous (cherry-picked) improvements
singhbaljit commented on a change in pull request #122: URL: https://github.com/apache/commons-geometry/pull/122#discussion_r547330636 ## File path: commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/AbstractConvexHyperplaneBoundedRegion.java ## @@ -161,7 +161,7 @@ public String toString() { */ protected > R transformInternal( final Transform transform, final R thisInstance, final Class boundaryType, -final Function, R> factory) { +final Function, R> factory) { Review comment: IMO, it improves the usability of the APIs. See Josh Bloch's _Effective Java_ (3rd Edition): > Using wildcard types in your APIs, while tricky, makes the APIs far more flexible. If you write a library that will be widely used, the proper use of wildcard types should be considered mandatory. Actually, some of the generic parameters can also use wildcards (i.e. `final Class boundaryType`), but I kept those out for now to avoid overcomplicating the signature even more. 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
[GitHub] [commons-geometry] singhbaljit commented on a change in pull request #122: Miscellaneous (cherry-picked) improvements
singhbaljit commented on a change in pull request #122: URL: https://github.com/apache/commons-geometry/pull/122#discussion_r547331628 ## File path: commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/Bounds3D.java ## @@ -233,7 +233,7 @@ public Builder add(final Vector3D pt) { * @param pts points to add * @return this instance */ -public Builder addAll(final Iterable pts) { +public Builder addAll(final Iterable pts) { Review comment: Although there is one subclass within the library, users can define other subclasses of `Vector3D` (for whatever reason). 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
[GitHub] [commons-geometry] singhbaljit commented on a change in pull request #122: Miscellaneous (cherry-picked) improvements
singhbaljit commented on a change in pull request #122: URL: https://github.com/apache/commons-geometry/pull/122#discussion_r547330636 ## File path: commons-geometry-core/src/main/java/org/apache/commons/geometry/core/partitioning/AbstractConvexHyperplaneBoundedRegion.java ## @@ -161,7 +161,7 @@ public String toString() { */ protected > R transformInternal( final Transform transform, final R thisInstance, final Class boundaryType, -final Function, R> factory) { +final Function, R> factory) { Review comment: IMO, it improves the usability of the APIs. See Josh Bloch's _Effective Java_ (3rd Edition): > Using wildcard types in your APIs, while tricky, makes the APIs far more flexible. If you write a library that will be widely used, the proper use of wildcard types should be considered mandatory. Actually, some of the generic parameters can also wildcards (i.e. `final Class boundaryType`), but I kept those out for now to avoid overcomplicating the signature even more. 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
[jira] [Work logged] (LANG-1544) MethodUtils.invokeMethod NullPointerException in case of null in args list
[ https://issues.apache.org/jira/browse/LANG-1544?focusedWorklogId=527229&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527229 ] ASF GitHub Bot logged work on LANG-1544: Author: ASF GitHub Bot Created on: 22/Dec/20 15:03 Start Date: 22/Dec/20 15:03 Worklog Time Spent: 10m Work Description: garydgregory commented on pull request #680: URL: https://github.com/apache/commons-lang/pull/680#issuecomment-749585160 https://issues.apache.org/jira/browse/LANG-1544 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: 527229) Time Spent: 2.5h (was: 2h 20m) > MethodUtils.invokeMethod NullPointerException in case of null in args list > -- > > Key: LANG-1544 > URL: https://issues.apache.org/jira/browse/LANG-1544 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* >Affects Versions: 3.10 >Reporter: Peter Nagy >Priority: Critical > Time Spent: 2.5h > Remaining Estimate: 0h > > MethodUtils:774 > > if (classArray[offset].equals(toClassArray[offset])) { > continue; > } else if (ClassUtils.isAssignable(classArray[offset], toClassArray[offset], > true) > > cause NPE if classArray[offset] is null. Can you please extend the if > condition with a null check, like this? > > if (classArray[offset] != null && > classArray[offset].equals(toClassArray[offset])) -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] garydgregory commented on pull request #680: LANG-1544:
garydgregory commented on pull request #680: URL: https://github.com/apache/commons-lang/pull/680#issuecomment-749585160 https://issues.apache.org/jira/browse/LANG-1544 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527225&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527225 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 15:00 Start Date: 22/Dec/20 15:00 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547325346 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: Hi @arturobernalg Thank you for your PR. PS: It's harder to deal with a PR like this because it mixes a change with some clean ups (-1 -> NOT_FOUND) so I am not sure where the new test is without trolling through all the noise :-( Why is the number in parentheses? If this is a test for the actual bug fix, then you should add a sanity check to validates that the char is indeed bogus. TY. 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: 527225) Time Spent: 0.5h (was: 20m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] garydgregory commented on a change in pull request #682: [LANG-1631] - Check if Character is defined
garydgregory commented on a change in pull request #682: URL: https://github.com/apache/commons-lang/pull/682#discussion_r547325346 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java ## @@ -506,42 +510,57 @@ public void testIndexOfIgnoreCase_StringInt() { assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 2)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 3)); assertEquals(4, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 4)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 5)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 6)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 7)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aabaabaa", "AB", 8)); assertEquals(1, StringUtils.indexOfIgnoreCase("aab", "AB", 1)); assertEquals(5, StringUtils.indexOfIgnoreCase("aabaabaa", "", 5)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); -assertEquals(-1, StringUtils.indexOfIgnoreCase("abc", "", 9)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("ab", "AAB", 0)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("aab", "AAB", 1)); +assertEquals(NOT_FOUND, StringUtils.indexOfIgnoreCase("abc", "", 9)); } @Test public void testLastIndexOf_char() { -assertEquals(-1, StringUtils.lastIndexOf(null, ' ')); -assertEquals(-1, StringUtils.lastIndexOf("", ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf(null, ' ')); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf("", ' ')); assertEquals(7, StringUtils.lastIndexOf("aabaabaa", 'a')); assertEquals(5, StringUtils.lastIndexOf("aabaabaa", 'b')); assertEquals(5, StringUtils.lastIndexOf(new StringBuilder("aabaabaa"), 'b')); +char[] charArray = new char[9]; +charArray[0] = '['; +charArray[1] = '&'; +charArray[7] = '{'; +charArray[3] = '.'; +charArray[4] = 'c'; +charArray[5] = '.'; +charArray[6] = '0'; +charArray[7] = 'r'; +charArray[8] = 'o'; +CharBuffer charBuffer = CharBuffer.wrap(charArray); +assertEquals(NOT_FOUND, StringUtils.lastIndexOf (charBuffer, (-1738), 982)); Review comment: Hi @arturobernalg Thank you for your PR. PS: It's harder to deal with a PR like this because it mixes a change with some clean ups (-1 -> NOT_FOUND) so I am not sure where the new test is without trolling through all the noise :-( Why is the number in parentheses? If this is a test for the actual bug fix, then you should add a sanity check to validates that the char is indeed bogus. TY. 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
[jira] [Resolved] (MATH-1566) Fix all CheckStyle issues
[ https://issues.apache.org/jira/browse/MATH-1566?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles Sadowski resolved MATH-1566. --- Resolution: Fixed PR merged. Please note that it's always better, for clarity of history, that a given PR contain a single commit (especially for this kind of changes). See the ["squashed" commit|https://gitbox.apache.org/repos/asf?p=commons-math.git;a=commit;h=ed886b8ef5919577cbbdca70b70940cbcc33f530]. Thanks for your contribution. More help is welcome. ;) > Fix all CheckStyle issues > - > > Key: MATH-1566 > URL: https://issues.apache.org/jira/browse/MATH-1566 > Project: Commons Math > Issue Type: Task >Reporter: Gilles Sadowski >Priority: Blocker > Fix For: 4.0 > > Time Spent: 20m > Remaining Estimate: 0h > > Checkstyle issues make the build fail on > [Jenkins|https://ci-builds.apache.org/job/Commons/job/commons-math/13/console]. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (MATH-1566) Fix all CheckStyle issues
[ https://issues.apache.org/jira/browse/MATH-1566?focusedWorklogId=527216&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527216 ] ASF GitHub Bot logged work on MATH-1566: Author: ASF GitHub Bot Created on: 22/Dec/20 14:41 Start Date: 22/Dec/20 14:41 Worklog Time Spent: 10m Work Description: asfgit closed pull request #168: URL: https://github.com/apache/commons-math/pull/168 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: 527216) Time Spent: 20m (was: 10m) > Fix all CheckStyle issues > - > > Key: MATH-1566 > URL: https://issues.apache.org/jira/browse/MATH-1566 > Project: Commons Math > Issue Type: Task >Reporter: Gilles Sadowski >Priority: Blocker > Fix For: 4.0 > > Time Spent: 20m > Remaining Estimate: 0h > > Checkstyle issues make the build fail on > [Jenkins|https://ci-builds.apache.org/job/Commons/job/commons-math/13/console]. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-math] asfgit closed pull request #168: MATH-1566: Fix CheckStyle Issues
asfgit closed pull request #168: URL: https://github.com/apache/commons-math/pull/168 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
[jira] [Commented] (MATH-1563) Implementation of Adaptive Probability Generation Strategy for Genetic Algorithm
[ https://issues.apache.org/jira/browse/MATH-1563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253532#comment-17253532 ] Gilles Sadowski commented on MATH-1563: --- {quote}I have subscribed to "dev" ML "d...@community.apache.org". {quote} Unrelated list. The "Commons" project's dev list is , and it's the list which you have to subscribe to for following up on your proposal. Link to subscribe is at this page: [http://commons.apache.org/mail-lists.html] > Implementation of Adaptive Probability Generation Strategy for Genetic > Algorithm > > > Key: MATH-1563 > URL: https://issues.apache.org/jira/browse/MATH-1563 > Project: Commons Math > Issue Type: Improvement >Reporter: AVIJIT BASAK >Priority: Major > > In Genetic Algorithm probability of crossover and mutation operation can be > generated in an adaptive manner. Some experiment was done related to this and > published in this article > "https://www.ijcaonline.org/archives/volume175/number10/basak-2020-ijca-920572.pdf";. > Currently Apache's API works on constant probability strategy. I would like > to propose incorporation of rank based adaptive probability generation > strategy as described in the mentioned article. This will improve the > performance and robustness of the algorithm and would make this more suitable > for use in higher dimensional problems like machine learning or deep learning. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (LANG-1630) NPE lowerCase and upperCase when locale is null
[ https://issues.apache.org/jira/browse/LANG-1630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253497#comment-17253497 ] Gary D. Gregory commented on LANG-1630: --- This was implemented differently FYI. > NPE lowerCase and upperCase when locale is null > > > Key: LANG-1630 > URL: https://issues.apache.org/jira/browse/LANG-1630 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > When the parameter Local is null where are getting NPE in the following > method: > * upperCase > * lowerCase > > Add control > > {code:java} > if (locale == null) { >throw new IllegalArgumentException("Locale must not be null"); > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253491#comment-17253491 ] Gary D. Gregory commented on LANG-1631: --- Please provide a full description. Which APIs are affected? > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (COMPRESS-561) Minor improvement
[ https://issues.apache.org/jira/browse/COMPRESS-561?focusedWorklogId=527156&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527156 ] ASF GitHub Bot logged work on COMPRESS-561: --- Author: ASF GitHub Bot Created on: 22/Dec/20 11:26 Start Date: 22/Dec/20 11:26 Worklog Time Spent: 10m Work Description: PeterAlfredLee merged pull request #157: URL: https://github.com/apache/commons-compress/pull/157 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: 527156) Time Spent: 50m (was: 40m) > Minor improvement > - > > Key: COMPRESS-561 > URL: https://issues.apache.org/jira/browse/COMPRESS-561 > Project: Commons Compress > Issue Type: Improvement >Reporter: Arturo Bernal >Priority: Major > Labels: pull-request-available > Time Spent: 50m > Remaining Estimate: 0h > > Minor improvement > > * Unused import > * add final > * Replace Charset.forName("UTF-8") for --> StandardCharsets.UTF_8 > * Unnecessary semicolon '' > * -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-compress] PeterAlfredLee merged pull request #157: [COMPRESS-561] - Minor improvement
PeterAlfredLee merged pull request #157: URL: https://github.com/apache/commons-compress/pull/157 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
[jira] [Work logged] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527152&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527152 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 11:17 Start Date: 22/Dec/20 11:17 Worklog Time Spent: 10m Work Description: coveralls commented on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/3550/badge)](https://coveralls.io/builds/3550) Coverage increased (+0.007%) to 95.022% when pulling **ced8a0b0f78e80c906363a20027fdea2cf474b69 on arturobernalg:bugfix/LANG-1631** into **b4456352bcbe3672afba526ea143fca7a53f7843 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 Issue Time Tracking --- Worklog Id: (was: 527152) Time Spent: 20m (was: 10m) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] coveralls commented on pull request #682: [LANG-1631] - Check if Character is defined
coveralls commented on pull request #682: URL: https://github.com/apache/commons-lang/pull/682#issuecomment-749489826 [![Coverage Status](https://coveralls.io/builds/3550/badge)](https://coveralls.io/builds/3550) Coverage increased (+0.007%) to 95.022% when pulling **ced8a0b0f78e80c906363a20027fdea2cf474b69 on arturobernalg:bugfix/LANG-1631** into **b4456352bcbe3672afba526ea143fca7a53f7843 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
[jira] [Comment Edited] (MATH-1563) Implementation of Adaptive Probability Generation Strategy for Genetic Algorithm
[ https://issues.apache.org/jira/browse/MATH-1563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253401#comment-17253401 ] AVIJIT BASAK edited comment on MATH-1563 at 12/22/20, 10:56 AM: The enhancement request was sent to "{color:#22}d...@commons.apache.org"{color} I have subscribed to "dev" ML "d...@community.apache.org". was (Author: avijit.basak): "{color:#172b4d}Did you {color}*subscribe*{color:#172b4d} to the "dev" ML?{color}" Yes, I have subscribed to "dev" ML > Implementation of Adaptive Probability Generation Strategy for Genetic > Algorithm > > > Key: MATH-1563 > URL: https://issues.apache.org/jira/browse/MATH-1563 > Project: Commons Math > Issue Type: Improvement >Reporter: AVIJIT BASAK >Priority: Major > > In Genetic Algorithm probability of crossover and mutation operation can be > generated in an adaptive manner. Some experiment was done related to this and > published in this article > "https://www.ijcaonline.org/archives/volume175/number10/basak-2020-ijca-920572.pdf";. > Currently Apache's API works on constant probability strategy. I would like > to propose incorporation of rank based adaptive probability generation > strategy as described in the mentioned article. This will improve the > performance and robustness of the algorithm and would make this more suitable > for use in higher dimensional problems like machine learning or deep learning. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (MATH-1563) Implementation of Adaptive Probability Generation Strategy for Genetic Algorithm
[ https://issues.apache.org/jira/browse/MATH-1563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17253401#comment-17253401 ] AVIJIT BASAK commented on MATH-1563: "{color:#172b4d}Did you {color}*subscribe*{color:#172b4d} to the "dev" ML?{color}" Yes, I have subscribed to "dev" ML > Implementation of Adaptive Probability Generation Strategy for Genetic > Algorithm > > > Key: MATH-1563 > URL: https://issues.apache.org/jira/browse/MATH-1563 > Project: Commons Math > Issue Type: Improvement >Reporter: AVIJIT BASAK >Priority: Major > > In Genetic Algorithm probability of crossover and mutation operation can be > generated in an adaptive manner. Some experiment was done related to this and > published in this article > "https://www.ijcaonline.org/archives/volume175/number10/basak-2020-ijca-920572.pdf";. > Currently Apache's API works on constant probability strategy. I would like > to propose incorporation of rank based adaptive probability generation > strategy as described in the mentioned article. This will improve the > performance and robustness of the algorithm and would make this more suitable > for use in higher dimensional problems like machine learning or deep learning. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arturo Bernal updated LANG-1631: Description: Crash when the the char to be searched value it's out of range >= '\u' <= '\u' Getting the next error --> {code:java} java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936{code} was: Crash when search value it's out of range >= '\u' <= '\u' Getting --> java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936 > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > > Crash when the the char to be searched value it's out of range >= '\u' > <= '\u' > Getting the next error --> > > {code:java} > java.lang.IllegalArgumentException: Not a valid Unicode code point: > 0xF936{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (LANG-1631) Check if the char to be searched is defined
[ https://issues.apache.org/jira/browse/LANG-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arturo Bernal updated LANG-1631: Summary: Check if the char to be searched is defined (was: Check if Character is defined) > Check if the char to be searched is defined > --- > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > > Crash when search value it's out of range >= '\u' <= '\u' > Getting --> > > java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936 -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1631) Check if Character is defined
[ https://issues.apache.org/jira/browse/LANG-1631?focusedWorklogId=527132&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527132 ] ASF GitHub Bot logged work on LANG-1631: Author: ASF GitHub Bot Created on: 22/Dec/20 09:35 Start Date: 22/Dec/20 09:35 Worklog Time Spent: 10m Work Description: arturobernalg opened a new pull request #682: URL: https://github.com/apache/commons-lang/pull/682 Crash when search value it's out of range >= '\u' <= '\u' Getting --> java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936 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: 527132) Remaining Estimate: 0h Time Spent: 10m > Check if Character is defined > - > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > > Crash when search value it's out of range >= '\u' <= '\u' > Getting --> > > java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936 -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg opened a new pull request #682: [LANG-1631] - Check if Character is defined
arturobernalg opened a new pull request #682: URL: https://github.com/apache/commons-lang/pull/682 Crash when search value it's out of range >= '\u' <= '\u' Getting --> java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936 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
[jira] [Updated] (LANG-1631) Check if Character is defined
[ https://issues.apache.org/jira/browse/LANG-1631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arturo Bernal updated LANG-1631: Description: Crash when search value it's out of range >= '\u' <= '\u' Getting --> java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936 > Check if Character is defined > - > > Key: LANG-1631 > URL: https://issues.apache.org/jira/browse/LANG-1631 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > > > Crash when search value it's out of range >= '\u' <= '\u' > Getting --> > > java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xF936 -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Created] (LANG-1631) Check if Character is defined
Arturo Bernal created LANG-1631: --- Summary: Check if Character is defined Key: LANG-1631 URL: https://issues.apache.org/jira/browse/LANG-1631 Project: Commons Lang Issue Type: Bug Reporter: Arturo Bernal -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Closed] (LANG-1630) NPE lowerCase and upperCase when locale is null
[ https://issues.apache.org/jira/browse/LANG-1630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Arturo Bernal closed LANG-1630. --- Resolution: Fixed > NPE lowerCase and upperCase when locale is null > > > Key: LANG-1630 > URL: https://issues.apache.org/jira/browse/LANG-1630 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > When the parameter Local is null where are getting NPE in the following > method: > * upperCase > * lowerCase > > Add control > > {code:java} > if (locale == null) { >throw new IllegalArgumentException("Locale must not be null"); > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1630) NPE lowerCase and upperCase when locale is null
[ https://issues.apache.org/jira/browse/LANG-1630?focusedWorklogId=527096&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527096 ] ASF GitHub Bot logged work on LANG-1630: Author: ASF GitHub Bot Created on: 22/Dec/20 08:28 Start Date: 22/Dec/20 08:28 Worklog Time Spent: 10m Work Description: arturobernalg closed pull request #681: URL: https://github.com/apache/commons-lang/pull/681 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: 527096) Time Spent: 20m (was: 10m) > NPE lowerCase and upperCase when locale is null > > > Key: LANG-1630 > URL: https://issues.apache.org/jira/browse/LANG-1630 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 20m > Remaining Estimate: 0h > > When the parameter Local is null where are getting NPE in the following > method: > * upperCase > * lowerCase > > Add control > > {code:java} > if (locale == null) { >throw new IllegalArgumentException("Locale must not be null"); > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1630) NPE lowerCase and upperCase when locale is null
[ https://issues.apache.org/jira/browse/LANG-1630?focusedWorklogId=527095&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-527095 ] ASF GitHub Bot logged work on LANG-1630: Author: ASF GitHub Bot Created on: 22/Dec/20 08:27 Start Date: 22/Dec/20 08:27 Worklog Time Spent: 10m Work Description: arturobernalg opened a new pull request #681: URL: https://github.com/apache/commons-lang/pull/681 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: 527095) Remaining Estimate: 0h Time Spent: 10m > NPE lowerCase and upperCase when locale is null > > > Key: LANG-1630 > URL: https://issues.apache.org/jira/browse/LANG-1630 > Project: Commons Lang > Issue Type: Bug >Reporter: Arturo Bernal >Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > When the parameter Local is null where are getting NPE in the following > method: > * upperCase > * lowerCase > > Add control > > {code:java} > if (locale == null) { >throw new IllegalArgumentException("Locale must not be null"); > } > {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)
[GitHub] [commons-lang] arturobernalg closed pull request #681: [LANG-1630] - NPE lowerCase and upperCase when locale is null
arturobernalg closed pull request #681: URL: https://github.com/apache/commons-lang/pull/681 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
[GitHub] [commons-lang] arturobernalg opened a new pull request #681: [LANG-1630] - NPE lowerCase and upperCase when locale is null
arturobernalg opened a new pull request #681: URL: https://github.com/apache/commons-lang/pull/681 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
[jira] [Created] (LANG-1630) NPE lowerCase and upperCase when locale is null
Arturo Bernal created LANG-1630: --- Summary: NPE lowerCase and upperCase when locale is null Key: LANG-1630 URL: https://issues.apache.org/jira/browse/LANG-1630 Project: Commons Lang Issue Type: Bug Reporter: Arturo Bernal When the parameter Local is null where are getting NPE in the following method: * upperCase * lowerCase Add control {code:java} if (locale == null) { throw new IllegalArgumentException("Locale must not be null"); } {code} -- This message was sent by Atlassian Jira (v8.3.4#803005)