1476
1477 if (impl == null) {
1478 try {
1479 impl = Class.forName(implName).newInstance();
1480 } catch (Exception e) {
1481 throw new Error("System property impl.prefix incorrect");
1482 }
1483 }
1484
1485 return (InetAddressImpl) impl;
1486 }
1487
1488 private void readObjectNoData (ObjectInputStream s) throws
1489 IOException, ClassNotFoundException {
1490 if (getClass().getClassLoader() != null) {
1491 throw new SecurityException ("invalid address type");
1492 }
1493 }
1494
1495 private static final long FIELDS_OFFSET;
1496 private static final sun.misc.Unsafe UNSAFE;
1497
1498 static {
1499 try {
1500 sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe();
1501 FIELDS_OFFSET = unsafe.objectFieldOffset(
1502 InetAddress.class.getDeclaredField("holder")
1503 );
1504 UNSAFE = unsafe;
1505 } catch (ReflectiveOperationException e) {
1506 throw new Error(e);
1507 }
1508 }
1509
1510 private void readObject (ObjectInputStream s) throws
1511 IOException, ClassNotFoundException {
1512 if (getClass().getClassLoader() != null) {
1513 throw new SecurityException ("invalid address type");
1514 }
1515 GetField gf = s.readFields();
1516 String host = (String)gf.get("hostName", null);
1517 int address= gf.get("address", 0);
1518 int family= gf.get("family", 0);
1519 InetAddressHolder h = new InetAddressHolder(host, address, family);
1520 UNSAFE.putObject(this, FIELDS_OFFSET, h);
|
1476
1477 if (impl == null) {
1478 try {
1479 impl = Class.forName(implName).newInstance();
1480 } catch (Exception e) {
1481 throw new Error("System property impl.prefix incorrect");
1482 }
1483 }
1484
1485 return (InetAddressImpl) impl;
1486 }
1487
1488 private void readObjectNoData (ObjectInputStream s) throws
1489 IOException, ClassNotFoundException {
1490 if (getClass().getClassLoader() != null) {
1491 throw new SecurityException ("invalid address type");
1492 }
1493 }
1494
1495 private static final long FIELDS_OFFSET;
1496 private static final jdk.internal.misc.Unsafe UNSAFE;
1497
1498 static {
1499 try {
1500 jdk.internal.misc.Unsafe unsafe = jdk.internal.misc.Unsafe.getUnsafe();
1501 FIELDS_OFFSET = unsafe.objectFieldOffset(
1502 InetAddress.class.getDeclaredField("holder")
1503 );
1504 UNSAFE = unsafe;
1505 } catch (ReflectiveOperationException e) {
1506 throw new Error(e);
1507 }
1508 }
1509
1510 private void readObject (ObjectInputStream s) throws
1511 IOException, ClassNotFoundException {
1512 if (getClass().getClassLoader() != null) {
1513 throw new SecurityException ("invalid address type");
1514 }
1515 GetField gf = s.readFields();
1516 String host = (String)gf.get("hostName", null);
1517 int address= gf.get("address", 0);
1518 int family= gf.get("family", 0);
1519 InetAddressHolder h = new InetAddressHolder(host, address, family);
1520 UNSAFE.putObject(this, FIELDS_OFFSET, h);
|