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

Commit 26ee800a authored by Harout Hedeshian's avatar Harout Hedeshian Committed by Steve Kondik
Browse files

NetworkManagementService: Change exception type thrown on IPv6

Changed the exception type thrown from IllegalStateException to
RemoteException whenever the IPv6 tethering rules fail to apply. The
IllegalStateException is not caught by the caller causing the JVM
to crash. By throwing RemoteException, the caller will catch and
print and error message instead of crashing.

CRs-Fixed: 662171
Change-Id: I92fadd43479a330f09bb20f699a4b9852123ab68
parent 9d4e4557
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -575,7 +575,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
    }

    @Override
    public void addUpstreamV6Interface(String iface) throws IllegalStateException {
    public void addUpstreamV6Interface(String iface) throws RemoteException {
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.ACCESS_NETWORK_STATE, "NetworkManagementService");

@@ -585,12 +585,12 @@ public class NetworkManagementService extends INetworkManagementService.Stub
            cmd.appendArg(iface);
            mConnector.execute(cmd);
        } catch (NativeDaemonConnectorException e) {
            throw new IllegalStateException("Cannot add upstream interface");
            throw new RemoteException("Cannot add upstream interface");
        }
    }

    @Override
    public void removeUpstreamV6Interface(String iface) throws IllegalStateException {
    public void removeUpstreamV6Interface(String iface) throws RemoteException {
        mContext.enforceCallingOrSelfPermission(
                android.Manifest.permission.ACCESS_NETWORK_STATE, "NetworkManagementService");

@@ -601,7 +601,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub
            cmd.appendArg(iface);
            mConnector.execute(cmd);
        } catch (NativeDaemonConnectorException e) {
            throw new IllegalStateException("Cannot remove upstream interface");
            throw new RemoteException("Cannot remove upstream interface");
        }
    }