[jira] [Resolved] (LANG-1137) Add check for duplicate event listener in EventListenerSupport

2015-05-11 Thread Benedikt Ritter (JIRA)

 [ 
https://issues.apache.org/jira/browse/LANG-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benedikt Ritter resolved LANG-1137.
---
   Resolution: Fixed
Fix Version/s: (was: 4.0)
 Assignee: Benedikt Ritter

Fixed in 19dace1b8a2ce1734872c683bc881c420c23a1a3. Thank you!

> Add check for duplicate event listener in EventListenerSupport
> --
>
> Key: LANG-1137
> URL: https://issues.apache.org/jira/browse/LANG-1137
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.event.*
>Affects Versions: 4.0, 3.5
>Reporter: Matthew Aguirre
>Assignee: Benedikt Ritter
>Priority: Minor
>  Labels: github-import, newbie
> Fix For: 3.5
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> https://github.com/apache/commons-lang/pull/88



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] commons-lang pull request: Added new addListener method that allow...

2015-05-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-lang/pull/88


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1136) Add a method in EnumUtils to 'translate' an enum value

2015-05-11 Thread Benedikt Ritter (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14539294#comment-14539294
 ] 

Benedikt Ritter commented on LANG-1136:
---

Okay putting together a bigger example your proposal looks like this:

{code:java}
public enum Day {
  MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
}
public enum DayOfWeek {
  MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
}

assertNull(EnumUtils.valueOf(Day.class, null))
assertEquals(Day.MONDAY, EnumUtils.valueOf(Day.class, DayOfWeek.MONDAY));
{code}

Looks like an odd use case to translate from one enum to another. Have you 
thought about implementing the functionality in either of your enum classes?

> Add a method in EnumUtils to 'translate' an enum value
> --
>
> Key: LANG-1136
> URL: https://issues.apache.org/jira/browse/LANG-1136
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Cimballi
>Priority: Minor
> Fix For: Discussion
>
>
> Add a method in EnumUtils to 'translate' an enum value.
> Example :
> Enum1
> Enum2
> Object.enum2
> Enum1 getEnum(Enum1.class, Object.enum2);
> If enum2 is null, returns 2, else returns the Enum1 with the same name as 
> Object.enum2, throws exception if no such Enum1.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] commons-lang pull request: Adding unwrap and unwrapFull methods to...

2015-05-11 Thread britter
Github user britter commented on the pull request:

https://github.com/apache/commons-lang/pull/25#issuecomment-101140034
  
@thiagoh yes, please close this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1124) Add split by length methods in StringUtils

2015-05-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14539285#comment-14539285
 ] 

ASF GitHub Bot commented on LANG-1124:
--

Github user britter commented on the pull request:

https://github.com/apache/commons-lang/pull/75#issuecomment-101139996
  
@thiagoh no, we have to discuss what I've commented.


