From caf8cf5cf5e464b9b26ab15e2f502b04eeac9b9b Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Wed, 9 Feb 2011 14:12:38 -0800 Subject: [PATCH] Use the new LinkProperties gateways. Changed from singular gateway InetAddress to plural. bug:3438810 Change-Id: I07dff8b7dd620a444b5ba2e4f7a87c76a0736fdb --- .../settings/wifi/WifiConfigController.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index 750e168b2e6..e336032ac8d 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -424,7 +424,13 @@ public class WifiConfigController implements TextWatcher, if (!InetAddress.isNumeric(gateway)) { return R.string.wifi_ip_settings_invalid_gateway; } - linkProperties.setGateway(InetAddress.getByName(gateway)); + InetAddress gatewayAddr; + try { + gatewayAddr = InetAddress.getByName(gateway); + } catch (UnknownHostException e) { + return R.string.wifi_ip_settings_invalid_gateway; + } + linkProperties.addGateway(gatewayAddr); String dns = mDns1View.getText().toString(); if (!InetAddress.isNumeric(dns)) { @@ -594,9 +600,10 @@ public class WifiConfigController implements TextWatcher, mNetworkPrefixLengthView.setText(Integer.toString(linkAddress .getNetworkPrefixLength())); } - InetAddress gateway = linkProperties.getGateway(); - if (gateway != null) { - mGatewayView.setText(linkProperties.getGateway().getHostAddress()); + + Iteratorgateways = linkProperties.getGateways().iterator(); + if (gateways.hasNext()) { + mGatewayView.setText(gateways.next().getHostAddress()); } Iterator dnsIterator = linkProperties.getDnses().iterator(); if (dnsIterator.hasNext()) {