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