Alexander Wels has posted comments on this change. Change subject: engine,userportal,webadmin: enhance locale selection ......................................................................
Patch Set 3: (3 comments) http://gerrit.ovirt.org/#/c/27973/3/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/UnsupportedLocaleHelper.java File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/servlet/UnsupportedLocaleHelper.java: Line 23: List<String> result = allLocales; Line 24: if (displayLocales == null) { Line 25: displayLocales = new ArrayList<String>(); Line 26: } Line 27: if (unsupportedLocales != null) { > how can it be null? why not just always work with empty lists? you get empt More defensive programming than anything, I marked they cannot be null in the documentation. Line 28: unsupportedLocales.removeAll(displayLocales); Line 29: for (String unsupportedLocale: unsupportedLocales) { Line 30: result.remove(unsupportedLocale); Line 31: } Line 26: } Line 27: if (unsupportedLocales != null) { Line 28: unsupportedLocales.removeAll(displayLocales); Line 29: for (String unsupportedLocale: unsupportedLocales) { Line 30: result.remove(unsupportedLocale); > why can't you have this: Done Line 31: } Line 32: } Line 33: Collections.sort(result); Line 34: return result; Line 48: for (String localeKey: localeKeys) { Line 49: try { Line 50: //Check for valid locale. Line 51: org.apache.commons.lang.LocaleUtils.toLocale(localeKey.trim()); Line 52: result.add(localeKey.trim()); > so you do not need to trim now... Actually I do as the following is possible for the string: ' fr_Fr , ko_KR ' This leaves leading and trailing spaces on the first and last element, so I still need to trim even with that regex. Line 53: } catch (IllegalArgumentException iae) { Line 54: //The locale passed in is not valid, don't add it to the list. Line 55: } Line 56: } -- To view, visit http://gerrit.ovirt.org/27973 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5b816694d6c34549360b189eb85c840688957bdb Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alexander Wels <aw...@redhat.com> Gerrit-Reviewer: Alexander Wels <aw...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Einav Cohen <eco...@redhat.com> Gerrit-Reviewer: Greg Sheremeta <gsher...@redhat.com> Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches