提交 79d4cbe1 编写于 作者: C chegar

7090158: Networking Libraries don't build with javac -Werror

Summary: Minor changes to networking java files to remove warnings
Reviewed-by: chegar, weijun, hawtin
Contributed-by: kurchi.subhra.hazra@oracle.com, sasha_bu@hotmail.com
上级 18af0f90
# #
# Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
BUILDDIR = ../../../.. BUILDDIR = ../../../..
PACKAGE = com.sun.net.httpserver PACKAGE = com.sun.net.httpserver
PRODUCT = sun PRODUCT = sun
JAVAC_MAX_WARNINGS = true
JAVAC_WARNINGS_FATAL = true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
# #
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
BUILDDIR = ../../../.. BUILDDIR = ../../../..
PACKAGE = com.sun.net.ssl PACKAGE = com.sun.net.ssl
PRODUCT = sun PRODUCT = sun
JAVAC_LINT_OPTIONS=-Xlint:all,-deprecation
JAVAC_MAX_WARNINGS = true
JAVAC_WARNINGS_FATAL = true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
# #
......
...@@ -27,6 +27,9 @@ BUILDDIR = ../.. ...@@ -27,6 +27,9 @@ BUILDDIR = ../..
PACKAGE = java.net PACKAGE = java.net
LIBRARY = net LIBRARY = net
PRODUCT = sun PRODUCT = sun
JAVAC_MAX_WARNINGS = true
JAVAC_WARNINGS_FATAL = true
JAVAC_LINT_OPTIONS = -Xlint:all,-deprecation
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
# #
......
# #
# Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
# #
BUILDDIR = ../.. BUILDDIR = ../..
JAVAC_MAX_WARNINGS = true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
# #
......
# #
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
BUILDDIR = ../.. BUILDDIR = ../..
PACKAGE = sun.net PACKAGE = sun.net
PRODUCT = sun PRODUCT = sun
SUBDIRS_MAKEFLAGS += JAVAC_MAX_WARNINGS=true
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
SUBDIRS = others spi SUBDIRS = others spi
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
# #
BUILDDIR = ../../.. BUILDDIR = ../../..
SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
SUBDIRS_misc = nameservice SUBDIRS_misc = nameservice
......
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
# #
BUILDDIR = ../../../../.. BUILDDIR = ../../../../..
JAVAC_MAX_WARNINGS = true
JAVAC_WARNINGS_FATAL = true
# dns should probably be its own module # dns should probably be its own module
PACKAGE = sun.net.spi.nameservice.dns PACKAGE = sun.net.spi.nameservice.dns
PRODUCT = sun PRODUCT = sun
......
/* /*
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -54,13 +54,13 @@ public abstract class BasicAuthenticator extends Authenticator { ...@@ -54,13 +54,13 @@ public abstract class BasicAuthenticator extends Authenticator {
public Result authenticate (HttpExchange t) public Result authenticate (HttpExchange t)
{ {
Headers rmap = (Headers) t.getRequestHeaders(); Headers rmap = t.getRequestHeaders();
/* /*
* look for auth token * look for auth token
*/ */
String auth = rmap.getFirst ("Authorization"); String auth = rmap.getFirst ("Authorization");
if (auth == null) { if (auth == null) {
Headers map = (Headers) t.getResponseHeaders(); Headers map = t.getResponseHeaders();
map.set ("WWW-Authenticate", "Basic realm=" + "\""+realm+"\""); map.set ("WWW-Authenticate", "Basic realm=" + "\""+realm+"\"");
return new Authenticator.Retry (401); return new Authenticator.Retry (401);
} }
...@@ -83,7 +83,7 @@ public abstract class BasicAuthenticator extends Authenticator { ...@@ -83,7 +83,7 @@ public abstract class BasicAuthenticator extends Authenticator {
} else { } else {
/* reject the request again with 401 */ /* reject the request again with 401 */
Headers map = (Headers) t.getResponseHeaders(); Headers map = t.getResponseHeaders();
map.set ("WWW-Authenticate", "Basic realm=" + "\""+realm+"\""); map.set ("WWW-Authenticate", "Basic realm=" + "\""+realm+"\"");
return new Authenticator.Failure(401); return new Authenticator.Failure(401);
} }
......
/* /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -117,7 +117,7 @@ public class Headers implements Map<String,List<String>> { ...@@ -117,7 +117,7 @@ public class Headers implements Map<String,List<String>> {
* @return the first string value associated with the key * @return the first string value associated with the key
*/ */
public String getFirst (String key) { public String getFirst (String key) {
List<String> l = map.get(normalize((String)key)); List<String> l = map.get(normalize(key));
if (l == null) { if (l == null) {
return null; return null;
} }
......
/* /*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -81,29 +81,27 @@ public abstract class HttpServerProvider { ...@@ -81,29 +81,27 @@ public abstract class HttpServerProvider {
if (cn == null) if (cn == null)
return false; return false;
try { try {
Class c = Class.forName(cn, true, Class<?> c = Class.forName(cn, true,
ClassLoader.getSystemClassLoader()); ClassLoader.getSystemClassLoader());
provider = (HttpServerProvider)c.newInstance(); provider = (HttpServerProvider)c.newInstance();
return true; return true;
} catch (ClassNotFoundException x) { } catch (ClassNotFoundException |
throw new ServiceConfigurationError(x); IllegalAccessException |
} catch (IllegalAccessException x) { InstantiationException |
throw new ServiceConfigurationError(x); SecurityException x) {
} catch (InstantiationException x) {
throw new ServiceConfigurationError(x);
} catch (SecurityException x) {
throw new ServiceConfigurationError(x); throw new ServiceConfigurationError(x);
} }
} }
private static boolean loadProviderAsService() { private static boolean loadProviderAsService() {
Iterator i = Service.providers(HttpServerProvider.class, @SuppressWarnings("unchecked")
Iterator<HttpServerProvider> i = Service.providers(HttpServerProvider.class,
ClassLoader.getSystemClassLoader()); ClassLoader.getSystemClassLoader());
for (;;) { for (;;) {
try { try {
if (!i.hasNext()) if (!i.hasNext())
return false; return false;
provider = (HttpServerProvider)i.next(); provider = i.next();
return true; return true;
} catch (ServiceConfigurationError sce) { } catch (ServiceConfigurationError sce) {
if (sce.getCause() instanceof SecurityException) { if (sce.getCause() instanceof SecurityException) {
......
/* /*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -77,7 +77,7 @@ final class SSLSecurity { ...@@ -77,7 +77,7 @@ final class SSLSecurity {
{ {
Provider provider = service.getProvider(); Provider provider = service.getProvider();
String className = service.getClassName(); String className = service.getClassName();
Class implClass; Class<?> implClass;
try { try {
ClassLoader cl = provider.getClass().getClassLoader(); ClassLoader cl = provider.getClass().getClassLoader();
if (cl == null) { if (cl == null) {
...@@ -133,8 +133,8 @@ final class SSLSecurity { ...@@ -133,8 +133,8 @@ final class SSLSecurity {
* or someone has removed classes from the jsse.jar file. * or someone has removed classes from the jsse.jar file.
*/ */
Class typeClassJavax; Class<?> typeClassJavax;
Class typeClassCom; Class<?> typeClassCom;
Object obj = null; Object obj = null;
/* /*
...@@ -237,7 +237,7 @@ final class SSLSecurity { ...@@ -237,7 +237,7 @@ final class SSLSecurity {
/* /*
* Checks whether one class is the superclass of another * Checks whether one class is the superclass of another
*/ */
private static boolean checkSuperclass(Class subclass, Class superclass) { private static boolean checkSuperclass(Class<?> subclass, Class<?> superclass) {
if ((subclass == null) || (superclass == null)) if ((subclass == null) || (superclass == null))
return false; return false;
...@@ -276,7 +276,6 @@ final class SSLSecurity { ...@@ -276,7 +276,6 @@ final class SSLSecurity {
* object. This also mean that anything going down into the SPI * object. This also mean that anything going down into the SPI
* needs to be wrapped, as well as anything coming back up. * needs to be wrapped, as well as anything coming back up.
*/ */
final class SSLContextSpiWrapper extends SSLContextSpi { final class SSLContextSpiWrapper extends SSLContextSpi {
private javax.net.ssl.SSLContext theSSLContext; private javax.net.ssl.SSLContext theSSLContext;
......
...@@ -165,10 +165,10 @@ class VerifierWrapper implements javax.net.ssl.HostnameVerifier { ...@@ -165,10 +165,10 @@ class VerifierWrapper implements javax.net.ssl.HostnameVerifier {
private static String getServername(X509Certificate peerCert) { private static String getServername(X509Certificate peerCert) {
try { try {
// compare to subjectAltNames if dnsName is present // compare to subjectAltNames if dnsName is present
Collection subjAltNames = peerCert.getSubjectAlternativeNames(); Collection<List<?>> subjAltNames = peerCert.getSubjectAlternativeNames();
if (subjAltNames != null) { if (subjAltNames != null) {
for (Iterator itr = subjAltNames.iterator(); itr.hasNext(); ) { for (Iterator<List<?>> itr = subjAltNames.iterator(); itr.hasNext(); ) {
List next = (List)itr.next(); List<?> next = itr.next();
if (((Integer)next.get(0)).intValue() == 2) { if (((Integer)next.get(0)).intValue() == 2) {
// compare dNSName with host in url // compare dNSName with host in url
String dnsName = ((String)next.get(1)); String dnsName = ((String)next.get(1));
......
...@@ -26,8 +26,6 @@ package java.net; ...@@ -26,8 +26,6 @@ package java.net;
import java.io.FileDescriptor; import java.io.FileDescriptor;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.Enumeration;
import sun.net.ResourceManager; import sun.net.ResourceManager;
/** /**
...@@ -153,11 +151,13 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl ...@@ -153,11 +151,13 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
* Set the TTL (time-to-live) option. * Set the TTL (time-to-live) option.
* @param TTL to be set. * @param TTL to be set.
*/ */
@Deprecated
protected abstract void setTTL(byte ttl) throws IOException; protected abstract void setTTL(byte ttl) throws IOException;
/** /**
* Get the TTL (time-to-live) option. * Get the TTL (time-to-live) option.
*/ */
@Deprecated
protected abstract byte getTTL() throws IOException; protected abstract byte getTTL() throws IOException;
/** /**
......
/* /*
* Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -96,7 +96,7 @@ abstract public class ContentHandler { ...@@ -96,7 +96,7 @@ abstract public class ContentHandler {
* @exception IOException if an I/O error occurs while reading the object. * @exception IOException if an I/O error occurs while reading the object.
* @since 1.3 * @since 1.3
*/ */
public Object getContent(URLConnection urlc, Class[] classes) throws IOException { public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException {
Object obj = getContent(urlc); Object obj = getContent(urlc);
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
......
...@@ -249,7 +249,6 @@ public class CookieManager extends CookieHandler ...@@ -249,7 +249,6 @@ public class CookieManager extends CookieHandler
return Collections.unmodifiableMap(cookieMap); return Collections.unmodifiableMap(cookieMap);
} }
public void public void
put(URI uri, Map<String, List<String>> responseHeaders) put(URI uri, Map<String, List<String>> responseHeaders)
throws IOException throws IOException
...@@ -284,7 +283,7 @@ public class CookieManager extends CookieHandler ...@@ -284,7 +283,7 @@ public class CookieManager extends CookieHandler
cookies = HttpCookie.parse(headerValue); cookies = HttpCookie.parse(headerValue);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
// Bogus header, make an empty list and log the error // Bogus header, make an empty list and log the error
cookies = java.util.Collections.EMPTY_LIST; cookies = java.util.Collections.emptyList();
if (logger.isLoggable(PlatformLogger.SEVERE)) { if (logger.isLoggable(PlatformLogger.SEVERE)) {
logger.severe("Invalid cookie for " + uri + ": " + headerValue); logger.severe("Invalid cookie for " + uri + ": " + headerValue);
} }
......
/* /*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
package java.net; package java.net;
import java.io.FileDescriptor;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException;
import java.nio.channels.DatagramChannel; import java.nio.channels.DatagramChannel;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedExceptionAction; import java.security.PrivilegedExceptionAction;
...@@ -300,7 +298,7 @@ class DatagramSocket implements java.io.Closeable { ...@@ -300,7 +298,7 @@ class DatagramSocket implements java.io.Closeable {
} }
} }
static Class implClass = null; static Class<?> implClass = null;
void createImpl() throws SocketException { void createImpl() throws SocketException {
if (impl == null) { if (impl == null) {
......
...@@ -535,6 +535,7 @@ abstract public class HttpURLConnection extends URLConnection { ...@@ -535,6 +535,7 @@ abstract public class HttpURLConnection extends URLConnection {
return responseMessage; return responseMessage;
} }
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) { public long getHeaderFieldDate(String name, long Default) {
String dateString = getHeaderField(name); String dateString = getHeaderField(name);
try { try {
......
/* /*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,9 +25,7 @@ ...@@ -25,9 +25,7 @@
package java.net; package java.net;
import java.security.AccessController;
import java.io.ObjectStreamException; import java.io.ObjectStreamException;
import sun.security.action.*;
/** /**
* This class represents an Internet Protocol version 4 (IPv4) address. * This class represents an Internet Protocol version 4 (IPv4) address.
......
/* /*
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -59,11 +59,11 @@ class Inet4AddressImpl implements InetAddressImpl { ...@@ -59,11 +59,11 @@ class Inet4AddressImpl implements InetAddressImpl {
/* /*
* Let's make sure we use an address of the proper family * Let's make sure we use an address of the proper family
*/ */
java.util.Enumeration it = netif.getInetAddresses(); java.util.Enumeration<InetAddress> it = netif.getInetAddresses();
InetAddress inetaddr = null; InetAddress inetaddr = null;
while (!(inetaddr instanceof Inet4Address) && while (!(inetaddr instanceof Inet4Address) &&
it.hasMoreElements()) it.hasMoreElements())
inetaddr = (InetAddress) it.nextElement(); inetaddr = it.nextElement();
if (inetaddr instanceof Inet4Address) if (inetaddr instanceof Inet4Address)
ifaddr = inetaddr.getAddress(); ifaddr = inetaddr.getAddress();
} }
......
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -383,9 +383,9 @@ class Inet6Address extends InetAddress { ...@@ -383,9 +383,9 @@ class Inet6Address extends InetAddress {
while (en.hasMoreElements()) { while (en.hasMoreElements()) {
NetworkInterface ifc = en.nextElement(); NetworkInterface ifc = en.nextElement();
if (ifc.getName().equals (ifname)) { if (ifc.getName().equals (ifname)) {
Enumeration addresses = ifc.getInetAddresses(); Enumeration<InetAddress> addresses = ifc.getInetAddresses();
while (addresses.hasMoreElements()) { while (addresses.hasMoreElements()) {
InetAddress addr = (InetAddress)addresses.nextElement(); InetAddress addr = addresses.nextElement();
if (!(addr instanceof Inet6Address)) { if (!(addr instanceof Inet6Address)) {
continue; continue;
} }
......
/* /*
* Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -54,10 +54,10 @@ class Inet6AddressImpl implements InetAddressImpl { ...@@ -54,10 +54,10 @@ class Inet6AddressImpl implements InetAddressImpl {
* be either an IPv6 address or an IPv4 address (case of a dual * be either an IPv6 address or an IPv4 address (case of a dual
* stack system). * stack system).
*/ */
java.util.Enumeration it = netif.getInetAddresses(); java.util.Enumeration<InetAddress> it = netif.getInetAddresses();
InetAddress inetaddr = null; InetAddress inetaddr = null;
while (it.hasMoreElements()) { while (it.hasMoreElements()) {
inetaddr = (InetAddress) it.nextElement(); inetaddr = it.nextElement();
if (inetaddr.getClass().isInstance(addr)) { if (inetaddr.getClass().isInstance(addr)) {
ifaddr = inetaddr.getAddress(); ifaddr = inetaddr.getAddress();
if (inetaddr instanceof Inet6Address) { if (inetaddr instanceof Inet6Address) {
......
/* /*
* Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package java.net; package java.net;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.Enumeration; import java.util.Enumeration;
/** /**
...@@ -500,9 +499,9 @@ class MulticastSocket extends DatagramSocket { ...@@ -500,9 +499,9 @@ class MulticastSocket extends DatagramSocket {
*/ */
try { try {
NetworkInterface ni = NetworkInterface.getByInetAddress(ia); NetworkInterface ni = NetworkInterface.getByInetAddress(ia);
Enumeration addrs = ni.getInetAddresses(); Enumeration<InetAddress> addrs = ni.getInetAddresses();
while (addrs.hasMoreElements()) { while (addrs.hasMoreElements()) {
InetAddress addr = (InetAddress)(addrs.nextElement()); InetAddress addr = addrs.nextElement();
if (addr.equals(infAddress)) { if (addr.equals(infAddress)) {
return infAddress; return infAddress;
} }
......
/* /*
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -73,7 +73,7 @@ public class Proxy { ...@@ -73,7 +73,7 @@ public class Proxy {
// Creates the proxy that represents a <code>DIRECT</code> connection. // Creates the proxy that represents a <code>DIRECT</code> connection.
private Proxy() { private Proxy() {
type = type.DIRECT; type = Type.DIRECT;
sa = null; sa = null;
} }
......
/* /*
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -69,7 +69,7 @@ public abstract class ProxySelector { ...@@ -69,7 +69,7 @@ public abstract class ProxySelector {
static { static {
try { try {
Class c = Class.forName("sun.net.spi.DefaultProxySelector"); Class<?> c = Class.forName("sun.net.spi.DefaultProxySelector");
if (c != null && ProxySelector.class.isAssignableFrom(c)) { if (c != null && ProxySelector.class.isAssignableFrom(c)) {
theProxySelector = (ProxySelector) c.newInstance(); theProxySelector = (ProxySelector) c.newInstance();
} }
......
/* /*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -459,13 +459,10 @@ class Socket implements java.io.Closeable { ...@@ -459,13 +459,10 @@ class Socket implements java.io.Closeable {
oldImpl = AccessController.doPrivileged oldImpl = AccessController.doPrivileged
(new PrivilegedAction<Boolean>() { (new PrivilegedAction<Boolean>() {
public Boolean run() { public Boolean run() {
Class[] cl = new Class[2]; Class<?> clazz = impl.getClass();
cl[0] = SocketAddress.class;
cl[1] = Integer.TYPE;
Class clazz = impl.getClass();
while (true) { while (true) {
try { try {
clazz.getDeclaredMethod("connect", cl); clazz.getDeclaredMethod("connect", SocketAddress.class, int.class);
return Boolean.FALSE; return Boolean.FALSE;
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
clazz = clazz.getSuperclass(); clazz = clazz.getSuperclass();
......
/* /*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -467,6 +467,7 @@ implements java.io.Serializable ...@@ -467,6 +467,7 @@ implements java.io.Serializable
* @param action the action string * @param action the action string
* @return the action mask * @return the action mask
*/ */
@SuppressWarnings("fallthrough")
private static int getMask(String action) { private static int getMask(String action) {
if (action == null) { if (action == null) {
...@@ -1231,7 +1232,7 @@ final class SocketPermissionCollection extends PermissionCollection ...@@ -1231,7 +1232,7 @@ final class SocketPermissionCollection extends PermissionCollection
implements Serializable implements Serializable
{ {
// Not serialized; see serialization section at end of class // Not serialized; see serialization section at end of class
private transient List perms; private transient List<SocketPermission> perms;
/** /**
* Create an empty SocketPermissions object. * Create an empty SocketPermissions object.
...@@ -1239,7 +1240,7 @@ implements Serializable ...@@ -1239,7 +1240,7 @@ implements Serializable
*/ */
public SocketPermissionCollection() { public SocketPermissionCollection() {
perms = new ArrayList(); perms = new ArrayList<SocketPermission>();
} }
/** /**
...@@ -1267,7 +1268,7 @@ implements Serializable ...@@ -1267,7 +1268,7 @@ implements Serializable
// optimization to ensure perms most likely to be tested // optimization to ensure perms most likely to be tested
// show up early (4301064) // show up early (4301064)
synchronized (this) { synchronized (this) {
perms.add(0, permission); perms.add(0, (SocketPermission)permission);
} }
} }
...@@ -1296,7 +1297,7 @@ implements Serializable ...@@ -1296,7 +1297,7 @@ implements Serializable
int len = perms.size(); int len = perms.size();
//System.out.println("implies "+np); //System.out.println("implies "+np);
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
SocketPermission x = (SocketPermission) perms.get(i); SocketPermission x = perms.get(i);
//System.out.println(" trying "+x); //System.out.println(" trying "+x);
if (((needed & x.getMask()) != 0) && x.impliesIgnoreMask(np)) { if (((needed & x.getMask()) != 0) && x.impliesIgnoreMask(np)) {
effective |= x.getMask(); effective |= x.getMask();
...@@ -1316,10 +1317,11 @@ implements Serializable ...@@ -1316,10 +1317,11 @@ implements Serializable
* @return an enumeration of all the SocketPermission objects. * @return an enumeration of all the SocketPermission objects.
*/ */
public Enumeration elements() { @SuppressWarnings("unchecked")
public Enumeration<Permission> elements() {
// Convert Iterator into Enumeration // Convert Iterator into Enumeration
synchronized (this) { synchronized (this) {
return Collections.enumeration(perms); return Collections.enumeration((List<Permission>)(List)perms);
} }
} }
...@@ -1353,7 +1355,7 @@ implements Serializable ...@@ -1353,7 +1355,7 @@ implements Serializable
// Don't call out.defaultWriteObject() // Don't call out.defaultWriteObject()
// Write out Vector // Write out Vector
Vector permissions = new Vector(perms.size()); Vector<SocketPermission> permissions = new Vector<>(perms.size());
synchronized (this) { synchronized (this) {
permissions.addAll(perms); permissions.addAll(perms);
...@@ -1375,8 +1377,9 @@ implements Serializable ...@@ -1375,8 +1377,9 @@ implements Serializable
ObjectInputStream.GetField gfields = in.readFields(); ObjectInputStream.GetField gfields = in.readFields();
// Get the one we want // Get the one we want
Vector permissions = (Vector)gfields.get("permissions", null); @SuppressWarnings("unchecked")
perms = new ArrayList(permissions.size()); Vector<SocketPermission> permissions = (Vector<SocketPermission>)gfields.get("permissions", null);
perms = new ArrayList<SocketPermission>(permissions.size());
perms.addAll(permissions); perms.addAll(permissions);
} }
} }
/* /*
* Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -27,7 +27,6 @@ package java.net; ...@@ -27,7 +27,6 @@ package java.net;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import sun.security.util.SecurityConstants; import sun.security.util.SecurityConstants;
...@@ -1113,7 +1112,7 @@ public final class URL implements java.io.Serializable { ...@@ -1113,7 +1112,7 @@ public final class URL implements java.io.Serializable {
/** /**
* A table of protocol handlers. * A table of protocol handlers.
*/ */
static Hashtable handlers = new Hashtable(); static Hashtable<String,URLStreamHandler> handlers = new Hashtable<>();
private static Object streamHandlerLock = new Object(); private static Object streamHandlerLock = new Object();
/** /**
...@@ -1122,7 +1121,7 @@ public final class URL implements java.io.Serializable { ...@@ -1122,7 +1121,7 @@ public final class URL implements java.io.Serializable {
*/ */
static URLStreamHandler getURLStreamHandler(String protocol) { static URLStreamHandler getURLStreamHandler(String protocol) {
URLStreamHandler handler = (URLStreamHandler)handlers.get(protocol); URLStreamHandler handler = handlers.get(protocol);
if (handler == null) { if (handler == null) {
boolean checkedWithFactory = false; boolean checkedWithFactory = false;
...@@ -1160,7 +1159,7 @@ public final class URL implements java.io.Serializable { ...@@ -1160,7 +1159,7 @@ public final class URL implements java.io.Serializable {
try { try {
String clsName = packagePrefix + "." + protocol + String clsName = packagePrefix + "." + protocol +
".Handler"; ".Handler";
Class cls = null; Class<?> cls = null;
try { try {
cls = Class.forName(clsName); cls = Class.forName(clsName);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
...@@ -1185,7 +1184,7 @@ public final class URL implements java.io.Serializable { ...@@ -1185,7 +1184,7 @@ public final class URL implements java.io.Serializable {
// Check again with hashtable just in case another // Check again with hashtable just in case another
// thread created a handler since we last checked // thread created a handler since we last checked
handler2 = (URLStreamHandler)handlers.get(protocol); handler2 = handlers.get(protocol);
if (handler2 != null) { if (handler2 != null) {
return handler2; return handler2;
......
...@@ -25,14 +25,7 @@ ...@@ -25,14 +25,7 @@
package java.net; package java.net;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.ref.*;
import java.io.*; import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandlerFactory;
import java.util.Enumeration;
import java.util.*; import java.util.*;
import java.util.jar.Manifest; import java.util.jar.Manifest;
import java.util.jar.JarFile; import java.util.jar.JarFile;
...@@ -352,8 +345,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -352,8 +345,8 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
{ {
try { try {
return AccessController.doPrivileged( return AccessController.doPrivileged(
new PrivilegedExceptionAction<Class>() { new PrivilegedExceptionAction<Class<?>>() {
public Class run() throws ClassNotFoundException { public Class<?> run() throws ClassNotFoundException {
String path = name.replace('.', '/').concat(".class"); String path = name.replace('.', '/').concat(".class");
Resource res = ucp.getResource(path, false); Resource res = ucp.getResource(path, false);
if (res != null) { if (res != null) {
...@@ -406,7 +399,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable { ...@@ -406,7 +399,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
* Resource. The resulting Class must be resolved before it can be * Resource. The resulting Class must be resolved before it can be
* used. * used.
*/ */
private Class defineClass(String name, Resource res) throws IOException { private Class<?> defineClass(String name, Resource res) throws IOException {
long t0 = System.nanoTime(); long t0 = System.nanoTime();
int i = name.lastIndexOf('.'); int i = name.lastIndexOf('.');
URL url = res.getCodeSourceURL(); URL url = res.getCodeSourceURL();
...@@ -774,7 +767,7 @@ final class FactoryURLClassLoader extends URLClassLoader { ...@@ -774,7 +767,7 @@ final class FactoryURLClassLoader extends URLClassLoader {
super(urls, acc); super(urls, acc);
} }
public final Class loadClass(String name, boolean resolve) public final Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException throws ClassNotFoundException
{ {
// First check if we have permission to access the package. This // First check if we have permission to access the package. This
......
...@@ -595,7 +595,7 @@ public abstract class URLConnection { ...@@ -595,7 +595,7 @@ public abstract class URLConnection {
* @since 1.4 * @since 1.4
*/ */
public Map<String,List<String>> getHeaderFields() { public Map<String,List<String>> getHeaderFields() {
return Collections.EMPTY_MAP; return Collections.emptyMap();
} }
/** /**
...@@ -659,6 +659,7 @@ public abstract class URLConnection { ...@@ -659,6 +659,7 @@ public abstract class URLConnection {
* <code>Default</code> argument is returned if the field is * <code>Default</code> argument is returned if the field is
* missing or malformed. * missing or malformed.
*/ */
@SuppressWarnings("deprecation")
public long getHeaderFieldDate(String name, long Default) { public long getHeaderFieldDate(String name, long Default) {
String value = getHeaderField(name); String value = getHeaderField(name);
try { try {
...@@ -1153,7 +1154,7 @@ public abstract class URLConnection { ...@@ -1153,7 +1154,7 @@ public abstract class URLConnection {
throw new IllegalStateException("Already connected"); throw new IllegalStateException("Already connected");
if (requests == null) if (requests == null)
return Collections.EMPTY_MAP; return Collections.emptyMap();
return requests.getHeaders(null); return requests.getHeaders(null);
} }
...@@ -1236,7 +1237,7 @@ public abstract class URLConnection { ...@@ -1236,7 +1237,7 @@ public abstract class URLConnection {
factory = fac; factory = fac;
} }
private static Hashtable handlers = new Hashtable(); private static Hashtable<String, ContentHandler> handlers = new Hashtable<>();
/** /**
* Gets the Content Handler appropriate for this connection. * Gets the Content Handler appropriate for this connection.
...@@ -1250,7 +1251,7 @@ public abstract class URLConnection { ...@@ -1250,7 +1251,7 @@ public abstract class URLConnection {
if (contentType == null) if (contentType == null)
throw new UnknownServiceException("no content-type"); throw new UnknownServiceException("no content-type");
try { try {
handler = (ContentHandler) handlers.get(contentType); handler = handlers.get(contentType);
if (handler != null) if (handler != null)
return handler; return handler;
} catch(Exception e) { } catch(Exception e) {
...@@ -1316,7 +1317,7 @@ public abstract class URLConnection { ...@@ -1316,7 +1317,7 @@ public abstract class URLConnection {
try { try {
String clsName = packagePrefix + "." + contentHandlerClassName; String clsName = packagePrefix + "." + contentHandlerClassName;
Class cls = null; Class<?> cls = null;
try { try {
cls = Class.forName(clsName); cls = Class.forName(clsName);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
......
/* /*
* Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -87,7 +87,7 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory ...@@ -87,7 +87,7 @@ public abstract class SSLServerSocketFactory extends ServerSocketFactory
if (clsName != null) { if (clsName != null) {
log("setting up default SSLServerSocketFactory"); log("setting up default SSLServerSocketFactory");
try { try {
Class cls = null; Class<?> cls = null;
try { try {
cls = Class.forName(clsName); cls = Class.forName(clsName);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
......
/* /*
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -95,7 +95,7 @@ public abstract class SSLSocketFactory extends SocketFactory ...@@ -95,7 +95,7 @@ public abstract class SSLSocketFactory extends SocketFactory
if (clsName != null) { if (clsName != null) {
log("setting up default SSLSocketFactory"); log("setting up default SSLSocketFactory");
try { try {
Class cls = null; Class<?> cls = null;
try { try {
cls = Class.forName(clsName); cls = Class.forName(clsName);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
......
...@@ -31,6 +31,9 @@ package sun.misc; ...@@ -31,6 +31,9 @@ package sun.misc;
*/ */
public class REException extends Exception { public class REException extends Exception {
private static final long serialVersionUID = 4656584872733646963L;
REException (String s) { REException (String s) {
super(s); super(s);
} }
......
/* /*
* Copyright (c) 1994, 2002, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,10 +25,8 @@ ...@@ -25,10 +25,8 @@
package sun.net; package sun.net;
import java.lang.StringIndexOutOfBoundsException;
import java.io.*; import java.io.*;
import java.util.Vector; import java.util.Vector;
import sun.net.NetworkClient;
/** /**
* This class implements that basic intefaces of transfer protocols. * This class implements that basic intefaces of transfer protocols.
...@@ -44,7 +42,7 @@ public class TransferProtocolClient extends NetworkClient { ...@@ -44,7 +42,7 @@ public class TransferProtocolClient extends NetworkClient {
/** Array of strings (usually 1 entry) for the last reply /** Array of strings (usually 1 entry) for the last reply
from the server. */ from the server. */
protected Vector serverResponse = new Vector(1); protected Vector<String> serverResponse = new Vector<>(1);
/** code for last reply */ /** code for last reply */
protected int lastReplyCode; protected int lastReplyCode;
...@@ -123,11 +121,11 @@ public class TransferProtocolClient extends NetworkClient { ...@@ -123,11 +121,11 @@ public class TransferProtocolClient extends NetworkClient {
/** converts the server response into a string. */ /** converts the server response into a string. */
public String getResponseString() { public String getResponseString() {
return (String) serverResponse.elementAt(0); return serverResponse.elementAt(0);
} }
/** Returns all server response strings. */ /** Returns all server response strings. */
public Vector getResponseStrings() { public Vector<String> getResponseStrings() {
return serverResponse; return serverResponse;
} }
......
/* /*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -67,16 +67,13 @@ public abstract class FtpClientProvider { ...@@ -67,16 +67,13 @@ public abstract class FtpClientProvider {
return false; return false;
} }
try { try {
Class c = Class.forName(cm, true, null); Class<?> c = Class.forName(cm, true, null);
provider = (FtpClientProvider) c.newInstance(); provider = (FtpClientProvider) c.newInstance();
return true; return true;
} catch (ClassNotFoundException x) { } catch (ClassNotFoundException |
throw new ServiceConfigurationError(x.toString()); IllegalAccessException |
} catch (IllegalAccessException x) { InstantiationException |
throw new ServiceConfigurationError(x.toString()); SecurityException x) {
} catch (InstantiationException x) {
throw new ServiceConfigurationError(x.toString());
} catch (SecurityException x) {
throw new ServiceConfigurationError(x.toString()); throw new ServiceConfigurationError(x.toString());
} }
} }
......
/* /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,13 +25,10 @@ ...@@ -25,13 +25,10 @@
package sun.net.httpserver; package sun.net.httpserver;
import java.util.*;
import java.nio.*; import java.nio.*;
import java.net.*;
import java.io.*; import java.io.*;
import java.nio.channels.*; import java.nio.channels.*;
import com.sun.net.httpserver.*; import com.sun.net.httpserver.*;
import com.sun.net.httpserver.spi.*;
/** /**
*/ */
...@@ -47,7 +44,6 @@ class Request { ...@@ -47,7 +44,6 @@ class Request {
private OutputStream os; private OutputStream os;
Request (InputStream rawInputStream, OutputStream rawout) throws IOException { Request (InputStream rawInputStream, OutputStream rawout) throws IOException {
this.chan = chan;
is = rawInputStream; is = rawInputStream;
os = rawout; os = rawout;
do { do {
...@@ -121,7 +117,7 @@ class Request { ...@@ -121,7 +117,7 @@ class Request {
} }
Headers hdrs = null; Headers hdrs = null;
@SuppressWarnings("fallthrough")
Headers headers () throws IOException { Headers headers () throws IOException {
if (hdrs != null) { if (hdrs != null) {
return hdrs; return hdrs;
...@@ -152,6 +148,7 @@ class Request { ...@@ -152,6 +148,7 @@ class Request {
parseloop:{ parseloop:{
while ((c = is.read()) >= 0) { while ((c = is.read()) >= 0) {
switch (c) { switch (c) {
/*fallthrough*/
case ':': case ':':
if (inKey && len > 0) if (inKey && len > 0)
keyend = len; keyend = len;
......
/* /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -29,13 +29,10 @@ import java.net.*; ...@@ -29,13 +29,10 @@ import java.net.*;
import java.nio.*; import java.nio.*;
import java.io.*; import java.io.*;
import java.nio.channels.*; import java.nio.channels.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.locks.*; import java.util.concurrent.locks.*;
import javax.net.ssl.*; import javax.net.ssl.*;
import javax.net.ssl.SSLEngineResult.*; import javax.net.ssl.SSLEngineResult.*;
import com.sun.net.httpserver.*; import com.sun.net.httpserver.*;
import com.sun.net.httpserver.spi.*;
/** /**
* given a non-blocking SocketChannel, it produces * given a non-blocking SocketChannel, it produces
...@@ -448,6 +445,7 @@ class SSLStreams { ...@@ -448,6 +445,7 @@ class SSLStreams {
* on the wrapper methods being idempotent. eg. if wrapAndSend() * on the wrapper methods being idempotent. eg. if wrapAndSend()
* is called with no data to send then there must be no problem * is called with no data to send then there must be no problem
*/ */
@SuppressWarnings("fallthrough")
void doHandshake (HandshakeStatus hs_status) throws IOException { void doHandshake (HandshakeStatus hs_status) throws IOException {
try { try {
handshaking.lock(); handshaking.lock();
......
/* /*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -593,8 +593,8 @@ class ServerImpl implements TimeSource { ...@@ -593,8 +593,8 @@ class ServerImpl implements TimeSource {
rheaders.set ("Connection", "close"); rheaders.set ("Connection", "close");
} else if (chdr.equalsIgnoreCase ("keep-alive")) { } else if (chdr.equalsIgnoreCase ("keep-alive")) {
rheaders.set ("Connection", "keep-alive"); rheaders.set ("Connection", "keep-alive");
int idle=(int)ServerConfig.getIdleInterval()/1000; int idle=(int)(ServerConfig.getIdleInterval()/1000);
int max=(int)ServerConfig.getMaxIdleConnections(); int max=ServerConfig.getMaxIdleConnections();
String val = "timeout="+idle+", max="+max; String val = "timeout="+idle+", max="+max;
rheaders.set ("Keep-Alive", val); rheaders.set ("Keep-Alive", val);
} }
......
...@@ -33,6 +33,22 @@ ...@@ -33,6 +33,22 @@
// - copy this file from icu4jsrc_3_2/src/com/ibm/icu/lang/UCharacterEnums.java // - copy this file from icu4jsrc_3_2/src/com/ibm/icu/lang/UCharacterEnums.java
// - move from package com.ibm.icu.lang to package sun.net.idn // - move from package com.ibm.icu.lang to package sun.net.idn
// //
// 2011-09-06 Kurchi Subhra Hazra
// - Added @Deprecated tag to the following:
// - class UCharacterEnums
// - interfaces ECharacterCategory, ECharacterDirection
// - fields INITIAL_QUOTE_PUNCTUATION, FINAL_QUOTE_PUNCTUATION,
// DIRECTIONALITY_LEFT_TO_RIGHT, DIRECTIONALITY_RIGHT_TO_LEFT,
// DIRECTIONALITY_EUROPEAN_NUMBER, DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR
// DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR, DIRECTIONALITY_ARABIC_NUMBER,
// DIRECTIONALITY_COMMON_NUMBER_SEPARATOR, DIRECTIONALITY_PARAGRAPH_SEPARATOR,
// DIRECTIONALITY_SEGMENT_SEPARATOR, DIRECTIONALITY_WHITESPACE,
// DIRECTIONALITY_OTHER_NEUTRALS, DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING,
// DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE, DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC,
// DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING, DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE,
// DIRECTIONALITY_POP_DIRECTIONAL_FORMAT, DIRECTIONALITY_NON_SPACING_MARK,
// DIRECTIONALITY_BOUNDARY_NEUTRAL, DIRECTIONALITY_UNDEFINED
//
package sun.net.idn; package sun.net.idn;
...@@ -41,6 +57,8 @@ package sun.net.idn; ...@@ -41,6 +57,8 @@ package sun.net.idn;
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
class UCharacterEnums { class UCharacterEnums {
/** This is just a namespace, it is not instantiatable. */ /** This is just a namespace, it is not instantiatable. */
...@@ -54,6 +72,7 @@ class UCharacterEnums { ...@@ -54,6 +72,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static interface ECharacterCategory { public static interface ECharacterCategory {
/** /**
* Unassigned character type * Unassigned character type
...@@ -245,6 +264,7 @@ class UCharacterEnums { ...@@ -245,6 +264,7 @@ class UCharacterEnums {
* @draft ICU 2.8 * @draft ICU 2.8
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final int INITIAL_QUOTE_PUNCTUATION = 28; public static final int INITIAL_QUOTE_PUNCTUATION = 28;
/** /**
...@@ -261,6 +281,7 @@ class UCharacterEnums { ...@@ -261,6 +281,7 @@ class UCharacterEnums {
* @draft ICU 2.8 * @draft ICU 2.8
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final int FINAL_QUOTE_PUNCTUATION = 29; public static final int FINAL_QUOTE_PUNCTUATION = 29;
/** /**
...@@ -279,6 +300,8 @@ class UCharacterEnums { ...@@ -279,6 +300,8 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static interface ECharacterDirection { public static interface ECharacterDirection {
/** /**
* Directional type L * Directional type L
...@@ -291,6 +314,7 @@ class UCharacterEnums { ...@@ -291,6 +314,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = (byte)LEFT_TO_RIGHT; public static final byte DIRECTIONALITY_LEFT_TO_RIGHT = (byte)LEFT_TO_RIGHT;
/** /**
...@@ -304,6 +328,7 @@ class UCharacterEnums { ...@@ -304,6 +328,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = (byte)RIGHT_TO_LEFT; public static final byte DIRECTIONALITY_RIGHT_TO_LEFT = (byte)RIGHT_TO_LEFT;
/** /**
...@@ -317,6 +342,7 @@ class UCharacterEnums { ...@@ -317,6 +342,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = (byte)EUROPEAN_NUMBER; public static final byte DIRECTIONALITY_EUROPEAN_NUMBER = (byte)EUROPEAN_NUMBER;
/** /**
...@@ -330,6 +356,7 @@ class UCharacterEnums { ...@@ -330,6 +356,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = (byte)EUROPEAN_NUMBER_SEPARATOR; public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_SEPARATOR = (byte)EUROPEAN_NUMBER_SEPARATOR;
/** /**
...@@ -343,6 +370,7 @@ class UCharacterEnums { ...@@ -343,6 +370,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = (byte)EUROPEAN_NUMBER_TERMINATOR; public static final byte DIRECTIONALITY_EUROPEAN_NUMBER_TERMINATOR = (byte)EUROPEAN_NUMBER_TERMINATOR;
/** /**
...@@ -356,6 +384,7 @@ class UCharacterEnums { ...@@ -356,6 +384,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_ARABIC_NUMBER = (byte)ARABIC_NUMBER; public static final byte DIRECTIONALITY_ARABIC_NUMBER = (byte)ARABIC_NUMBER;
/** /**
...@@ -369,6 +398,7 @@ class UCharacterEnums { ...@@ -369,6 +398,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = (byte)COMMON_NUMBER_SEPARATOR; public static final byte DIRECTIONALITY_COMMON_NUMBER_SEPARATOR = (byte)COMMON_NUMBER_SEPARATOR;
/** /**
...@@ -382,6 +412,7 @@ class UCharacterEnums { ...@@ -382,6 +412,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = (byte)BLOCK_SEPARATOR; public static final byte DIRECTIONALITY_PARAGRAPH_SEPARATOR = (byte)BLOCK_SEPARATOR;
/** /**
...@@ -395,6 +426,7 @@ class UCharacterEnums { ...@@ -395,6 +426,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = (byte)SEGMENT_SEPARATOR; public static final byte DIRECTIONALITY_SEGMENT_SEPARATOR = (byte)SEGMENT_SEPARATOR;
/** /**
...@@ -408,6 +440,7 @@ class UCharacterEnums { ...@@ -408,6 +440,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_WHITESPACE = (byte)WHITE_SPACE_NEUTRAL; public static final byte DIRECTIONALITY_WHITESPACE = (byte)WHITE_SPACE_NEUTRAL;
/** /**
...@@ -421,6 +454,7 @@ class UCharacterEnums { ...@@ -421,6 +454,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_OTHER_NEUTRALS = (byte)OTHER_NEUTRAL; public static final byte DIRECTIONALITY_OTHER_NEUTRALS = (byte)OTHER_NEUTRAL;
/** /**
...@@ -434,6 +468,7 @@ class UCharacterEnums { ...@@ -434,6 +468,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = (byte)LEFT_TO_RIGHT_EMBEDDING; public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING = (byte)LEFT_TO_RIGHT_EMBEDDING;
/** /**
...@@ -447,6 +482,7 @@ class UCharacterEnums { ...@@ -447,6 +482,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = (byte)LEFT_TO_RIGHT_OVERRIDE; public static final byte DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE = (byte)LEFT_TO_RIGHT_OVERRIDE;
/** /**
...@@ -460,6 +496,7 @@ class UCharacterEnums { ...@@ -460,6 +496,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = (byte)RIGHT_TO_LEFT_ARABIC; public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC = (byte)RIGHT_TO_LEFT_ARABIC;
/** /**
...@@ -473,6 +510,7 @@ class UCharacterEnums { ...@@ -473,6 +510,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = (byte)RIGHT_TO_LEFT_EMBEDDING; public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING = (byte)RIGHT_TO_LEFT_EMBEDDING;
/** /**
...@@ -486,6 +524,7 @@ class UCharacterEnums { ...@@ -486,6 +524,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = (byte)RIGHT_TO_LEFT_OVERRIDE; public static final byte DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE = (byte)RIGHT_TO_LEFT_OVERRIDE;
/** /**
...@@ -499,6 +538,7 @@ class UCharacterEnums { ...@@ -499,6 +538,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = (byte)POP_DIRECTIONAL_FORMAT; public static final byte DIRECTIONALITY_POP_DIRECTIONAL_FORMAT = (byte)POP_DIRECTIONAL_FORMAT;
/** /**
...@@ -512,6 +552,7 @@ class UCharacterEnums { ...@@ -512,6 +552,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_NON_SPACING_MARK = (byte)DIR_NON_SPACING_MARK; public static final byte DIRECTIONALITY_NON_SPACING_MARK = (byte)DIR_NON_SPACING_MARK;
/** /**
...@@ -525,6 +566,7 @@ class UCharacterEnums { ...@@ -525,6 +566,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = (byte)BOUNDARY_NEUTRAL; public static final byte DIRECTIONALITY_BOUNDARY_NEUTRAL = (byte)BOUNDARY_NEUTRAL;
/** /**
...@@ -539,6 +581,7 @@ class UCharacterEnums { ...@@ -539,6 +581,7 @@ class UCharacterEnums {
* @draft ICU 3.0 * @draft ICU 3.0
* @deprecated This is a draft API and might change in a future release of ICU. * @deprecated This is a draft API and might change in a future release of ICU.
*/ */
@Deprecated
public static final byte DIRECTIONALITY_UNDEFINED = -1; public static final byte DIRECTIONALITY_UNDEFINED = -1;
} }
} }
/* /*
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -140,7 +140,7 @@ public final class DNSNameService implements NameService { ...@@ -140,7 +140,7 @@ public final class DNSNameService implements NameService {
// create new soft reference to our thread context // create new soft reference to our thread context
// //
thrCtxt = new ThreadContext(dirCtxt, nsList); thrCtxt = new ThreadContext(dirCtxt, nsList);
contextRef.set(new SoftReference(thrCtxt)); contextRef.set(new SoftReference<ThreadContext>(thrCtxt));
} }
return thrCtxt.dirContext(); return thrCtxt.dirContext();
...@@ -193,7 +193,7 @@ public final class DNSNameService implements NameService { ...@@ -193,7 +193,7 @@ public final class DNSNameService implements NameService {
Attribute attr = ne.next(); Attribute attr = ne.next();
String attrID = attr.getID(); String attrID = attr.getID();
for (NamingEnumeration e = attr.getAll(); e.hasMoreElements();) { for (NamingEnumeration<?> e = attr.getAll(); e.hasMoreElements();) {
String addr = (String)e.next(); String addr = (String)e.next();
// for canoncical name records do recursive lookup // for canoncical name records do recursive lookup
...@@ -233,7 +233,7 @@ public final class DNSNameService implements NameService { ...@@ -233,7 +233,7 @@ public final class DNSNameService implements NameService {
String domain = AccessController.doPrivileged( String domain = AccessController.doPrivileged(
new GetPropertyAction("sun.net.spi.nameservice.domain")); new GetPropertyAction("sun.net.spi.nameservice.domain"));
if (domain != null && domain.length() > 0) { if (domain != null && domain.length() > 0) {
domainList = new LinkedList(); domainList = new LinkedList<String>();
domainList.add(domain); domainList.add(domain);
} }
...@@ -282,7 +282,7 @@ public final class DNSNameService implements NameService { ...@@ -282,7 +282,7 @@ public final class DNSNameService implements NameService {
throw new Error(nx); throw new Error(nx);
} }
ArrayList results = null; ArrayList<String> results = null;
UnknownHostException uhe = null; UnknownHostException uhe = null;
// If host already contains a domain name then just look it up // If host already contains a domain name then just look it up
...@@ -365,7 +365,7 @@ public final class DNSNameService implements NameService { ...@@ -365,7 +365,7 @@ public final class DNSNameService implements NameService {
InetAddress[] addrs = new InetAddress[results.size()]; InetAddress[] addrs = new InetAddress[results.size()];
int count = 0; int count = 0;
for (int i=0; i<results.size(); i++) { for (int i=0; i<results.size(); i++) {
String addrString = (String)results.get(i); String addrString = results.get(i);
byte addr[] = IPAddressUtil.textToNumericFormatV4(addrString); byte addr[] = IPAddressUtil.textToNumericFormatV4(addrString);
if (addr == null) { if (addr == null) {
addr = IPAddressUtil.textToNumericFormatV6(addrString); addr = IPAddressUtil.textToNumericFormatV6(addrString);
......
/* /*
* Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -192,7 +192,7 @@ public class HeaderParser { ...@@ -192,7 +192,7 @@ public class HeaderParser {
return Default; return Default;
} }
class ParserIterator implements Iterator { class ParserIterator implements Iterator<String> {
int index; int index;
boolean returnsValue; // or key boolean returnsValue; // or key
...@@ -202,7 +202,7 @@ public class HeaderParser { ...@@ -202,7 +202,7 @@ public class HeaderParser {
public boolean hasNext () { public boolean hasNext () {
return index<nkeys; return index<nkeys;
} }
public Object next () { public String next () {
return tab[index++][returnsValue?1:0]; return tab[index++][returnsValue?1:0];
} }
public void remove () { public void remove () {
...@@ -210,20 +210,20 @@ public class HeaderParser { ...@@ -210,20 +210,20 @@ public class HeaderParser {
} }
} }
public Iterator keys () { public Iterator<String> keys () {
return new ParserIterator (false); return new ParserIterator (false);
} }
public Iterator values () { public Iterator<String> values () {
return new ParserIterator (true); return new ParserIterator (true);
} }
public String toString () { public String toString () {
Iterator k = keys(); Iterator<String> k = keys();
StringBuffer sbuf = new StringBuffer(); StringBuffer sbuf = new StringBuffer();
sbuf.append ("{size="+asize+" nkeys="+nkeys+" "); sbuf.append ("{size="+asize+" nkeys="+nkeys+" ");
for (int i=0; k.hasNext(); i++) { for (int i=0; k.hasNext(); i++) {
String key = (String)k.next(); String key = k.next();
String val = findValue (i); String val = findValue (i);
if (val != null && "".equals (val)) { if (val != null && "".equals (val)) {
val = null; val = null;
......
/* /*
* Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -35,7 +35,6 @@ import java.util.Map; ...@@ -35,7 +35,6 @@ import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Set;
import java.util.Iterator; import java.util.Iterator;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
...@@ -199,7 +198,8 @@ class MessageHeader { ...@@ -199,7 +198,8 @@ class MessageHeader {
return filterAndAddHeaders(excludeList, null); return filterAndAddHeaders(excludeList, null);
} }
public synchronized Map<String, List<String>> filterAndAddHeaders(String[] excludeList, Map<String, List<String>> include) { public synchronized Map<String, List<String>> filterAndAddHeaders(
String[] excludeList, Map<String, List<String>> include) {
boolean skipIt = false; boolean skipIt = false;
Map<String, List<String>> m = new HashMap<String, List<String>>(); Map<String, List<String>> m = new HashMap<String, List<String>>();
for (int i = nkeys; --i >= 0;) { for (int i = nkeys; --i >= 0;) {
...@@ -228,15 +228,13 @@ class MessageHeader { ...@@ -228,15 +228,13 @@ class MessageHeader {
} }
if (include != null) { if (include != null) {
Iterator entries = include.entrySet().iterator(); for (Map.Entry<String,List<String>> entry: include.entrySet()) {
while (entries.hasNext()) { List<String> l = m.get(entry.getKey());
Map.Entry entry = (Map.Entry)entries.next();
List l = (List)m.get(entry.getKey());
if (l == null) { if (l == null) {
l = new ArrayList(); l = new ArrayList<String>();
m.put((String)entry.getKey(), l); m.put(entry.getKey(), l);
} }
l.add(entry.getValue()); l.addAll(entry.getValue());
} }
} }
...@@ -400,6 +398,7 @@ class MessageHeader { ...@@ -400,6 +398,7 @@ class MessageHeader {
} }
/** Parse and merge a MIME header from an input stream. */ /** Parse and merge a MIME header from an input stream. */
@SuppressWarnings("fallthrough")
public void mergeHeader(InputStream is) throws java.io.IOException { public void mergeHeader(InputStream is) throws java.io.IOException {
if (is == null) if (is == null)
return; return;
...@@ -421,6 +420,7 @@ class MessageHeader { ...@@ -421,6 +420,7 @@ class MessageHeader {
break; break;
case '\t': case '\t':
c = ' '; c = ' ';
/*fall through*/
case ' ': case ' ':
inKey = false; inKey = false;
break; break;
......
/* /*
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,10 +25,6 @@ ...@@ -25,10 +25,6 @@
package sun.net.www; package sun.net.www;
import java.io.*; import java.io.*;
import java.util.Calendar;
import java.util.Date;
import java.text.SimpleDateFormat;
import java.net.URL;
import java.net.FileNameMap; import java.net.FileNameMap;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Enumeration; import java.util.Enumeration;
...@@ -271,7 +267,7 @@ public class MimeTable implements FileNameMap { ...@@ -271,7 +267,7 @@ public class MimeTable implements FileNameMap {
String tempFileTemplate = (String)entries.get("temp.file.template"); String tempFileTemplate = (String)entries.get("temp.file.template");
if (tempFileTemplate != null) { if (tempFileTemplate != null) {
entries.remove("temp.file.template"); entries.remove("temp.file.template");
this.tempFileTemplate = tempFileTemplate; MimeTable.tempFileTemplate = tempFileTemplate;
} }
// now, parse the mime-type spec's // now, parse the mime-type spec's
...@@ -417,10 +413,10 @@ public class MimeTable implements FileNameMap { ...@@ -417,10 +413,10 @@ public class MimeTable implements FileNameMap {
String user = System.getProperty("user.name"); String user = System.getProperty("user.name");
if (user != null) { if (user != null) {
tag = "; customized for " + user; tag = "; customized for " + user;
properties.save(os, filePreamble + tag); properties.store(os, filePreamble + tag);
} }
else { else {
properties.save(os, filePreamble); properties.store(os, filePreamble);
} }
} }
catch (IOException e) { catch (IOException e) {
......
/* /*
* Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,12 +26,7 @@ ...@@ -26,12 +26,7 @@
package sun.net.www; package sun.net.www;
import java.net.URL; import java.net.URL;
import java.net.ContentHandler;
import java.util.*; import java.util.*;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.BufferedInputStream;
import java.net.UnknownServiceException;
/** /**
* A class to represent an active connection to an object * A class to represent an active connection to an object
...@@ -99,7 +94,7 @@ abstract public class URLConnection extends java.net.URLConnection { ...@@ -99,7 +94,7 @@ abstract public class URLConnection extends java.net.URLConnection {
public Map<String,List<String>> getRequestProperties() { public Map<String,List<String>> getRequestProperties() {
if (connected) if (connected)
throw new IllegalStateException("Already connected"); throw new IllegalStateException("Already connected");
return Collections.EMPTY_MAP; return Collections.emptyMap();
} }
public String getHeaderField(String name) { public String getHeaderField(String name) {
......
/* /*
* Copyright (c) 1994, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,11 +25,8 @@ ...@@ -25,11 +25,8 @@
package sun.net.www.content.image; package sun.net.www.content.image;
import java.net.URL;
import java.net.URLConnection;
import java.net.*; import java.net.*;
import sun.awt.image.*; import sun.awt.image.*;
import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.awt.Image; import java.awt.Image;
import java.awt.Toolkit; import java.awt.Toolkit;
...@@ -40,7 +37,7 @@ public class gif extends ContentHandler { ...@@ -40,7 +37,7 @@ public class gif extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class[] classes) throws IOException { public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException {
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
if (classes[i].isAssignableFrom(URLImageSource.class)) { if (classes[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
......
/* /*
* Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,11 +25,8 @@ ...@@ -25,11 +25,8 @@
package sun.net.www.content.image; package sun.net.www.content.image;
import java.net.URL;
import java.net.URLConnection;
import java.net.*; import java.net.*;
import sun.awt.image.*; import sun.awt.image.*;
import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import java.awt.Image; import java.awt.Image;
import java.awt.Toolkit; import java.awt.Toolkit;
...@@ -39,7 +36,7 @@ public class jpeg extends ContentHandler { ...@@ -39,7 +36,7 @@ public class jpeg extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class[] classes) throws IOException { public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException {
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
if (classes[i].isAssignableFrom(URLImageSource.class)) { if (classes[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
......
/* /*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,10 +25,7 @@ ...@@ -25,10 +25,7 @@
package sun.net.www.content.image; package sun.net.www.content.image;
import java.net.URL;
import java.net.URLConnection;
import java.net.*; import java.net.*;
import java.io.InputStream;
import java.io.IOException; import java.io.IOException;
import sun.awt.image.*; import sun.awt.image.*;
import java.awt.Image; import java.awt.Image;
...@@ -39,7 +36,7 @@ public class png extends ContentHandler { ...@@ -39,7 +36,7 @@ public class png extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class[] classes) throws IOException { public Object getContent(URLConnection urlc, Class<?>[] classes) throws IOException {
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
if (classes[i].isAssignableFrom(URLImageSource.class)) { if (classes[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
......
/* /*
* Copyright (c) 1994, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -35,7 +35,7 @@ public class x_xbitmap extends ContentHandler { ...@@ -35,7 +35,7 @@ public class x_xbitmap extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException { public Object getContent(URLConnection urlc, Class<?>[] classes) throws java.io.IOException {
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
if (classes[i].isAssignableFrom(URLImageSource.class)) { if (classes[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
......
/* /*
* Copyright (c) 1994, 1999, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -35,7 +35,7 @@ public class x_xpixmap extends ContentHandler { ...@@ -35,7 +35,7 @@ public class x_xpixmap extends ContentHandler {
return new URLImageSource(urlc); return new URLImageSource(urlc);
} }
public Object getContent(URLConnection urlc, Class[] classes) throws java.io.IOException { public Object getContent(URLConnection urlc, Class<?>[] classes) throws java.io.IOException {
for (int i = 0; i < classes.length; i++) { for (int i = 0; i < classes.length; i++) {
if (classes[i].isAssignableFrom(URLImageSource.class)) { if (classes[i].isAssignableFrom(URLImageSource.class)) {
return new URLImageSource(urlc); return new URLImageSource(urlc);
......
...@@ -81,7 +81,7 @@ class KeepAliveStream extends MeteredStream implements Hurryable { ...@@ -81,7 +81,7 @@ class KeepAliveStream extends MeteredStream implements Hurryable {
// NOTE: Don't close super class // NOTE: Don't close super class
try { try {
if (expected > count) { if (expected > count) {
long nskip = (long) (expected - count); long nskip = expected - count;
if (nskip <= available()) { if (nskip <= available()) {
long n = 0; long n = 0;
while (n < nskip) { while (n < nskip) {
......
...@@ -281,7 +281,7 @@ public class GopherClient extends NetworkClient implements Runnable { ...@@ -281,7 +281,7 @@ public class GopherClient extends NetworkClient implements Runnable {
ps.print("</title></head>\n<body>\n<H1>"); ps.print("</title></head>\n<body>\n<H1>");
ps.print(title); ps.print(title);
ps.print("</h1><dl compact>\n"); ps.print("</h1><dl compact>\n");
DataInputStream ds = new DataInputStream(serverInput); BufferedReader ds = new BufferedReader(new InputStreamReader(serverInput));
String s; String s;
while ((s = ds.readLine()) != null) { while ((s = ds.readLine()) != null) {
int len = s.length(); int len = s.length();
......
/* /*
* Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,12 +25,8 @@ ...@@ -25,12 +25,8 @@
package sun.net.www.protocol.http; package sun.net.www.protocol.http;
import java.io.IOException;
import java.net.URL;
import java.util.Hashtable;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.ListIterator; import java.util.ListIterator;
import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
/** /**
...@@ -38,13 +34,13 @@ import java.util.HashMap; ...@@ -38,13 +34,13 @@ import java.util.HashMap;
*/ */
public class AuthCacheImpl implements AuthCache { public class AuthCacheImpl implements AuthCache {
HashMap hashtable; HashMap<String,LinkedList<AuthCacheValue>> hashtable;
public AuthCacheImpl () { public AuthCacheImpl () {
hashtable = new HashMap (); hashtable = new HashMap<String,LinkedList<AuthCacheValue>>();
} }
public void setMap (HashMap map) { public void setMap (HashMap<String,LinkedList<AuthCacheValue>> map) {
hashtable = map; hashtable = map;
} }
...@@ -52,21 +48,21 @@ public class AuthCacheImpl implements AuthCache { ...@@ -52,21 +48,21 @@ public class AuthCacheImpl implements AuthCache {
// is the path field of AuthenticationInfo // is the path field of AuthenticationInfo
public synchronized void put (String pkey, AuthCacheValue value) { public synchronized void put (String pkey, AuthCacheValue value) {
LinkedList list = (LinkedList) hashtable.get (pkey); LinkedList<AuthCacheValue> list = hashtable.get (pkey);
String skey = value.getPath(); String skey = value.getPath();
if (list == null) { if (list == null) {
list = new LinkedList (); list = new LinkedList<AuthCacheValue>();
hashtable.put (pkey, list); hashtable.put(pkey, list);
} }
// Check if the path already exists or a super-set of it exists // Check if the path already exists or a super-set of it exists
ListIterator iter = list.listIterator(); ListIterator<AuthCacheValue> iter = list.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
AuthenticationInfo inf = (AuthenticationInfo)iter.next(); AuthenticationInfo inf = (AuthenticationInfo)iter.next();
if (inf.path == null || inf.path.startsWith (skey)) { if (inf.path == null || inf.path.startsWith (skey)) {
iter.remove (); iter.remove ();
} }
} }
iter.add (value); iter.add(value);
} }
// get a value from map checking both primary // get a value from map checking both primary
...@@ -74,7 +70,7 @@ public class AuthCacheImpl implements AuthCache { ...@@ -74,7 +70,7 @@ public class AuthCacheImpl implements AuthCache {
public synchronized AuthCacheValue get (String pkey, String skey) { public synchronized AuthCacheValue get (String pkey, String skey) {
AuthenticationInfo result = null; AuthenticationInfo result = null;
LinkedList list = (LinkedList) hashtable.get (pkey); LinkedList<AuthCacheValue> list = hashtable.get (pkey);
if (list == null || list.size() == 0) { if (list == null || list.size() == 0) {
return null; return null;
} }
...@@ -82,7 +78,7 @@ public class AuthCacheImpl implements AuthCache { ...@@ -82,7 +78,7 @@ public class AuthCacheImpl implements AuthCache {
// list should contain only one element // list should contain only one element
return (AuthenticationInfo)list.get (0); return (AuthenticationInfo)list.get (0);
} }
ListIterator iter = list.listIterator(); ListIterator<AuthCacheValue> iter = list.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
AuthenticationInfo inf = (AuthenticationInfo)iter.next(); AuthenticationInfo inf = (AuthenticationInfo)iter.next();
if (skey.startsWith (inf.path)) { if (skey.startsWith (inf.path)) {
...@@ -93,7 +89,7 @@ public class AuthCacheImpl implements AuthCache { ...@@ -93,7 +89,7 @@ public class AuthCacheImpl implements AuthCache {
} }
public synchronized void remove (String pkey, AuthCacheValue entry) { public synchronized void remove (String pkey, AuthCacheValue entry) {
LinkedList list = (LinkedList) hashtable.get (pkey); LinkedList<AuthCacheValue> list = hashtable.get (pkey);
if (list == null) { if (list == null) {
return; return;
} }
...@@ -101,7 +97,7 @@ public class AuthCacheImpl implements AuthCache { ...@@ -101,7 +97,7 @@ public class AuthCacheImpl implements AuthCache {
list.clear(); list.clear();
return; return;
} }
ListIterator iter = list.listIterator (); ListIterator<AuthCacheValue> iter = list.listIterator ();
while (iter.hasNext()) { while (iter.hasNext()) {
AuthenticationInfo inf = (AuthenticationInfo)iter.next(); AuthenticationInfo inf = (AuthenticationInfo)iter.next();
if (entry.equals(inf)) { if (entry.equals(inf)) {
......
/* /*
* Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -122,7 +122,7 @@ public class AuthenticationHeader { ...@@ -122,7 +122,7 @@ public class AuthenticationHeader {
this.dontUseNegotiate = dontUseNegotiate; this.dontUseNegotiate = dontUseNegotiate;
rsp = response; rsp = response;
this.hdrname = hdrname; this.hdrname = hdrname;
schemes = new HashMap(); schemes = new HashMap<String,SchemeMapValue>();
parse(); parse();
} }
...@@ -136,7 +136,7 @@ public class AuthenticationHeader { ...@@ -136,7 +136,7 @@ public class AuthenticationHeader {
HeaderParser parser; HeaderParser parser;
} }
HashMap schemes; HashMap<String, SchemeMapValue> schemes;
/* Iterate through each header line, and then within each line. /* Iterate through each header line, and then within each line.
* If multiple entries exist for a particular scheme (unlikely) * If multiple entries exist for a particular scheme (unlikely)
...@@ -144,11 +144,11 @@ public class AuthenticationHeader { ...@@ -144,11 +144,11 @@ public class AuthenticationHeader {
* preferred scheme that we support will be used. * preferred scheme that we support will be used.
*/ */
private void parse () { private void parse () {
Iterator iter = rsp.multiValueIterator (hdrname); Iterator<String> iter = rsp.multiValueIterator(hdrname);
while (iter.hasNext()) { while (iter.hasNext()) {
String raw = (String)iter.next(); String raw = iter.next();
HeaderParser hp = new HeaderParser (raw); HeaderParser hp = new HeaderParser(raw);
Iterator keys = hp.keys(); Iterator<String> keys = hp.keys();
int i, lastSchemeIndex; int i, lastSchemeIndex;
for (i=0, lastSchemeIndex = -1; keys.hasNext(); i++) { for (i=0, lastSchemeIndex = -1; keys.hasNext(); i++) {
keys.next(); keys.next();
...@@ -164,7 +164,7 @@ public class AuthenticationHeader { ...@@ -164,7 +164,7 @@ public class AuthenticationHeader {
if (i > lastSchemeIndex) { if (i > lastSchemeIndex) {
HeaderParser hpn = hp.subsequence (lastSchemeIndex, i); HeaderParser hpn = hp.subsequence (lastSchemeIndex, i);
String scheme = hpn.findKey(0); String scheme = hpn.findKey(0);
schemes.put (scheme, new SchemeMapValue (hpn, raw)); schemes.put(scheme, new SchemeMapValue (hpn, raw));
} }
} }
...@@ -172,10 +172,10 @@ public class AuthenticationHeader { ...@@ -172,10 +172,10 @@ public class AuthenticationHeader {
* negotiate -> kerberos -> digest -> ntlm -> basic * negotiate -> kerberos -> digest -> ntlm -> basic
*/ */
SchemeMapValue v = null; SchemeMapValue v = null;
if (authPref == null || (v=(SchemeMapValue)schemes.get (authPref)) == null) { if (authPref == null || (v=schemes.get (authPref)) == null) {
if(v == null && !dontUseNegotiate) { if(v == null && !dontUseNegotiate) {
SchemeMapValue tmp = (SchemeMapValue)schemes.get("negotiate"); SchemeMapValue tmp = schemes.get("negotiate");
if(tmp != null) { if(tmp != null) {
if(hci == null || !NegotiateAuthentication.isSupported(new HttpCallerInfo(hci, "Negotiate"))) { if(hci == null || !NegotiateAuthentication.isSupported(new HttpCallerInfo(hci, "Negotiate"))) {
tmp = null; tmp = null;
...@@ -185,7 +185,7 @@ public class AuthenticationHeader { ...@@ -185,7 +185,7 @@ public class AuthenticationHeader {
} }
if(v == null && !dontUseNegotiate) { if(v == null && !dontUseNegotiate) {
SchemeMapValue tmp = (SchemeMapValue)schemes.get("kerberos"); SchemeMapValue tmp = schemes.get("kerberos");
if(tmp != null) { if(tmp != null) {
// the Kerberos scheme is only observed in MS ISA Server. In // the Kerberos scheme is only observed in MS ISA Server. In
// fact i think it's a Kerberos-mechnism-only Negotiate. // fact i think it's a Kerberos-mechnism-only Negotiate.
...@@ -205,9 +205,9 @@ public class AuthenticationHeader { ...@@ -205,9 +205,9 @@ public class AuthenticationHeader {
} }
if(v == null) { if(v == null) {
if ((v=(SchemeMapValue)schemes.get ("digest")) == null) { if ((v=schemes.get ("digest")) == null) {
if (((v=(SchemeMapValue)schemes.get("ntlm"))==null)) { if (((v=schemes.get("ntlm"))==null)) {
v = (SchemeMapValue)schemes.get ("basic"); v = schemes.get ("basic");
} }
} }
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
package sun.net.www.protocol.http; package sun.net.www.protocol.http;
import java.util.Arrays;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.ProtocolException; import java.net.ProtocolException;
...@@ -229,9 +230,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -229,9 +230,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
bufSize4ES = 4096; // use the default bufSize4ES = 4096; // use the default
} }
allowRestrictedHeaders = ((Boolean)java.security.AccessController.doPrivileged( allowRestrictedHeaders = java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction( new sun.security.action.GetBooleanAction(
"sun.net.http.allowRestrictedHeaders"))).booleanValue(); "sun.net.http.allowRestrictedHeaders")).booleanValue();
if (!allowRestrictedHeaders) { if (!allowRestrictedHeaders) {
restrictedHeaderSet = new HashSet<String>(restrictedHeaders.length); restrictedHeaderSet = new HashSet<String>(restrictedHeaders.length);
for (int i=0; i < restrictedHeaders.length; i++) { for (int i=0; i < restrictedHeaders.length; i++) {
...@@ -289,6 +290,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -289,6 +290,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* REMIND: backwards compatibility with JDK 1.1. Should be * REMIND: backwards compatibility with JDK 1.1. Should be
* eliminated for JDK 2.0. * eliminated for JDK 2.0.
*/ */
@Deprecated
private static HttpAuthenticator defaultAuth; private static HttpAuthenticator defaultAuth;
/* all the headers we send /* all the headers we send
...@@ -750,6 +752,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -750,6 +752,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
/** /**
* @deprecated. Use java.net.Authenticator.setDefault() instead. * @deprecated. Use java.net.Authenticator.setDefault() instead.
*/ */
@Deprecated
public static void setDefaultAuthenticator(HttpAuthenticator a) { public static void setDefaultAuthenticator(HttpAuthenticator a) {
defaultAuth = a; defaultAuth = a;
} }
...@@ -830,8 +833,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -830,8 +833,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
InetAddress a1 = InetAddress.getByName(h1); InetAddress a1 = InetAddress.getByName(h1);
InetAddress a2 = InetAddress.getByName(h2); InetAddress a2 = InetAddress.getByName(h2);
result[0] = a1.equals(a2); result[0] = a1.equals(a2);
} catch(UnknownHostException e) { } catch(UnknownHostException | SecurityException e) {
} catch(SecurityException e) {
} }
return null; return null;
} }
...@@ -1336,9 +1338,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1336,9 +1338,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
// Read comments labeled "Failed Negotiate" for details. // Read comments labeled "Failed Negotiate" for details.
boolean dontUseNegotiate = false; boolean dontUseNegotiate = false;
Iterator iter = responses.multiValueIterator("Proxy-Authenticate"); Iterator<String> iter = responses.multiValueIterator("Proxy-Authenticate");
while (iter.hasNext()) { while (iter.hasNext()) {
String value = ((String)iter.next()).trim(); String value = iter.next().trim();
if (value.equalsIgnoreCase("Negotiate") || if (value.equalsIgnoreCase("Negotiate") ||
value.equalsIgnoreCase("Kerberos")) { value.equalsIgnoreCase("Kerberos")) {
if (!inNegotiateProxy) { if (!inNegotiateProxy) {
...@@ -1414,9 +1416,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1414,9 +1416,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
// Read comments labeled "Failed Negotiate" for details. // Read comments labeled "Failed Negotiate" for details.
boolean dontUseNegotiate = false; boolean dontUseNegotiate = false;
Iterator iter = responses.multiValueIterator("WWW-Authenticate"); Iterator<String> iter = responses.multiValueIterator("WWW-Authenticate");
while (iter.hasNext()) { while (iter.hasNext()) {
String value = ((String)iter.next()).trim(); String value = iter.next().trim();
if (value.equalsIgnoreCase("Negotiate") || if (value.equalsIgnoreCase("Negotiate") ||
value.equalsIgnoreCase("Kerberos")) { value.equalsIgnoreCase("Kerberos")) {
if (!inNegotiate) { if (!inNegotiate) {
...@@ -1585,9 +1587,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1585,9 +1587,8 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
// HttpsURLConnection instance saved in // HttpsURLConnection instance saved in
// DelegateHttpsURLConnection // DelegateHttpsURLConnection
uconn = (URLConnection)this.getClass().getField("httpsURLConnection").get(this); uconn = (URLConnection)this.getClass().getField("httpsURLConnection").get(this);
} catch (IllegalAccessException iae) { } catch (IllegalAccessException |
// ignored; use 'this' NoSuchFieldException e) {
} catch (NoSuchFieldException nsfe) {
// ignored; use 'this' // ignored; use 'this'
} }
} }
...@@ -1786,9 +1787,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1786,9 +1787,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (respCode == HTTP_PROXY_AUTH) { if (respCode == HTTP_PROXY_AUTH) {
// Read comments labeled "Failed Negotiate" for details. // Read comments labeled "Failed Negotiate" for details.
boolean dontUseNegotiate = false; boolean dontUseNegotiate = false;
Iterator iter = responses.multiValueIterator("Proxy-Authenticate"); Iterator<String> iter = responses.multiValueIterator("Proxy-Authenticate");
while (iter.hasNext()) { while (iter.hasNext()) {
String value = ((String)iter.next()).trim(); String value = iter.next().trim();
if (value.equalsIgnoreCase("Negotiate") || if (value.equalsIgnoreCase("Negotiate") ||
value.equalsIgnoreCase("Kerberos")) { value.equalsIgnoreCase("Kerberos")) {
if (!inNegotiateProxy) { if (!inNegotiateProxy) {
...@@ -1938,6 +1939,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1938,6 +1939,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* Gets the authentication for an HTTP proxy, and applies it to * Gets the authentication for an HTTP proxy, and applies it to
* the connection. * the connection.
*/ */
@SuppressWarnings("fallthrough")
private AuthenticationInfo getHttpProxyAuthentication (AuthenticationHeader authhdr) { private AuthenticationInfo getHttpProxyAuthentication (AuthenticationHeader authhdr) {
/* get authorization from authenticator */ /* get authorization from authenticator */
AuthenticationInfo ret = null; AuthenticationInfo ret = null;
...@@ -2004,13 +2006,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2004,13 +2006,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
} }
break; break;
case NTLM: case NTLM:
if (NTLMAuthenticationProxy.proxy.supported) { if (NTLMAuthenticationProxy.supported) {
/* tryTransparentNTLMProxy will always be true the first /* tryTransparentNTLMProxy will always be true the first
* time around, but verify that the platform supports it * time around, but verify that the platform supports it
* otherwise don't try. */ * otherwise don't try. */
if (tryTransparentNTLMProxy) { if (tryTransparentNTLMProxy) {
tryTransparentNTLMProxy = tryTransparentNTLMProxy =
NTLMAuthenticationProxy.proxy.supportsTransparentAuth; NTLMAuthenticationProxy.supportsTransparentAuth;
} }
a = null; a = null;
if (tryTransparentNTLMProxy) { if (tryTransparentNTLMProxy) {
...@@ -2043,6 +2045,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2043,6 +2045,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
break; break;
case UNKNOWN: case UNKNOWN:
logger.finest("Unknown/Unsupported authentication scheme: " + scheme); logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
/*fall through*/
default: default:
throw new AssertionError("should not reach here"); throw new AssertionError("should not reach here");
} }
...@@ -2080,6 +2083,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2080,6 +2083,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* @param authHdr the AuthenticationHeader which tells what auth scheme is * @param authHdr the AuthenticationHeader which tells what auth scheme is
* prefered. * prefered.
*/ */
@SuppressWarnings("fallthrough")
private AuthenticationInfo getServerAuthentication (AuthenticationHeader authhdr) { private AuthenticationInfo getServerAuthentication (AuthenticationHeader authhdr) {
/* get authorization from authenticator */ /* get authorization from authenticator */
AuthenticationInfo ret = null; AuthenticationInfo ret = null;
...@@ -2150,7 +2154,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2150,7 +2154,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
} }
break; break;
case NTLM: case NTLM:
if (NTLMAuthenticationProxy.proxy.supported) { if (NTLMAuthenticationProxy.supported) {
URL url1; URL url1;
try { try {
url1 = new URL (url, "/"); /* truncate the path */ url1 = new URL (url, "/"); /* truncate the path */
...@@ -2163,13 +2167,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2163,13 +2167,13 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* otherwise don't try. */ * otherwise don't try. */
if (tryTransparentNTLMServer) { if (tryTransparentNTLMServer) {
tryTransparentNTLMServer = tryTransparentNTLMServer =
NTLMAuthenticationProxy.proxy.supportsTransparentAuth; NTLMAuthenticationProxy.supportsTransparentAuth;
/* If the platform supports transparent authentication /* If the platform supports transparent authentication
* then check if we are in a secure environment * then check if we are in a secure environment
* whether, or not, we should try transparent authentication.*/ * whether, or not, we should try transparent authentication.*/
if (tryTransparentNTLMServer) { if (tryTransparentNTLMServer) {
tryTransparentNTLMServer = tryTransparentNTLMServer =
NTLMAuthenticationProxy.proxy.isTrustedSite(url); NTLMAuthenticationProxy.isTrustedSite(url);
} }
} }
a = null; a = null;
...@@ -2198,6 +2202,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2198,6 +2202,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
break; break;
case UNKNOWN: case UNKNOWN:
logger.finest("Unknown/Unsupported authentication scheme: " + scheme); logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
/*fall through*/
default: default:
throw new AssertionError("should not reach here"); throw new AssertionError("should not reach here");
} }
...@@ -2745,14 +2750,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2745,14 +2750,14 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
* The cookies in the requests message headers may have * The cookies in the requests message headers may have
* been modified. Use the saved user cookies instead. * been modified. Use the saved user cookies instead.
*/ */
Map userCookiesMap = null; Map<String, List<String>> userCookiesMap = null;
if (userCookies != null || userCookies2 != null) { if (userCookies != null || userCookies2 != null) {
userCookiesMap = new HashMap(); userCookiesMap = new HashMap<>();
if (userCookies != null) { if (userCookies != null) {
userCookiesMap.put("Cookie", userCookies); userCookiesMap.put("Cookie", Arrays.asList(userCookies));
} }
if (userCookies2 != null) { if (userCookies2 != null) {
userCookiesMap.put("Cookie2", userCookies2); userCookiesMap.put("Cookie2", Arrays.asList(userCookies2));
} }
} }
return requests.filterAndAddHeaders(EXCLUDE_HEADERS2, userCookiesMap); return requests.filterAndAddHeaders(EXCLUDE_HEADERS2, userCookiesMap);
......
/* /*
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -45,8 +45,8 @@ public abstract class Negotiator { ...@@ -45,8 +45,8 @@ public abstract class Negotiator {
// Makes NegotiatorImpl, and the security classes it references, a // Makes NegotiatorImpl, and the security classes it references, a
// runtime dependency rather than a static one. // runtime dependency rather than a static one.
Class clazz; Class<?> clazz;
Constructor c; Constructor<?> c;
try { try {
clazz = Class.forName("sun.net.www.protocol.http.spnego.NegotiatorImpl", true, null); clazz = Class.forName("sun.net.www.protocol.http.spnego.NegotiatorImpl", true, null);
c = clazz.getConstructor(HttpCallerInfo.class); c = clazz.getConstructor(HttpCallerInfo.class);
......
/* /*
* Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -221,11 +221,11 @@ public abstract class AbstractDelegateHttpsURLConnection extends ...@@ -221,11 +221,11 @@ public abstract class AbstractDelegateHttpsURLConnection extends
*/ */
public java.security.cert.Certificate[] getLocalCertificates() { public java.security.cert.Certificate[] getLocalCertificates() {
if (cachedResponse != null) { if (cachedResponse != null) {
List l = ((SecureCacheResponse)cachedResponse).getLocalCertificateChain(); List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getLocalCertificateChain();
if (l == null) { if (l == null) {
return null; return null;
} else { } else {
return (java.security.cert.Certificate[])l.toArray(); return l.toArray(new java.security.cert.Certificate[0]);
} }
} }
if (http == null) { if (http == null) {
...@@ -243,11 +243,11 @@ public abstract class AbstractDelegateHttpsURLConnection extends ...@@ -243,11 +243,11 @@ public abstract class AbstractDelegateHttpsURLConnection extends
public java.security.cert.Certificate[] getServerCertificates() public java.security.cert.Certificate[] getServerCertificates()
throws SSLPeerUnverifiedException { throws SSLPeerUnverifiedException {
if (cachedResponse != null) { if (cachedResponse != null) {
List l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain(); List<java.security.cert.Certificate> l = ((SecureCacheResponse)cachedResponse).getServerCertificateChain();
if (l == null) { if (l == null) {
return null; return null;
} else { } else {
return (java.security.cert.Certificate[])l.toArray(); return l.toArray(new java.security.cert.Certificate[0]);
} }
} }
......
/* /*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -529,7 +529,7 @@ final class HttpsClient extends HttpClient ...@@ -529,7 +529,7 @@ final class HttpsClient extends HttpClient
new BufferedOutputStream(serverSocket.getOutputStream()), new BufferedOutputStream(serverSocket.getOutputStream()),
false, encoding); false, encoding);
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
throw new InternalError(encoding+" encoding not found", e); throw new InternalError(encoding+" encoding not found");
} }
// check URL spoofing if it has not been checked under handshaking // check URL spoofing if it has not been checked under handshaking
...@@ -623,7 +623,7 @@ final class HttpsClient extends HttpClient ...@@ -623,7 +623,7 @@ final class HttpsClient extends HttpClient
*/ */
@Override @Override
public void closeIdleConnection() { public void closeIdleConnection() {
HttpClient http = (HttpClient) kac.get(url, sslSocketFactory); HttpClient http = kac.get(url, sslSocketFactory);
if (http != null) { if (http != null) {
http.closeServer(); http.closeServer();
} }
...@@ -681,8 +681,7 @@ final class HttpsClient extends HttpClient ...@@ -681,8 +681,7 @@ final class HttpsClient extends HttpClient
// return the X500Principal of the end-entity cert. // return the X500Principal of the end-entity cert.
java.security.cert.Certificate[] certs = java.security.cert.Certificate[] certs =
session.getPeerCertificates(); session.getPeerCertificates();
principal = (X500Principal) principal = ((X509Certificate)certs[0]).getSubjectX500Principal();
((X509Certificate)certs[0]).getSubjectX500Principal();
} }
return principal; return principal;
} }
...@@ -703,8 +702,7 @@ final class HttpsClient extends HttpClient ...@@ -703,8 +702,7 @@ final class HttpsClient extends HttpClient
java.security.cert.Certificate[] certs = java.security.cert.Certificate[] certs =
session.getLocalCertificates(); session.getLocalCertificates();
if (certs != null) { if (certs != null) {
principal = (X500Principal) principal = ((X509Certificate)certs[0]).getSubjectX500Principal();
((X509Certificate)certs[0]).getSubjectX500Principal();
} }
} }
return principal; return principal;
......
...@@ -139,6 +139,20 @@ public class Handler extends URLStreamHandler { ...@@ -139,6 +139,20 @@ public class Handler extends URLStreamHandler {
} }
if (nogood) if (nogood)
throw new RuntimeException("No email address"); throw new RuntimeException("No email address");
setURL(u, protocol, host, port, file, null); setURLHandler(u, protocol, host, port, file, null);
}
/**
* This method is used to suppress the deprecated warning
*
* @param u the URL to receive the result of parsing the spec
* @param spec the URL string to parse
* @param start the character position to start parsing at. This is
* just past the ':'.
* @param limit the character position to stop parsing at.
*/
@SuppressWarnings("deprecation")
private void setURLHandler(URL u, String protocol, String host, int port, String file, String ref) {
setURL(u,protocol,host,port,file,null);
} }
} }
/* /*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -35,7 +35,7 @@ import java.security.AccessController; ...@@ -35,7 +35,7 @@ import java.security.AccessController;
*/ */
class DefaultDatagramSocketImplFactory { class DefaultDatagramSocketImplFactory {
static Class prefixImplClass = null; static Class<?> prefixImplClass = null;
static { static {
String prefix = null; String prefix = null;
......
/* /*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -54,8 +54,10 @@ class PlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl ...@@ -54,8 +54,10 @@ class PlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
protected native int getTimeToLive() throws IOException; protected native int getTimeToLive() throws IOException;
@Deprecated
protected native void setTTL(byte ttl) throws IOException; protected native void setTTL(byte ttl) throws IOException;
@Deprecated
protected native byte getTTL() throws IOException; protected native byte getTTL() throws IOException;
protected native void join(InetAddress inetaddr, NetworkInterface netIf) protected native void join(InetAddress inetaddr, NetworkInterface netIf)
......
/* /*
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -149,7 +149,7 @@ public class ResolverConfigurationImpl ...@@ -149,7 +149,7 @@ public class ResolverConfigurationImpl
sl = java.security.AccessController.doPrivileged( sl = java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<LinkedList<String>>() { new java.security.PrivilegedAction<LinkedList<String>>() {
public LinkedList<String> run() { public LinkedList<String> run() {
LinkedList ll; LinkedList<String> ll;
// first try search keyword (max 6 domains) // first try search keyword (max 6 domains)
ll = resolvconf("search", 6, 1); ll = resolvconf("search", 6, 1);
...@@ -173,7 +173,7 @@ public class ResolverConfigurationImpl ...@@ -173,7 +173,7 @@ public class ResolverConfigurationImpl
String localDomain = localDomain0(); String localDomain = localDomain0();
if (localDomain != null && localDomain.length() > 0) { if (localDomain != null && localDomain.length() > 0) {
sl = new LinkedList(); sl = new LinkedList<String>();
sl.add(localDomain); sl.add(localDomain);
return sl; return sl;
} }
...@@ -198,7 +198,7 @@ public class ResolverConfigurationImpl ...@@ -198,7 +198,7 @@ public class ResolverConfigurationImpl
} }
// no local domain so try fallback (RPC) domain or // no local domain so try fallback (RPC) domain or
// hostname // hostName
sl = new LinkedList<>(); sl = new LinkedList<>();
String domain = fallbackDomain0(); String domain = fallbackDomain0();
...@@ -216,21 +216,25 @@ public class ResolverConfigurationImpl ...@@ -216,21 +216,25 @@ public class ResolverConfigurationImpl
opts = new OptionsImpl(); opts = new OptionsImpl();
} }
@SuppressWarnings("unchecked")
public List<String> searchlist() { public List<String> searchlist() {
synchronized (lock) { synchronized (lock) {
loadConfig(); loadConfig();
// List is mutable so return a shallow copy // List is mutable so return a shallow copy
return (List)searchlist.clone(); return (List<String>)searchlist.clone();
} }
} }
@SuppressWarnings("unchecked")
public List<String> nameservers() { public List<String> nameservers() {
synchronized (lock) { synchronized (lock) {
loadConfig(); loadConfig();
// List is mutable so return a shallow copy // List is mutable so return a shallow copy
return (List)nameservers.clone();
return (List<String>)nameservers.clone();
} }
} }
......
/* /*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -45,7 +45,7 @@ import java.security.PrivilegedAction; ...@@ -45,7 +45,7 @@ import java.security.PrivilegedAction;
class DefaultDatagramSocketImplFactory class DefaultDatagramSocketImplFactory
{ {
static Class prefixImplClass = null; static Class<?> prefixImplClass = null;
/* the windows version. */ /* the windows version. */
private static float version; private static float version;
......
/* /*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007,2011 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
package java.net; package java.net;
import java.io.IOException; import java.io.IOException;
import java.io.FileDescriptor;
import sun.misc.SharedSecrets; import sun.misc.SharedSecrets;
import sun.misc.JavaIOFileDescriptorAccess; import sun.misc.JavaIOFileDescriptorAccess;
...@@ -215,11 +214,12 @@ class DualStackPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl ...@@ -215,11 +214,12 @@ class DualStackPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
throw new IOException("Method not implemented!"); throw new IOException("Method not implemented!");
} }
@Deprecated
protected void setTTL(byte ttl) throws IOException { protected void setTTL(byte ttl) throws IOException {
throw new IOException("Method not implemented!"); throw new IOException("Method not implemented!");
} }
@Deprecated
protected byte getTTL() throws IOException { protected byte getTTL() throws IOException {
throw new IOException("Method not implemented!"); throw new IOException("Method not implemented!");
} }
......
...@@ -133,8 +133,10 @@ class TwoStacksPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl ...@@ -133,8 +133,10 @@ class TwoStacksPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
protected native int getTimeToLive() throws IOException; protected native int getTimeToLive() throws IOException;
@Deprecated
protected native void setTTL(byte ttl) throws IOException; protected native void setTTL(byte ttl) throws IOException;
@Deprecated
protected native byte getTTL() throws IOException; protected native byte getTTL() throws IOException;
protected native void join(InetAddress inetaddr, NetworkInterface netIf) protected native void join(InetAddress inetaddr, NetworkInterface netIf)
......
...@@ -57,8 +57,8 @@ public class ResolverConfigurationImpl ...@@ -57,8 +57,8 @@ public class ResolverConfigurationImpl
private static String os_nameservers; private static String os_nameservers;
// Cached lists // Cached lists
private static LinkedList searchlist; private static LinkedList<String> searchlist;
private static LinkedList nameservers; private static LinkedList<String> nameservers;
// Parse string that consists of token delimited by space or commas // Parse string that consists of token delimited by space or commas
// and return LinkedHashMap // and return LinkedHashMap
...@@ -111,21 +111,23 @@ public class ResolverConfigurationImpl ...@@ -111,21 +111,23 @@ public class ResolverConfigurationImpl
opts = new OptionsImpl(); opts = new OptionsImpl();
} }
@SuppressWarnings("unchecked") // clone()
public List<String> searchlist() { public List<String> searchlist() {
synchronized (lock) { synchronized (lock) {
loadConfig(); loadConfig();
// List is mutable so return a shallow copy // List is mutable so return a shallow copy
return (List)searchlist.clone(); return (List<String>)searchlist.clone();
} }
} }
@SuppressWarnings("unchecked") // clone()
public List<String> nameservers() { public List<String> nameservers() {
synchronized (lock) { synchronized (lock) {
loadConfig(); loadConfig();
// List is mutable so return a shallow copy // List is mutable so return a shallow copy
return (List)nameservers.clone(); return (List<String>)nameservers.clone();
} }
} }
......
/* /*
* Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -148,7 +148,7 @@ class JarFileFactory implements URLJarFile.URLJarFileCloseController { ...@@ -148,7 +148,7 @@ class JarFileFactory implements URLJarFile.URLJarFileCloseController {
private Permission getPermission(JarFile jarFile) { private Permission getPermission(JarFile jarFile) {
try { try {
URLConnection uc = (URLConnection)getConnection(jarFile); URLConnection uc = getConnection(jarFile);
if (uc != null) if (uc != null)
return uc.getPermission(); return uc.getPermission();
} catch (IOException ioe) { } catch (IOException ioe) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册