diff options
| author | 2017-08-01 19:30:28 -0700 | |
|---|---|---|
| committer | 2017-08-02 10:37:07 -0700 | |
| commit | 4e5e15a6ea116ec5ca2ef83dde4f45cda2f52419 (patch) | |
| tree | cb5e07f091b8611c9345ea0240f55a0de849cc19 | |
| parent | 0a0bc5f89df11ef4a32268cc22c0933ac46c0654 (diff) | |
Make InputFilter.AllCaps constructor reject null locales
In I021ff2a97a60396fb1b6e4940d91d3cd6ccb6196, new API for
InputFilter.AllCaps was added. It accepted null as input. This CL
changes that so null locales would be rejected.
Test: bit CtsTextTestCases:android.text.cts.InputFilter_AllCapsTest
Fixes: 64261334
Bug: 37222101
Change-Id: Ic87942c3f341f71bc3c1c833b52ea3e751461e47
| -rw-r--r-- | core/java/android/text/InputFilter.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/core/java/android/text/InputFilter.java b/core/java/android/text/InputFilter.java index d773158ed0cb..a507f2b373fc 100644 --- a/core/java/android/text/InputFilter.java +++ b/core/java/android/text/InputFilter.java @@ -16,7 +16,9 @@ package android.text; -import android.annotation.Nullable; +import android.annotation.NonNull; + +import com.android.internal.util.Preconditions; import java.util.Locale; @@ -64,7 +66,8 @@ public interface InputFilter * Constructs a locale-specific AllCaps filter, to make sure capitalization rules of that * locale are used for transforming the sequence. */ - public AllCaps(@Nullable Locale locale) { + public AllCaps(@NonNull Locale locale) { + Preconditions.checkNotNull(locale); mLocale = locale; } |