equal
deleted
inserted
replaced
208 // Perform native initialization |
208 // Perform native initialization |
209 static { init(); } |
209 static { init(); } |
210 |
210 |
211 Inet6Address() { |
211 Inet6Address() { |
212 super(); |
212 super(); |
213 hostName = null; |
213 holder().hostName = null; |
214 ipaddress = new byte[INADDRSZ]; |
214 ipaddress = new byte[INADDRSZ]; |
215 family = IPv6; |
215 holder().family = IPv6; |
216 } |
216 } |
217 |
217 |
218 /* checking of value for scope_id should be done by caller |
218 /* checking of value for scope_id should be done by caller |
219 * scope_id must be >= 0, or -1 to indicate not being set |
219 * scope_id must be >= 0, or -1 to indicate not being set |
220 */ |
220 */ |
221 Inet6Address(String hostName, byte addr[], int scope_id) { |
221 Inet6Address(String hostName, byte addr[], int scope_id) { |
222 this.hostName = hostName; |
222 holder().hostName = hostName; |
223 if (addr.length == INADDRSZ) { // normal IPv6 address |
223 if (addr.length == INADDRSZ) { // normal IPv6 address |
224 family = IPv6; |
224 holder().family = IPv6; |
225 ipaddress = addr.clone(); |
225 ipaddress = addr.clone(); |
226 } |
226 } |
227 if (scope_id >= 0) { |
227 if (scope_id >= 0) { |
228 this.scope_id = scope_id; |
228 this.scope_id = scope_id; |
229 scope_id_set = true; |
229 scope_id_set = true; |
333 } |
333 } |
334 |
334 |
335 private void initif(String hostName, byte addr[],NetworkInterface nif) |
335 private void initif(String hostName, byte addr[],NetworkInterface nif) |
336 throws UnknownHostException |
336 throws UnknownHostException |
337 { |
337 { |
338 this.hostName = hostName; |
338 holder().hostName = hostName; |
339 if (addr.length == INADDRSZ) { // normal IPv6 address |
339 if (addr.length == INADDRSZ) { // normal IPv6 address |
340 family = IPv6; |
340 holder().family = IPv6; |
341 ipaddress = addr.clone(); |
341 ipaddress = addr.clone(); |
342 } |
342 } |
343 if (nif != null) { |
343 if (nif != null) { |
344 scope_ifname = nif; |
344 scope_ifname = nif; |
345 scope_id = deriveNumericScope(nif); |
345 scope_id = deriveNumericScope(nif); |
418 * including the scope information, only if the |
418 * including the scope information, only if the |
419 * scoped interface name is valid on this system |
419 * scoped interface name is valid on this system |
420 */ |
420 */ |
421 private void readObject(ObjectInputStream s) |
421 private void readObject(ObjectInputStream s) |
422 throws IOException, ClassNotFoundException { |
422 throws IOException, ClassNotFoundException { |
|
423 |
|
424 if (getClass().getClassLoader() != null) { |
|
425 throw new SecurityException ("invalid address type"); |
|
426 } |
|
427 |
423 s.defaultReadObject(); |
428 s.defaultReadObject(); |
424 |
429 |
425 if (ifname != null && !ifname.equals("")) { |
430 if (ifname != null && !ifname.equals("")) { |
426 try { |
431 try { |
427 scope_ifname = NetworkInterface.getByName(ifname); |
432 scope_ifname = NetworkInterface.getByName(ifname); |
445 if (ipaddress.length != INADDRSZ) { |
450 if (ipaddress.length != INADDRSZ) { |
446 throw new InvalidObjectException("invalid address length: "+ |
451 throw new InvalidObjectException("invalid address length: "+ |
447 ipaddress.length); |
452 ipaddress.length); |
448 } |
453 } |
449 |
454 |
450 if (family != IPv6) { |
455 if (holder().getFamily() != IPv6) { |
451 throw new InvalidObjectException("invalid address family type"); |
456 throw new InvalidObjectException("invalid address family type"); |
452 } |
457 } |
453 } |
458 } |
454 |
459 |
455 /** |
460 /** |