src/java.base/share/classes/java/net/Inet6Address.java

Print this page
rev 12972 : 8140606: Update library code to use internal Unsafe
Reviewed-by: duke


 559         throw new UnknownHostException ("No matching address found for interface : " +ifname);
 560     }
 561 
 562     /**
 563      * @serialField ipaddress byte[]
 564      * @serialField scope_id int
 565      * @serialField scope_id_set boolean
 566      * @serialField scope_ifname_set boolean
 567      * @serialField ifname String
 568      */
 569 
 570     private static final ObjectStreamField[] serialPersistentFields = {
 571          new ObjectStreamField("ipaddress", byte[].class),
 572          new ObjectStreamField("scope_id", int.class),
 573          new ObjectStreamField("scope_id_set", boolean.class),
 574          new ObjectStreamField("scope_ifname_set", boolean.class),
 575          new ObjectStreamField("ifname", String.class)
 576     };
 577 
 578     private static final long FIELDS_OFFSET;
 579     private static final sun.misc.Unsafe UNSAFE;
 580 
 581     static {
 582         try {
 583             sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
 584             FIELDS_OFFSET = unsafe.objectFieldOffset(
 585                     Inet6Address.class.getDeclaredField("holder6"));
 586             UNSAFE = unsafe;
 587         } catch (ReflectiveOperationException e) {
 588             throw new Error(e);
 589         }
 590     }
 591 
 592     /**
 593      * restore the state of this object from stream
 594      * including the scope information, only if the
 595      * scoped interface name is valid on this system
 596      */
 597     private void readObject(ObjectInputStream s)
 598         throws IOException, ClassNotFoundException {
 599         NetworkInterface scope_ifname = null;
 600 
 601         if (getClass().getClassLoader() != null) {
 602             throw new SecurityException ("invalid address type");
 603         }




 559         throw new UnknownHostException ("No matching address found for interface : " +ifname);
 560     }
 561 
 562     /**
 563      * @serialField ipaddress byte[]
 564      * @serialField scope_id int
 565      * @serialField scope_id_set boolean
 566      * @serialField scope_ifname_set boolean
 567      * @serialField ifname String
 568      */
 569 
 570     private static final ObjectStreamField[] serialPersistentFields = {
 571          new ObjectStreamField("ipaddress", byte[].class),
 572          new ObjectStreamField("scope_id", int.class),
 573          new ObjectStreamField("scope_id_set", boolean.class),
 574          new ObjectStreamField("scope_ifname_set", boolean.class),
 575          new ObjectStreamField("ifname", String.class)
 576     };
 577 
 578     private static final long FIELDS_OFFSET;
 579     private static final jdk.internal.misc.Unsafe UNSAFE;
 580 
 581     static {
 582         try {
 583             jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
 584             FIELDS_OFFSET = unsafe.objectFieldOffset(
 585                     Inet6Address.class.getDeclaredField("holder6"));
 586             UNSAFE = unsafe;
 587         } catch (ReflectiveOperationException e) {
 588             throw new Error(e);
 589         }
 590     }
 591 
 592     /**
 593      * restore the state of this object from stream
 594      * including the scope information, only if the
 595      * scoped interface name is valid on this system
 596      */
 597     private void readObject(ObjectInputStream s)
 598         throws IOException, ClassNotFoundException {
 599         NetworkInterface scope_ifname = null;
 600 
 601         if (getClass().getClassLoader() != null) {
 602             throw new SecurityException ("invalid address type");
 603         }