mirror of
https://github.com/signalapp/Signal-Server
synced 2026-08-04 22:13:42 +01:00
Handle MCC-only HLR responses
This commit is contained in:
+1
-1
@@ -171,7 +171,7 @@ public class HlrLookupCarrierDataProvider implements CarrierDataProvider {
|
||||
static Optional<String> mncFromMccMnc(@Nullable final String mccMnc) {
|
||||
// MNCs may be 2 or 3 digits, but always come after a 3-digit MCC
|
||||
return Optional.ofNullable(StringUtils.stripToNull(mccMnc))
|
||||
.map(trimmedMccMnc -> trimmedMccMnc.substring(3));
|
||||
.map(trimmedMccMnc -> StringUtils.stripToNull(trimmedMccMnc.substring(3)));
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
+4
-2
@@ -187,7 +187,8 @@ class HlrLookupCarrierDataProviderTest {
|
||||
Arguments.argumentSet("Empty mccMnc string", "", Optional.empty()),
|
||||
Arguments.argumentSet("Blank mccMnc string", " ", Optional.empty()),
|
||||
Arguments.argumentSet("Two-digit MNC", "12345", Optional.of("123")),
|
||||
Arguments.argumentSet("Three-digit MNC", "123456", Optional.of("123"))
|
||||
Arguments.argumentSet("Three-digit MNC", "123456", Optional.of("123")),
|
||||
Arguments.argumentSet("MCC-only", "123", Optional.of("123"))
|
||||
);
|
||||
}
|
||||
|
||||
@@ -204,7 +205,8 @@ class HlrLookupCarrierDataProviderTest {
|
||||
Arguments.argumentSet("Empty mccMnc string", "", Optional.empty()),
|
||||
Arguments.argumentSet("Blank mccMnc string", " ", Optional.empty()),
|
||||
Arguments.argumentSet("Two-digit MNC", "12345", Optional.of("45")),
|
||||
Arguments.argumentSet("Three-digit MNC", "123456", Optional.of("456"))
|
||||
Arguments.argumentSet("Three-digit MNC", "123456", Optional.of("456")),
|
||||
Arguments.argumentSet("MCC-only", "123", Optional.empty())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user