< prev index next >
src/share/classes/java/net/URLConnection.java
Print this page
rev 1564 : 7090158: Networking Libraries don't build with javac -Werror
7125055: ContentHandler.getContent API changed in error
Summary: Minor changes to networking java files to remove warnings
Reviewed-by: chegar, weijun, hawtin, alanb
Contributed-by: kurchi.subhra.hazra@oracle.com, sasha_bu@hotmail.com
*** 573,583 ****
*
* @return a Map of header fields
* @since 1.4
*/
public Map<String,List<String>> getHeaderFields() {
! return Collections.EMPTY_MAP;
}
/**
* Returns the value of the named field parsed as a number.
* <p>
--- 573,583 ----
*
* @return a Map of header fields
* @since 1.4
*/
public Map<String,List<String>> getHeaderFields() {
! return Collections.emptyMap();
}
/**
* Returns the value of the named field parsed as a number.
* <p>
*** 614,623 ****
--- 614,624 ----
* @param Default a default value.
* @return the value of the field, parsed as a date. The value of the
* <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 {
return Date.parse(value);
} catch (Exception e) { }
*** 1108,1118 ****
public Map<String,List<String>> getRequestProperties() {
if (connected)
throw new IllegalStateException("Already connected");
if (requests == null)
! return Collections.EMPTY_MAP;
return requests.getHeaders(null);
}
/**
--- 1109,1119 ----
public Map<String,List<String>> getRequestProperties() {
if (connected)
throw new IllegalStateException("Already connected");
if (requests == null)
! return Collections.emptyMap();
return requests.getHeaders(null);
}
/**
*** 1191,1201 ****
security.checkSetFactory();
}
factory = fac;
}
! private static Hashtable handlers = new Hashtable();
private static final ContentHandler UnknownContentHandlerP = new UnknownContentHandler();
/**
* Gets the Content Handler appropriate for this connection.
* @param connection the connection to use.
--- 1192,1202 ----
security.checkSetFactory();
}
factory = fac;
}
! private static Hashtable<String, ContentHandler> handlers = new Hashtable<String, ContentHandler>();
private static final ContentHandler UnknownContentHandlerP = new UnknownContentHandler();
/**
* Gets the Content Handler appropriate for this connection.
* @param connection the connection to use.
*** 1206,1216 ****
String contentType = stripOffParameters(getContentType());
ContentHandler handler = null;
if (contentType == null)
throw new UnknownServiceException("no content-type");
try {
! handler = (ContentHandler) handlers.get(contentType);
if (handler != null)
return handler;
} catch(Exception e) {
}
--- 1207,1217 ----
String contentType = stripOffParameters(getContentType());
ContentHandler handler = null;
if (contentType == null)
throw new UnknownServiceException("no content-type");
try {
! handler = handlers.get(contentType);
if (handler != null)
return handler;
} catch(Exception e) {
}
*** 1272,1282 ****
while (packagePrefixIter.hasMoreTokens()) {
String packagePrefix = packagePrefixIter.nextToken().trim();
try {
String clsName = packagePrefix + "." + contentHandlerClassName;
! Class cls = null;
try {
cls = Class.forName(clsName);
} catch (ClassNotFoundException e) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
if (cl != null) {
--- 1273,1283 ----
while (packagePrefixIter.hasMoreTokens()) {
String packagePrefix = packagePrefixIter.nextToken().trim();
try {
String clsName = packagePrefix + "." + contentHandlerClassName;
! Class<?> cls = null;
try {
cls = Class.forName(clsName);
} catch (ClassNotFoundException e) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
if (cl != null) {
< prev index next >