|
View:
New views
18 Messages
—
Rating Filter:
Alert me
|
|
|
[jira] Created: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentExceptionAdd methods to return boolean from Validate.java instead of throwing IllegalArgumentException
--------------------------------------------------------------------------------------------- Key: LANG-458 URL: https://issues.apache.org/jira/browse/LANG-458 Project: Commons Lang Issue Type: Improvement Environment: software Reporter: Viraj Turakhia Priority: Minor I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. With current interface, I go like this: while(cnt < list.size()) { List list1 = list.get(cnt); try { Validate.notEmpty(list1); } catch(IllegalArgumentException e) { continue; } } much better approach is: while(cnt < list.size()) { List list1 = list.get(cnt); try { if(! Validate.notEmpty(list1)) { continue; } } If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630763#action_12630763 ] James Carman commented on LANG-458: ----------------------------------- We couldn't use that particular API since it would break existing applications (you can't have a method with the same name and parameter types and a different return type). Perhaps adding a new class called Validations (Validate could be based on it)? \\ \\ {code} if(!Valdations.isEmpty(list)) { continue; } {code} > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12630857#action_12630857 ] Viraj Turakhia commented on LANG-458: ------------------------------------- I agree, we can't change existing API and return type is not Java's signature part. But I was hoping to add isXX equivalent for existing methods. e.g. boolean isEmpty(Collection c) boolean isNull(Object o) boolean hasElementOfType(Collection c, Class clazz) .. etc > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Viraj Turakhia updated LANG-458: -------------------------------- Attachment: test_diff.txt code_diff.txt Attaching diff for Validate.java and ValidateTest.java with all those newly added APIs. Let me know if anything is missing. How can I check this in? > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632919#action_12632919 ] Viraj Turakhia commented on LANG-458: ------------------------------------- Can this issue be also assigned to me? Thanks. > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632937#action_12632937 ] James Carman commented on LANG-458: ----------------------------------- Are you an Apache Commons Committer? If not, then we can't assign it to you. However, I would like if some other folks on the Apache Commons team would chime in on this as to whether they think it's an appropriate addition to the API. If they're cool with it, I have no problem applying your patch for you. Don't worry, you'll get credit since your patch is listed here. :) > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632939#action_12632939 ] Viraj Turakhia commented on LANG-458: ------------------------------------- Thanks James. Let me know what it takes to be one of those apache commons committers. > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632944#action_12632944 ] Stephen Colebourne commented on LANG-458: ----------------------------------------- I would say that this class has a single purpose at present, and that is to act as an guard on entry to a method, with an exception being the result. We should not add isXxx methods returning a boolean to Validate. Furthermore, I'm not sure there is any need for a class in [lang] that has those boolean return types. The majority of the functions of Validate that would be converted are available elsewhere, such as StringUtils.isEmpty, or CollectionUtils.isEmpty. > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632945#action_12632945 ] James Carman commented on LANG-458: ----------------------------------- I would perhaps check out: http://www.apache.org/foundation/how-it-works.html to understand the "Apache Way". Basically, you start by submitting patches and perhaps becoming active on the mailing lists. When someone on the PMC takes notice of your contribution(s), they'll propose a vote to add you as a committer and then let you know via email that you're "in" (if the vote passes of course). Good luck and thanks for the interest in helping out! > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632949#action_12632949 ] Viraj Turakhia commented on LANG-458: ------------------------------------- Hi Stephen, I am sorry, I could not find CollectionUtils in [lang]. Please help me in finding it. I agree we should not have Validate.isEmpty() if present elsewhere. But should we not call that method from Validate.notEmpty() so as to avoid code duplication. Also, I could not see methods like hasNullElement() in ArrayUtils which, I think, are very helpful methods and clients might not always want to see exception being thrown. Let me know your thoughts. > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632950#action_12632950 ] Sebb commented on LANG-458: --------------------------- All the methods currently throw Exceptions. I think it would be very confusing for some methods to return boolean instead. I agree with Stephen that it is out of scope for the Validate class. As mentioned earlier, LANG already has boolean validation checks in StringUtils, and Commons Collections has CollectionUtils which together offer even more methods. The proposed method hasNullElement() would be a useful addition to LANG ArrayUtils (which Validate could then use as it is in the same jar) and to Commons Collections CollectionUtils. Best to raise separate JIRAs for those. > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12632998#action_12632998 ] Viraj Turakhia commented on LANG-458: ------------------------------------- Fair enough. I agree with you all on your comments. I will add methods in corresponding class against a new JIRA issue. We are good to close this issue. Thanks for comments. > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Commented: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12633148#action_12633148 ] Viraj Turakhia commented on LANG-458: ------------------------------------- By the way, I still think we should call notXXX(Object o, String message) from notXXX(Object o) with hard coded message to reduce code duplication. I will submit a patch for the same (which will be subset of what I have already sent). > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: code_diff.txt, test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Viraj Turakhia updated LANG-458: -------------------------------- Attachment: (was: code_diff.txt) > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: vaidate_diff.txt, validate_test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Viraj Turakhia updated LANG-458: -------------------------------- Attachment: validate_test_diff.txt vaidate_diff.txt As per the discussion, attaching diff for code and test file (Validate.java and ValidateTest.java). Change includes removing code duplication and adding of two utility methods. Let me know what you think. > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: vaidate_diff.txt, validate_test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (LANG-458) Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Viraj Turakhia updated LANG-458: -------------------------------- Attachment: (was: test_diff.txt) > Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException > --------------------------------------------------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Attachments: vaidate_diff.txt, validate_test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Updated: (LANG-458) Refactor Validate.java to eliminate code redundancy[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Yandell updated LANG-458: ------------------------------- Fix Version/s: 3.0 Summary: Refactor Validate.java to eliminate code redundancy (was: Add methods to return boolean from Validate.java instead of throwing IllegalArgumentException) Renaming issue to match patches > Refactor Validate.java to eliminate code redundancy > --------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Fix For: 3.0 > > Attachments: vaidate_diff.txt, validate_test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
|
|
[jira] Closed: (LANG-458) Refactor Validate.java to eliminate code redundancy[ https://issues.apache.org/jira/browse/LANG-458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Yandell closed LANG-458. ------------------------------ Resolution: Fixed Refactoring applied. New methods not applied as they don't fit the pattern of methods in Validate. There's a return type, and an exception is thrown when the method statement is not true, not when it is true. > Refactor Validate.java to eliminate code redundancy > --------------------------------------------------- > > Key: LANG-458 > URL: https://issues.apache.org/jira/browse/LANG-458 > Project: Commons Lang > Issue Type: Improvement > Environment: software > Reporter: Viraj Turakhia > Priority: Minor > Fix For: 3.0 > > Attachments: vaidate_diff.txt, validate_test_diff.txt > > > I am using Validate.java since long and find it difficult to use when I just want to validate collections or string. > With current interface, I go like this: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > Validate.notEmpty(list1); > } catch(IllegalArgumentException e) { > continue; > } > } > much better approach is: > while(cnt < list.size()) { > List list1 = list.get(cnt); > try { > if(! Validate.notEmpty(list1)) { > continue; > } > } > If you all agree with this change, I am willing to submit a patch for this. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
| Free embeddable forum powered by Nabble | Forum Help |