OSDN Git Service

Make copy-constructor make deep copy.
authorRobert Greenwalt <rgreenwalt@google.com>
Fri, 29 Jul 2011 00:21:25 +0000 (17:21 -0700)
committerRobert Greenwalt <rgreenwalt@google.com>
Fri, 29 Jul 2011 00:21:25 +0000 (17:21 -0700)
Used to grab immutables but now will copy the data so the result
is mutable and we don't get crashes.

bug:5051667
Change-Id: I0878bf8c58069055f528121541d1911f404cbe49

core/java/android/net/LinkProperties.java

index 132f3ba..75646fd 100644 (file)
@@ -80,9 +80,9 @@ public class LinkProperties implements Parcelable {
     public LinkProperties(LinkProperties source) {
         if (source != null) {
             mIfaceName = source.getInterfaceName();
-            mLinkAddresses = source.getLinkAddresses();
-            mDnses = source.getDnses();
-            mRoutes = source.getRoutes();
+            for (LinkAddress l : source.getLinkAddresses()) mLinkAddresses.add(l);
+            for (InetAddress i : source.getDnses()) mDnses.add(i);
+            for (RouteInfo r : source.getRoutes()) mRoutes.add(r);
             mHttpProxy = (source.getHttpProxy() == null)  ?
                 null : new ProxyProperties(source.getHttpProxy());
         }