> Add split by length methods in StringUtils
> --
>
> Key: LANG-1124
> URL: https://issues.apache.org/jira/browse/LANG-1124
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Reporter: Loic Guibert
>
> Add methods to split a String by fixed lengths :
> {code:java}
> public static String[] splitByLength(String str, int ... lengths);
> public static String[] splitByLengthRepeatedly(String str, int ... lengths);
> {code}
> Detail :
> {code:java}
> /**
>  * Split a String into an array, using an array of fixed string 
> lengths.
>  *
>  * If not null String input, the returned array size is same as the input 
> lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * Extra characters are ignored (ie String length greater than sum of 
> split lengths).
>  * All empty substrings other than zero length requested, are returned {@code 
> null}.
>  *
>  * 
>  * StringUtils.splitByLength(null, *)  = null
>  * StringUtils.splitByLength("abc")= []
>  * StringUtils.splitByLength("abc", null)  = []
>  * StringUtils.splitByLength("abc", [])= []
>  * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", null]
>  *
>  * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", "f"]
>  * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", " "]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", "", "g"]
>  * StringUtils.splitByLength("abcdefg", -1)  = {@link 
> IllegalArgumentException}
>  * 
>  *
>  * @param str  the String to parse, may be null
>  * @param lengths  the string lengths where to cut, may be null, must not be 
> negative
>  * @return an array of splitted Strings, {@code null} if null String input
>  * @throws IllegalArgumentException
>  * if one of the lengths is negative
>  */
> public static String[] splitByLength(String str, int ... lengths);
> /**
>  * Split a String into an array, using an array of fixed string lengths 
> repeated as
>  * many times as necessary to reach the String end.
>  *
>  * If not null String input, the returned array size is a multiple of the 
> input lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * All empty substrings other than zero length requested and following 
> substrings,
>  * are returned {@code null}.
>  *
>  * 
>  * StringUtils.splitByLengthRepeated(null, *)  = null
>  * StringUtils.splitByLengthRepeated("abc")= []
>  * StringUtils.splitByLengthRepeated("abc", null)  = []
>  * StringUtils.splitByLengthRepeated("abc", [])= []
>  * StringUtils.splitByLengthRepeated("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLengthRepeated("abcdefghij", 2, 3) = ["ab", "cde", 
> "fg", "hij"]
>  * StringUtils.splitByLengthRepeated("abcdefgh", 2, 3)   = ["ab", "cde", 
> "fg", "h"]
>  * StringUtils.splitByLengthRepeated("abcdefg", 2, 3)= ["ab", "cde", 
> "fg", null]
>  *
>  * StringUtils.splitByLengthRepeated(" abcdef", 2, 3)= [" a", "bcd", 
> "ef", null]
>  * StringUtils.splitByLengthRepeated("abcdef ", 2, 3)= ["ab", "cde", 
> "f ", null]
>  * StringUtils.splitByLengthRepeated("abcdef", 2, 3, 0, 1)   = ["ab", "cde", 
> "", "f"]
>  * StringUtils.splitByLengthRepeated("abcdefg", 2, 3, 0, 1)  = ["ab", "cde", 
> "", "f",
>  *  "g", null, 
> null, null]
>  * StringUtils.splitByLengthRepeated("abcdefgh", 2, 0, 1, 0) = ["ab", "", 
> "c", "",
>  *  "de", "", 
> "f", "",
>  *  "gh", "", 
> null, null]
>  * StringUtils.splitByLengthRepeated("abcdefg", 2, 0, 1, 0) = ["ab", "", "c", 
> "",
>  *  "de", "", 
> "f", "",

[GitHub] commons-lang pull request: LANG-1124: Add StringUtils split by len...

2015-05-11 Thread britter
Github user britter commented on the pull request:

https://github.com/apache/commons-lang/pull/75#issuecomment-101139996
  
@thiagoh no, we have to discuss what I've commented.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: Added new addListener method that allow...

2015-05-11 Thread coveralls
Github user coveralls commented on the pull request:

https://github.com/apache/commons-lang/pull/88#issuecomment-101079306
  

[![Coverage 
Status](https://coveralls.io/builds/2536923/badge)](https://coveralls.io/builds/2536923)

Coverage increased (+0.0%) to 93.28% when pulling 
**a48071b0d489420bfdc0c2ed7254d1dba243f700 on ZenHarbinger:master** into 
**61bec859ac3ee087a69edeed8b65ec39a6646f18 on apache:master**.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: Adding unwrap and unwrapFull methods to...

2015-05-11 Thread thiagoh
Github user thiagoh commented on the pull request:

https://github.com/apache/commons-lang/pull/25#issuecomment-101049295
  
Hi @britter have these methods been already added to the trunk? shouldn't 
we finish this PR?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1124) Add split by length methods in StringUtils

2015-05-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538660#comment-14538660
 ] 

ASF GitHub Bot commented on LANG-1124:
--

Github user thiagoh commented on the pull request:

https://github.com/apache/commons-lang/pull/75#issuecomment-101048576
  
is this finished?


> Add split by length methods in StringUtils
> --
>
> Key: LANG-1124
> URL: https://issues.apache.org/jira/browse/LANG-1124
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Reporter: Loic Guibert
>
> Add methods to split a String by fixed lengths :
> {code:java}
> public static String[] splitByLength(String str, int ... lengths);
> public static String[] splitByLengthRepeatedly(String str, int ... lengths);
> {code}
> Detail :
> {code:java}
> /**
>  * Split a String into an array, using an array of fixed string 
> lengths.
>  *
>  * If not null String input, the returned array size is same as the input 
> lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * Extra characters are ignored (ie String length greater than sum of 
> split lengths).
>  * All empty substrings other than zero length requested, are returned {@code 
> null}.
>  *
>  * 
>  * StringUtils.splitByLength(null, *)  = null
>  * StringUtils.splitByLength("abc")= []
>  * StringUtils.splitByLength("abc", null)  = []
>  * StringUtils.splitByLength("abc", [])= []
>  * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", null]
>  *
>  * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", "f"]
>  * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", " "]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", "", "g"]
>  * StringUtils.splitByLength("abcdefg", -1)  = {@link 
> IllegalArgumentException}
>  * 
>  *
>  * @param str  the String to parse, may be null
>  * @param lengths  the string lengths where to cut, may be null, must not be 
> negative
>  * @return an array of splitted Strings, {@code null} if null String input
>  * @throws IllegalArgumentException
>  * if one of the lengths is negative
>  */
> public static String[] splitByLength(String str, int ... lengths);
> /**
>  * Split a String into an array, using an array of fixed string lengths 
> repeated as
>  * many times as necessary to reach the String end.
>  *
>  * If not null String input, the returned array size is a multiple of the 
> input lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * All empty substrings other than zero length requested and following 
> substrings,
>  * are returned {@code null}.
>  *
>  * 
>  * StringUtils.splitByLengthRepeated(null, *)  = null
>  * StringUtils.splitByLengthRepeated("abc")= []
>  * StringUtils.splitByLengthRepeated("abc", null)  = []
>  * StringUtils.splitByLengthRepeated("abc", [])= []
>  * StringUtils.splitByLengthRepeated("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLengthRepeated("abcdefghij", 2, 3) = ["ab", "cde", 
> "fg", "hij"]
>  * StringUtils.splitByLengthRepeated("abcdefgh", 2, 3)   = ["ab", "cde", 
> "fg", "h"]
>  * StringUtils.splitByLengthRepeated("abcdefg", 2, 3)= ["ab", "cde", 
> "fg", null]
>  *
>  * StringUtils.splitByLengthRepeated(" abcdef", 2, 3)= [" a", "bcd", 
> "ef", null]
>  * StringUtils.splitByLengthRepeated("abcdef ", 2, 3)= ["ab", "cde", 
> "f ", null]
>  * StringUtils.splitByLengthRepeated("abcdef", 2, 3, 0, 1)   = ["ab", "cde", 
> "", "f"]
>  * StringUtils.splitByLengthRepeated("abcdefg", 2, 3, 0, 1)  = ["ab", "cde", 
> "", "f",
>  *  "g", null, 
> null, null]
>  * StringUtils.splitByLengthRepeated("abcdefgh", 2, 0, 1, 0) = ["ab", "", 
> "c", "",
>  *  "de", "", 
> "f", "",
>  *  "gh", "", 
> null, null]
>  * StringUtils.splitByLengthRepeated("abcdefg", 2, 0, 1, 0) = ["ab", "", "c", 
> "",
>  *  "de", "", 
> "f", "",
>  *   

[GitHub] commons-lang pull request: LANG-1124: Add StringUtils split by len...

2015-05-11 Thread thiagoh
Github user thiagoh commented on the pull request:

https://github.com/apache/commons-lang/pull/75#issuecomment-101048576
  
is this finished?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Updated] (LANG-1137) Add check for duplicate event listener in EventListenerSupport

2015-05-11 Thread Matthew Aguirre (JIRA)

 [ 
https://issues.apache.org/jira/browse/LANG-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matthew Aguirre updated LANG-1137:
--
Fix Version/s: 3.5

> Add check for duplicate event listener in EventListenerSupport
> --
>
> Key: LANG-1137
> URL: https://issues.apache.org/jira/browse/LANG-1137
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.event.*
>Affects Versions: 4.0, 3.5
>Reporter: Matthew Aguirre
>Priority: Minor
>  Labels: github-import, newbie
> Fix For: 4.0, 3.5
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> https://github.com/apache/commons-lang/pull/88



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (LANG-1137) Add check for duplicate event listener in EventListenerSupport

2015-05-11 Thread Matthew Aguirre (JIRA)

 [ 
https://issues.apache.org/jira/browse/LANG-1137?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Matthew Aguirre updated LANG-1137:
--
Affects Version/s: 3.5

> Add check for duplicate event listener in EventListenerSupport
> --
>
> Key: LANG-1137
> URL: https://issues.apache.org/jira/browse/LANG-1137
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.event.*
>Affects Versions: 4.0, 3.5
>Reporter: Matthew Aguirre
>Priority: Minor
>  Labels: github-import, newbie
> Fix For: 4.0, 3.5
>
>   Original Estimate: 0.5h
>  Remaining Estimate: 0.5h
>
> https://github.com/apache/commons-lang/pull/88



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (LANG-1136) Add a method in EnumUtils to 'translate' an enum value

2015-05-11 Thread Cimballi (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538389#comment-14538389
 ] 

Cimballi commented on LANG-1136:


With this new method the null test is on the object, not on the string.
If you want to use the existing method on an Enum, you need to first check if 
the enum is null or not, then call enum.value.

Does it make sense ?


> Add a method in EnumUtils to 'translate' an enum value
> --
>
> Key: LANG-1136
> URL: https://issues.apache.org/jira/browse/LANG-1136
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Cimballi
>Priority: Minor
> Fix For: Discussion
>
>
> Add a method in EnumUtils to 'translate' an enum value.
> Example :
> Enum1
> Enum2
> Object.enum2
> Enum1 getEnum(Enum1.class, Object.enum2);
> If enum2 is null, returns 2, else returns the Enum1 with the same name as 
> Object.enum2, throws exception if no such Enum1.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Resolved] (CLI-245) A static method, by definition, is called on a class and not on an instance of that class.

2015-05-11 Thread Benedikt Ritter (JIRA)

 [ 
https://issues.apache.org/jira/browse/CLI-245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benedikt Ritter resolved CLI-245.
-
Resolution: Won't Fix

This won't be fixed. Please use the new {{Option.builder()}} API instead of 
OptionBuilder.

> A static method, by definition, is called on a class and not on an instance 
> of that class.
> --
>
> Key: CLI-245
> URL: https://issues.apache.org/jira/browse/CLI-245
> Project: Commons CLI
>  Issue Type: Improvement
>  Components: CLI-1.x
>Affects Versions: 1.2
>Reporter: Ghenadie Munteanu
>Priority: Trivial
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Please check page http://commons.apache.org/proper/commons-cli/usage.html, 
> "OptionBuilder" session:
> Option logfile   = OptionBuilder.withArgName( "file" )
> .hasArg()
> .withDescription(  "use given file for log" )
> .create( "logfile" );
> Here "create" method, which is a static one is called on the "OptionBuilder" 
> instance of the object. 
> fix:
> Usually "create" method in builder classes should not be declared static.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Closed] (CLI-245) A static method, by definition, is called on a class and not on an instance of that class.

2015-05-11 Thread Benedikt Ritter (JIRA)

 [ 
https://issues.apache.org/jira/browse/CLI-245?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benedikt Ritter closed CLI-245.
---

> A static method, by definition, is called on a class and not on an instance 
> of that class.
> --
>
> Key: CLI-245
> URL: https://issues.apache.org/jira/browse/CLI-245
> Project: Commons CLI
>  Issue Type: Improvement
>  Components: CLI-1.x
>Affects Versions: 1.2
>Reporter: Ghenadie Munteanu
>Priority: Trivial
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> Please check page http://commons.apache.org/proper/commons-cli/usage.html, 
> "OptionBuilder" session:
> Option logfile   = OptionBuilder.withArgName( "file" )
> .hasArg()
> .withDescription(  "use given file for log" )
> .create( "logfile" );
> Here "create" method, which is a static one is called on the "OptionBuilder" 
> instance of the object. 
> fix:
> Usually "create" method in builder classes should not be declared static.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (IMAGING-171) MicrosoftTagTest rewrite image exif fails

2015-05-11 Thread Benedikt Ritter (JIRA)

[ 
https://issues.apache.org/jira/browse/IMAGING-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538266#comment-14538266
 ] 

Benedikt Ritter commented on IMAGING-171:
-

Patches welcome.

> MicrosoftTagTest rewrite image exif fails
> -
>
> Key: IMAGING-171
> URL: https://issues.apache.org/jira/browse/IMAGING-171
> Project: Commons Imaging
>  Issue Type: Bug
>  Components: Format: TIFF
>Affects Versions: 1.0
> Environment: Ubuntu 14.04 64-bit, Java 1.8.0_20
>Reporter: Jan Helbich
>Priority: Minor
> Fix For: Patch Needed
>
>
> The MicrosoftTagTest test fails on testRewrite() method when supposedly 
> rewritten MicrosoftTagConstants#EXIF_TAG_XPTITLE tag was already defined in 
> another directory.
> The problem seems to be that the new value is written into the "Exif" 
> directory, but the original one is in "Root", which is evaluated first while 
> checking test results.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (LANG-1136) Add a method in EnumUtils to 'translate' an enum value

2015-05-11 Thread Benedikt Ritter (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538263#comment-14538263
 ] 

Benedikt Ritter commented on LANG-1136:
---

Hello [~cimballi],

what is the difference between your proposal and {{EnumUtils.getEnum(Class, 
String)}}?

br,
Benedikt

> Add a method in EnumUtils to 'translate' an enum value
> --
>
> Key: LANG-1136
> URL: https://issues.apache.org/jira/browse/LANG-1136
> Project: Commons Lang
>  Issue Type: Wish
>Reporter: Cimballi
>Priority: Minor
> Fix For: Discussion
>
>
> Add a method in EnumUtils to 'translate' an enum value.
> Example :
> Enum1
> Enum2
> Object.enum2
> Enum1 getEnum(Enum1.class, Object.enum2);
> If enum2 is null, returns 2, else returns the Enum1 with the same name as 
> Object.enum2, throws exception if no such Enum1.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Updated] (IMAGING-171) MicrosoftTagTest rewrite image exif fails

2015-05-11 Thread Benedikt Ritter (JIRA)

 [ 
https://issues.apache.org/jira/browse/IMAGING-171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benedikt Ritter updated IMAGING-171:

Fix Version/s: Patch Needed

> MicrosoftTagTest rewrite image exif fails
> -
>
> Key: IMAGING-171
> URL: https://issues.apache.org/jira/browse/IMAGING-171
> Project: Commons Imaging
>  Issue Type: Bug
>  Components: Format: TIFF
>Affects Versions: 1.0
> Environment: Ubuntu 14.04 64-bit, Java 1.8.0_20
>Reporter: Jan Helbich
>Priority: Minor
> Fix For: Patch Needed
>
>
> The MicrosoftTagTest test fails on testRewrite() method when supposedly 
> rewritten MicrosoftTagConstants#EXIF_TAG_XPTITLE tag was already defined in 
> another directory.
> The problem seems to be that the new value is written into the "Exif" 
> directory, but the original one is in "Root", which is evaluated first while 
> checking test results.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] commons-lang pull request: Added new addListener method that allow...

2015-05-11 Thread britter
Github user britter commented on the pull request:

https://github.com/apache/commons-lang/pull/88#issuecomment-100992492
  
@ZenHarbinger thank you, and don't forget to submit a JIRA for your changes 
;-)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/87#discussion_r30062704
  
--- Diff: src/test/java/org/apache/commons/lang3/ValidateTest.java ---
@@ -1015,6 +1708,9 @@ public void testExclusiveBetweenDouble_withMessage()
 }
 }
 
+
//---
--- End diff --

Where are these changes coming from?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/87#discussion_r30062633
  
--- Diff: src/main/java/org/apache/commons/lang3/Validate.java ---
@@ -874,7 +888,752 @@ public static void matchesPattern(final CharSequence 
input, final String pattern
 throw new IllegalArgumentException(String.format(message, 
values));
 }
 }
-
+
+// notNaN
+
//-
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception.
+ * 
+ * Validate.notNaN(myDouble);
+ * 
+ * The message of the exception is "The validated value is not 
a 
+ * number".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value) {
+notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
+}
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception with the specified message.
+ * 
+ * Validate.notNaN(myDouble, "The value must be a number");
+ *
+ * @param value  the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value, final String message, 
final Object... values) {
+if (value != value) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// finite
+
//-
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception.
+ * 
+ * Validate.finite(myDouble);
+ * 
+ * The message of the exception is "The value is invalid: 
%f".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value) {
+finite(value, DEFAULT_FINITE_EX_MESSAGE, value);
+}
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception with the specified message.
+ * 
+ * Validate.finite(myDouble, "The argument must contain a numeric 
value");
+ *
+ * @param value the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value, final String message, 
final Object... values) {
+if (value != value || Double.isInfinite(value)) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// greater
+
//-
+
+/**
+ * Validates that the specified argument is strictly greater than a 
given
+ * reference; otherwise throwing an exception.
+ * 
+ * Validate.greaterObj(myObject, refObject);
+ * 
+ * The message of the exception is "The value {@code value} is 
not 
+ * greater than {@code min}".
+ * 
+ * @param   the type of the argument object
+ * @param min  the reference value
+ * @param value  the object to validate
+ * @throws IllegalArgumentException if {@code value} is smaller than 
or equal to {@code min}
+ * @see #greaterObj(java.lang.Object, java.lang.Comparable, 
java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static  void greaterObj(final T min, final Comparable 
value) {
+greaterObj(min, value, DEFAULT_GREATER_EX_MESSAGE, value, 

[jira] [Created] (LANG-1137) Add check for duplicate event listener in EventListenerSupport

2015-05-11 Thread Matthew Aguirre (JIRA)
Matthew Aguirre created LANG-1137:
-

 Summary: Add check for duplicate event listener in 
EventListenerSupport
 Key: LANG-1137
 URL: https://issues.apache.org/jira/browse/LANG-1137
 Project: Commons Lang
  Issue Type: Improvement
  Components: lang.event.*
Affects Versions: 4.0
Reporter: Matthew Aguirre
Priority: Minor
 Fix For: 4.0


https://github.com/apache/commons-lang/pull/88



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/87#discussion_r30061992
  
--- Diff: src/main/java/org/apache/commons/lang3/Validate.java ---
@@ -874,7 +888,752 @@ public static void matchesPattern(final CharSequence 
input, final String pattern
 throw new IllegalArgumentException(String.format(message, 
values));
 }
 }
-
+
+// notNaN
+
//-
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception.
+ * 
+ * Validate.notNaN(myDouble);
+ * 
+ * The message of the exception is "The validated value is not 
a 
+ * number".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value) {
+notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
+}
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception with the specified message.
+ * 
+ * Validate.notNaN(myDouble, "The value must be a number");
+ *
+ * @param value  the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value, final String message, 
final Object... values) {
+if (value != value) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// finite
+
//-
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception.
+ * 
+ * Validate.finite(myDouble);
+ * 
+ * The message of the exception is "The value is invalid: 
%f".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value) {
+finite(value, DEFAULT_FINITE_EX_MESSAGE, value);
+}
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception with the specified message.
+ * 
+ * Validate.finite(myDouble, "The argument must contain a numeric 
value");
+ *
+ * @param value the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value, final String message, 
final Object... values) {
+if (value != value || Double.isInfinite(value)) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// greater
+
//-
+
+/**
+ * Validates that the specified argument is strictly greater than a 
given
+ * reference; otherwise throwing an exception.
+ * 
+ * Validate.greaterObj(myObject, refObject);
+ * 
+ * The message of the exception is "The value {@code value} is 
not 
+ * greater than {@code min}".
+ * 
+ * @param   the type of the argument object
+ * @param min  the reference value
+ * @param value  the object to validate
+ * @throws IllegalArgumentException if {@code value} is smaller than 
or equal to {@code min}
+ * @see #greaterObj(java.lang.Object, java.lang.Comparable, 
java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static  void greaterObj(final T min, final Comparable 
value) {
+greaterObj(min, value, DEFAULT_GREATER_EX_MESSAGE, value, 

[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/87#discussion_r30061886
  
--- Diff: src/main/java/org/apache/commons/lang3/Validate.java ---
@@ -874,7 +888,752 @@ public static void matchesPattern(final CharSequence 
input, final String pattern
 throw new IllegalArgumentException(String.format(message, 
values));
 }
 }
-
+
+// notNaN
+
//-
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception.
+ * 
+ * Validate.notNaN(myDouble);
+ * 
+ * The message of the exception is "The validated value is not 
a 
+ * number".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value) {
+notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
+}
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception with the specified message.
+ * 
+ * Validate.notNaN(myDouble, "The value must be a number");
+ *
+ * @param value  the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value, final String message, 
final Object... values) {
+if (value != value) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// finite
+
//-
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception.
+ * 
+ * Validate.finite(myDouble);
+ * 
+ * The message of the exception is "The value is invalid: 
%f".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value) {
+finite(value, DEFAULT_FINITE_EX_MESSAGE, value);
+}
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception with the specified message.
+ * 
+ * Validate.finite(myDouble, "The argument must contain a numeric 
value");
+ *
+ * @param value the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value, final String message, 
final Object... values) {
+if (value != value || Double.isInfinite(value)) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// greater
+
//-
+
+/**
+ * Validates that the specified argument is strictly greater than a 
given
+ * reference; otherwise throwing an exception.
+ * 
+ * Validate.greaterObj(myObject, refObject);
+ * 
+ * The message of the exception is "The value {@code value} is 
not 
+ * greater than {@code min}".
+ * 
+ * @param   the type of the argument object
+ * @param min  the reference value
+ * @param value  the object to validate
+ * @throws IllegalArgumentException if {@code value} is smaller than 
or equal to {@code min}
+ * @see #greaterObj(java.lang.Object, java.lang.Comparable, 
java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static  void greaterObj(final T min, final Comparable 
value) {
+greaterObj(min, value, DEFAULT_GREATER_EX_MESSAGE, value, 

[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/87#discussion_r30061829
  
--- Diff: src/main/java/org/apache/commons/lang3/Validate.java ---
@@ -874,7 +888,752 @@ public static void matchesPattern(final CharSequence 
input, final String pattern
 throw new IllegalArgumentException(String.format(message, 
values));
 }
 }
-
+
+// notNaN
+
//-
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception.
+ * 
+ * Validate.notNaN(myDouble);
+ * 
+ * The message of the exception is "The validated value is not 
a 
+ * number".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value) {
+notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
+}
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception with the specified message.
+ * 
+ * Validate.notNaN(myDouble, "The value must be a number");
+ *
+ * @param value  the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value, final String message, 
final Object... values) {
+if (value != value) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// finite
+
//-
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception.
+ * 
+ * Validate.finite(myDouble);
+ * 
+ * The message of the exception is "The value is invalid: 
%f".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value) {
+finite(value, DEFAULT_FINITE_EX_MESSAGE, value);
+}
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception with the specified message.
+ * 
+ * Validate.finite(myDouble, "The argument must contain a numeric 
value");
+ *
+ * @param value the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value, final String message, 
final Object... values) {
+if (value != value || Double.isInfinite(value)) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// greater
+
//-
+
+/**
+ * Validates that the specified argument is strictly greater than a 
given
+ * reference; otherwise throwing an exception.
+ * 
+ * Validate.greaterObj(myObject, refObject);
+ * 
+ * The message of the exception is "The value {@code value} is 
not 
+ * greater than {@code min}".
+ * 
+ * @param   the type of the argument object
+ * @param min  the reference value
+ * @param value  the object to validate
+ * @throws IllegalArgumentException if {@code value} is smaller than 
or equal to {@code min}
+ * @see #greaterObj(java.lang.Object, java.lang.Comparable, 
java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static  void greaterObj(final T min, final Comparable 
value) {
--- End diff --

Why not simply ```public static  void grea

[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/87#discussion_r30061767
  
--- Diff: src/main/java/org/apache/commons/lang3/Validate.java ---
@@ -874,7 +888,752 @@ public static void matchesPattern(final CharSequence 
input, final String pattern
 throw new IllegalArgumentException(String.format(message, 
values));
 }
 }
-
+
+// notNaN
+
//-
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception.
+ * 
+ * Validate.notNaN(myDouble);
+ * 
+ * The message of the exception is "The validated value is not 
a 
+ * number".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value) {
+notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
+}
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception with the specified message.
+ * 
+ * Validate.notNaN(myDouble, "The value must be a number");
+ *
+ * @param value  the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value, final String message, 
final Object... values) {
+if (value != value) {
+throw new IllegalArgumentException(String.format(message, 
values));
+}
+}
+
+// finite
+
//-
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception.
+ * 
+ * Validate.finite(myDouble);
+ * 
+ * The message of the exception is "The value is invalid: 
%f".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value) {
+finite(value, DEFAULT_FINITE_EX_MESSAGE, value);
+}
+
+/**
+ * Validates that the specified argument is not infinite or {@code 
NaN};
+ * otherwise throwing an exception with the specified message.
+ * 
+ * Validate.finite(myDouble, "The argument must contain a numeric 
value");
+ *
+ * @param value the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is infinite or {@code 
NaN}
+ * @see #finite(double) 
+ * 
+ * @since 3.4
+ */
+public static void finite(final double value, final String message, 
final Object... values) {
+if (value != value || Double.isInfinite(value)) {
--- End diff --

Better use ```Double.isNaN(double)``` ;)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/87#discussion_r30061627
  
--- Diff: src/main/java/org/apache/commons/lang3/Validate.java ---
@@ -874,7 +888,752 @@ public static void matchesPattern(final CharSequence 
input, final String pattern
 throw new IllegalArgumentException(String.format(message, 
values));
 }
 }
-
+
+// notNaN
+
//-
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception.
+ * 
+ * Validate.notNaN(myDouble);
+ * 
+ * The message of the exception is "The validated value is not 
a 
+ * number".
+ * 
+ * @param value  the value to validate
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double, java.lang.String, java.lang.Object...) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value) {
+notNaN(value, DEFAULT_NOT_NAN_EX_MESSAGE);
+}
+
+/**
+ * Validates that the specified argument is not {@code NaN}; 
otherwise
+ * throwing an exception with the specified message.
+ * 
+ * Validate.notNaN(myDouble, "The value must be a number");
+ *
+ * @param value  the value to validate
+ * @param message  the {@link String#format(String, Object...)} 
exception message if invalid, not null
+ * @param values  the optional values for the formatted exception 
message
+ * @throws IllegalArgumentException if the value is not a number
+ * @see #notNaN(double) 
+ * 
+ * @since 3.4
+ */
+public static void notNaN(final double value, final String message, 
final Object... values) {
+if (value != value) {
--- End diff --

Better use ```Double.isNaN(double)``` here. Reads better, IMHO.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: Lang 1134

2015-05-11 Thread britter
Github user britter commented on the pull request:

https://github.com/apache/commons-lang/pull/87#issuecomment-100986809
  
Very nice, please see my comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1124) Add split by length methods in StringUtils

2015-05-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538231#comment-14538231
 ] 

ASF GitHub Bot commented on LANG-1124:
--

Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30061452
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
+ *
+ * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", 
"g"]
--- End diff --

What would be the result of ```StringUtils.splitByLength("abcdefg", 2, 
2)```? I think it should be ["ab", "cd" "efg"].


> Add split by length methods in StringUtils
> --
>
> Key: LANG-1124
> URL: https://issues.apache.org/jira/browse/LANG-1124
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Reporter: Loic Guibert
>
> Add methods to split a String by fixed lengths :
> {code:java}
> public static String[] splitByLength(String str, int ... lengths);
> public static String[] splitByLengthRepeatedly(String str, int ... lengths);
> {code}
> Detail :
> {code:java}
> /**
>  * Split a String into an array, using an array of fixed string 
> lengths.
>  *
>  * If not null String input, the returned array size is same as the input 
> lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * Extra characters are ignored (ie String length greater than sum of 
> split lengths).
>  * All empty substrings other than zero length requested, are returned {@code 
> null}.
>  *
>  * 
>  * StringUtils.splitByLength(null, *)  = null
>  * StringUtils.splitByLength("abc")= []
>  * StringUtils.splitByLength("abc", null)  = []
>  * StringUtils.splitByLength("abc", [])= []
>  * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", null]
>  *
>  * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", "f"]
>  * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", " "]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", "", "g"]
>  * StringUtils.splitByLength("abcdefg", -1)  = {@link 
> IllegalArgumentException}
>  * 
>  *
>  * @param str  the String to parse, may be null
>  * @param lengths  the string lengths where to cut, may be null, must not be 
> negative
>  * @return an array of splitted Strings, {@code null} if null String input
>  * @throws IllegalArgumentException
>  * if one of the lengths is negative
>  */
> public static String[] splitByLength(String str, int ... lengths);
> /**
>  * Split a String into an array, using an array of fixed string lengths 
> repeated as
>  * many times as necessary to reach the String end.
>  *
>  * If not null String input, the returned array size is a multiple of the 
> input lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * All empty substrings other than zero length requested and following 
> substrings,
>  * are returned {@code null}.
>  *
>  * 
>  * StringUtils.splitByLengthRepeated(null, *)  = null
>  * StringUtils.splitB

[GitHub] commons-lang pull request: LANG-1124: Add StringUtils split by len...

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30061452
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
+ *
+ * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", 
"g"]
--- End diff --

What would be the result of ```StringUtils.splitByLength("abcdefg", 2, 
2)```? I think it should be ["ab", "cd" "efg"].


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1124) Add split by length methods in StringUtils

2015-05-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538225#comment-14538225
 ] 

ASF GitHub Bot commented on LANG-1124:
--

Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30061214
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
+ *
+ * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", 
null]
+ *
+ * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", 
"f"]
+ * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", 
" "]
+ * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", 
"", "g"]
+ * StringUtils.splitByLength("abcdefg", -1)  = {@link 
IllegalArgumentException}
--- End diff --

I'm undecided about this. The ```StringUtils.split(String, String, int)``` 
method will not fail if negative values are provided. But I'm not sure how to 
behave for an input like ```[3, -3, 3]```. I think we should handle this like 
the ```ArrayUtils``` class behaves: it promotes negative indicies to 0. So a 
negative number should add an empty string to the resulting array.


> Add split by length methods in StringUtils
> --
>
> Key: LANG-1124
> URL: https://issues.apache.org/jira/browse/LANG-1124
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Reporter: Loic Guibert
>
> Add methods to split a String by fixed lengths :
> {code:java}
> public static String[] splitByLength(String str, int ... lengths);
> public static String[] splitByLengthRepeatedly(String str, int ... lengths);
> {code}
> Detail :
> {code:java}
> /**
>  * Split a String into an array, using an array of fixed string 
> lengths.
>  *
>  * If not null String input, the returned array size is same as the input 
> lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * Extra characters are ignored (ie String length greater than sum of 
> split lengths).
>  * All empty substrings other than zero length requested, are returned {@code 
> null}.
>  *
>  * 
>  * StringUtils.splitByLength(null, *)  = null
>  * StringUtils.splitByLength("abc")= []
>  * StringUtils.splitByLength("abc", null)  = []
>  * StringUtils.splitByLength("abc", [])= []
>  * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", null]
>  *
>  * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", "f"]
>  * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", " "]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", "", "g"]
>  * StringUtils.splitByLength("abcdefg", -1)  = {@link 
> IllegalArgumentException}
>  * 
>  *
>  * @param str  the String to parse, may be null
>  * @param lengths  the string lengths where to cut, may be null, must not be 
> negative
>  * @return an array of sp

[GitHub] commons-lang pull request: LANG-1124: Add StringUtils split by len...

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30061214
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
+ *
+ * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", 
null]
+ *
+ * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", 
"f"]
+ * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", 
" "]
+ * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", 
"", "g"]
+ * StringUtils.splitByLength("abcdefg", -1)  = {@link 
IllegalArgumentException}
--- End diff --

I'm undecided about this. The ```StringUtils.split(String, String, int)``` 
method will not fail if negative values are provided. But I'm not sure how to 
behave for an input like ```[3, -3, 3]```. I think we should handle this like 
the ```ArrayUtils``` class behaves: it promotes negative indicies to 0. So a 
negative number should add an empty string to the resulting array.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: Added new addListener method that allow...

2015-05-11 Thread ZenHarbinger
GitHub user ZenHarbinger opened a pull request:

https://github.com/apache/commons-lang/pull/88

Added new addListener method that allows checking for duplicate listeners.

Added new addListener() method that takes a boolean for if duplicates are 
allowed.

Added test method to make sure that duplicate listeners are not added.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ZenHarbinger/commons-lang master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-lang/pull/88.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #88


commit a48071b0d489420bfdc0c2ed7254d1dba243f700
Author: Matthew Aguirre 
Date:   2015-05-11T17:22:50Z

Added new addListener() method that takes a boolean for if duplicates are 
allowed.
Added test method to make sure that duplicate listeners are not added.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1124) Add split by length methods in StringUtils

2015-05-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538208#comment-14538208
 ] 

ASF GitHub Bot commented on LANG-1124:
--

Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30060436
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
--- End diff --

According to ```StringUtils.split(String, char)```this should better return 
an empty array.


> Add split by length methods in StringUtils
> --
>
> Key: LANG-1124
> URL: https://issues.apache.org/jira/browse/LANG-1124
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Reporter: Loic Guibert
>
> Add methods to split a String by fixed lengths :
> {code:java}
> public static String[] splitByLength(String str, int ... lengths);
> public static String[] splitByLengthRepeatedly(String str, int ... lengths);
> {code}
> Detail :
> {code:java}
> /**
>  * Split a String into an array, using an array of fixed string 
> lengths.
>  *
>  * If not null String input, the returned array size is same as the input 
> lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * Extra characters are ignored (ie String length greater than sum of 
> split lengths).
>  * All empty substrings other than zero length requested, are returned {@code 
> null}.
>  *
>  * 
>  * StringUtils.splitByLength(null, *)  = null
>  * StringUtils.splitByLength("abc")= []
>  * StringUtils.splitByLength("abc", null)  = []
>  * StringUtils.splitByLength("abc", [])= []
>  * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", null]
>  *
>  * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", "f"]
>  * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", " "]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", "", "g"]
>  * StringUtils.splitByLength("abcdefg", -1)  = {@link 
> IllegalArgumentException}
>  * 
>  *
>  * @param str  the String to parse, may be null
>  * @param lengths  the string lengths where to cut, may be null, must not be 
> negative
>  * @return an array of splitted Strings, {@code null} if null String input
>  * @throws IllegalArgumentException
>  * if one of the lengths is negative
>  */
> public static String[] splitByLength(String str, int ... lengths);
> /**
>  * Split a String into an array, using an array of fixed string lengths 
> repeated as
>  * many times as necessary to reach the String end.
>  *
>  * If not null String input, the returned array size is a multiple of the 
> input lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * All empty substrings other than zero length requested and following 
> substrings,
>  * are returned {@code null}.
>  *
>  * 
>  * StringUtils.splitByLengthRepeated(null, *)  = null
>  * StringUtils.splitByLengthRepeated("abc")= []
>  * StringUtils.splitByLengthRepeated("abc", null)  = []
>  * StringUtils.splitByLengthR

[jira] [Commented] (LANG-1124) Add split by length methods in StringUtils

2015-05-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538210#comment-14538210
 ] 

ASF GitHub Bot commented on LANG-1124:
--

Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30060493
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
+ *
+ * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", 
null]
--- End diff --

I'm not sure whether it is a good idea to add null entries to the result.


> Add split by length methods in StringUtils
> --
>
> Key: LANG-1124
> URL: https://issues.apache.org/jira/browse/LANG-1124
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Reporter: Loic Guibert
>
> Add methods to split a String by fixed lengths :
> {code:java}
> public static String[] splitByLength(String str, int ... lengths);
> public static String[] splitByLengthRepeatedly(String str, int ... lengths);
> {code}
> Detail :
> {code:java}
> /**
>  * Split a String into an array, using an array of fixed string 
> lengths.
>  *
>  * If not null String input, the returned array size is same as the input 
> lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  * Extra characters are ignored (ie String length greater than sum of 
> split lengths).
>  * All empty substrings other than zero length requested, are returned {@code 
> null}.
>  *
>  * 
>  * StringUtils.splitByLength(null, *)  = null
>  * StringUtils.splitByLength("abc")= []
>  * StringUtils.splitByLength("abc", null)  = []
>  * StringUtils.splitByLength("abc", [])= []
>  * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
>  *
>  * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", "g"]
>  * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", null]
>  *
>  * StringUtils.splitByLength(" abcdef", 2, 4, 1) = [" a", "bcde", "f"]
>  * StringUtils.splitByLength("abcdef ", 2, 4, 1) = ["ab", "cdef", " "]
>  * StringUtils.splitByLength("abcdefg", 2, 4, 0, 1)  = ["ab", "cdef", "", "g"]
>  * StringUtils.splitByLength("abcdefg", -1)  = {@link 
> IllegalArgumentException}
>  * 
>  *
>  * @param str  the String to parse, may be null
>  * @param lengths  the string lengths where to cut, may be null, must not be 
> negative
>  * @return an array of splitted Strings, {@code null} if null String input
>  * @throws IllegalArgumentException
>  * if one of the lengths is negative
>  */
> public static String[] splitByLength(String str, int ... lengths);
> /**
>  * Split a String into an array, using an array of fixed string lengths 
> repeated as
>  * many times as necessary to reach the String end.
>  *
>  * If not null String input, the returned array size is a multiple of the 
> input lengths array.
>  *
>  * A null input String returns {@code null}.
>  * A {@code null} or empty input lengths array returns an empty array.
>  * A {@code 0} in the input lengths array results in en empty string.
>  *
>  *

[GitHub] commons-lang pull request: LANG-1124: Add StringUtils split by len...

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30060493
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
+ *
+ * StringUtils.splitByLength("abcdefg", 2, 4, 1) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefghij", 2, 4, 1)  = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdefg", 2, 4, 5) = ["ab", "cdef", 
"g"]
+ * StringUtils.splitByLength("abcdef", 2, 4, 1)  = ["ab", "cdef", 
null]
--- End diff --

I'm not sure whether it is a good idea to add null entries to the result.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] commons-lang pull request: LANG-1124: Add StringUtils split by len...

2015-05-11 Thread britter
Github user britter commented on a diff in the pull request:

https://github.com/apache/commons-lang/pull/75#discussion_r30060436
  
--- Diff: src/main/java/org/apache/commons/lang3/StringUtils.java ---
@@ -3277,6 +3277,164 @@ public static String substringBetween(final String 
str, final String open, final
 return list.toArray(new String[list.size()]);
 }
 
+/**
+ * Split a String into an array, using an array of fixed string 
lengths.
+ *
+ * If not null String input, the returned array size is same as the 
input lengths array.
+ *
+ * A null input String returns {@code null}.
+ * A {@code null} or empty input lengths array returns an empty array.
+ * A {@code 0} in the input lengths array results in en empty 
string.
+ *
+ * Extra characters are ignored (ie String length greater than sum 
of split lengths).
+ * All empty substrings other than zero length requested, are returned 
{@code null}.
+ *
+ * 
+ * StringUtils.splitByLength(null, *)  = null
+ * StringUtils.splitByLength("abc")= []
+ * StringUtils.splitByLength("abc", null)  = []
+ * StringUtils.splitByLength("abc", [])= []
+ * StringUtils.splitByLength("", 2, 4, 1)  = [null, null, null]
--- End diff --

According to ```StringUtils.split(String, char)```this should better return 
an empty array.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (LANG-1015) Add JsonToStringStyle implementation to ToStringStyle

2015-05-11 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-1015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14538203#comment-14538203
 ] 

ASF GitHub Bot commented on LANG-1015:
--

Github user asfgit closed the pull request at:

https://github.com/apache/commons-lang/pull/26


> Add JsonToStringStyle implementation to ToStringStyle
> -
>
> Key: LANG-1015
> URL: https://issues.apache.org/jira/browse/LANG-1015
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*, lang.builder.*
>Affects Versions: 4.0
>Reporter: Thiago Andrade
>Assignee: Benedikt Ritter
>  Labels: github
> Fix For: 3.4
>
>
> Placeholder ticket for github PR 26: 
> https://github.com/apache/commons-lang/pull/26



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[GitHub] commons-lang pull request: Adding the new JsonToStringStyle to ToS...

2015-05-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/commons-lang/pull/26


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---