Alon Bar-Lev 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 empty string from server and have empty list and remove conditionals. 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: allLocales.removeAll(unsupportedLocales.removeAll(displayLocales)) or if you want in-place... result = new LinkedList(allLocales).removeAll( new LinkedList(unsupportedLocales).removeAll(displayLocales) ) Collections.sort(result); return result; 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... 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