Martin Peřina has posted comments on this change. Change subject: core: replace regexp validation for user email. ......................................................................
Patch Set 1: (3 comments) http://gerrit.ovirt.org/#/c/28742/1/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/EventSubscriptionCommandBase.java: Line 148: * The input email. Line 149: * @return <c>true</c> if [is valid email] [the specified input email]; Line 150: * otherwise, <c>false</c>. Line 151: */ Line 152: protected static boolean ValidatMailAddress(String inputEmail) { Also please prepare another patch and rename method to something correct/meaningfull, for example isEmailValid() isEmailAddressValid() Line 153: try { Line 154: new InternetAddress(inputEmail, true); Line 155: } catch (AddressException e) { Line 156: return false; Line 151: */ Line 152: protected static boolean ValidatMailAddress(String inputEmail) { Line 153: try { Line 154: new InternetAddress(inputEmail, true); Line 155: } catch (AddressException e) { Are you sure that NPE is not thrown if inputEmail is null? Line 156: return false; Line 157: } Line 158: return true; Line 159: } Line 155: } catch (AddressException e) { Line 156: return false; Line 157: } Line 158: return true; Line 159: } Personally I prefer only 1 return statement in method: protected static boolean ValidatMailAddress(String inputEmail) { boolean valid = false; try { new InternetAddress(inputEmail, true); valid = true; } catch (Exception ex) { // no need to log error } return valid; } Line 160: Line 161: private static boolean ValidateSubscription(Iterable<event_subscriber> subscriptions, event_subscriber current) { Line 162: boolean retValue = false; Line 163: for (event_subscriber event_subscriber : subscriptions) { -- To view, visit http://gerrit.ovirt.org/28742 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I18904a669453baef632af1cd427b61852e7ab583 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: mooli tayer <[email protected]> Gerrit-Reviewer: Alon Bar-Lev <[email protected]> Gerrit-Reviewer: Martin Peřina <[email protected]> Gerrit-Reviewer: Oved Ourfali <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: mooli tayer <[email protected]> Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
