File tree Expand file tree Collapse file tree
domain-core/src/main/java/org/opentripplanner/core/model/i18n Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,20 +71,23 @@ public static I18NString getI18NString(
7171 if (translations .isEmpty ()) {
7272 throw new IllegalArgumentException ("At least one translation must be provided" );
7373 }
74- return translationCache .computeIfAbsent (translations , k -> {
74+ I18NString ret = translationCache .get (translations );
75+ if (ret == null ) {
7576 // Check if we only have one name, even under multiple languages
7677 boolean allValuesEqual = new HashSet <>(translations .values ()).size () == 1 ;
7778 var firstLanguage = translations .keySet ().iterator ().next ();
7879 boolean onlySingleUntranslatedLanguage =
7980 translations .size () == 1 && (firstLanguage == null || firstLanguage .isBlank ());
8081 if (forceTranslatedString && !onlySingleUntranslatedLanguage ) {
81- return new TranslatedString (translations );
82+ ret = new TranslatedString (translations );
8283 } else if (allValuesEqual ) {
83- return new NonLocalizedString (translations .values ().iterator ().next ());
84+ ret = new NonLocalizedString (translations .values ().iterator ().next ());
8485 } else {
85- return new TranslatedString (translations );
86+ ret = new TranslatedString (translations );
8687 }
87- });
88+ translationCache .put (translations , ret );
89+ }
90+ return ret ;
8891 }
8992
9093 @ Override
You can’t perform that action at this time.
0 commit comments