mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8199110: Address Internet Addresses
Reviewed-by: chegar, rriggs, igerasim, skoivu, rhalade
This commit is contained in:
parent
02876bfceb
commit
627e310ba5
3 changed files with 31 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -35,6 +35,7 @@ import java.io.FileNotFoundException;
|
|||
import java.io.ObjectStreamException;
|
||||
import java.io.ObjectStreamField;
|
||||
import java.io.IOException;
|
||||
import java.io.InvalidObjectException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectInputStream.GetField;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
@ -1727,8 +1728,11 @@ class InetAddress implements java.io.Serializable {
|
|||
}
|
||||
GetField gf = s.readFields();
|
||||
String host = (String)gf.get("hostName", null);
|
||||
int address= gf.get("address", 0);
|
||||
int family= gf.get("family", 0);
|
||||
int address = gf.get("address", 0);
|
||||
int family = gf.get("family", 0);
|
||||
if (family != IPv4 && family != IPv6) {
|
||||
throw new InvalidObjectException("invalid address family type: " + family);
|
||||
}
|
||||
InetAddressHolder h = new InetAddressHolder(host, address, family);
|
||||
UNSAFE.putObject(this, FIELDS_OFFSET, h);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue