Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e50c4b4 authored by Umashankar Godachi's avatar Umashankar Godachi
Browse files

Check for NumberFormatException while parsing Long string.

In cases where parseLong is passed with a string that is
not long parsable, then NumberFormatException is thrown.
Fix is to catch the NumberFormatException in PhoneAccountRegistrar
while handling the parseLong API.

Change-Id: Ibe4cb23a0c3af769f9934ec8e11834a8c5cd092f
CRs-Fixed: 778493
parent ce0d89da
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -54,6 +54,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.Integer;
import java.lang.NumberFormatException;
import java.lang.SecurityException;
import java.lang.String;
import java.util.ArrayList;
@@ -180,8 +181,12 @@ public final class PhoneAccountRegistrar {
                   Log.i(this, "getUserSelVoicePhoneAccount, emergency account ");
                   return mState.accounts.get(i).getAccountHandle();
                }

                long subId = Long.parseLong(id);
                long subId = voiceSubId;
                try {
                    subId = Long.parseLong(id);
                } catch (NumberFormatException e) {
                    Log.w(this, " NumberFormatException " + e);
                }
                Log.i(this, "getUserSelectedVoicePhoneAccount, voice subId = "
                         + voiceSubId + " subId = " + subId + " mId = " + id);
                if (subId == voiceSubId) {
@@ -244,7 +249,12 @@ public final class PhoneAccountRegistrar {
                Log.i(this, "setDefaultVoicePhoneAccount, only emergency account present ");
                return;
            }
            long subId = Long.parseLong(mState.defaultOutgoing.getId());
            Long subId = SubscriptionManager.getDefaultVoiceSubId();
            try {
                subId = Long.parseLong(mState.defaultOutgoing.getId());
            } catch (NumberFormatException e) {
                Log.w(this, " NumberFormatException " + e);
            }
            Log.i(this, "set voice default subId as  " + subId + " prmotp = " + voicePrompt);
            if (SubscriptionManager.getDefaultVoiceSubId() != subId) {
                SubscriptionManager.setDefaultVoiceSubId(subId);