This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

java/net/URLConnection.java


Obvious/trivial.  
You can't do that.

Andrew.


2005-07-12  Andrew Haley  <aph@redhat.com>

	* java/net/URLConnection.java (getContentHandler): Guard cast with
	instaceof.

--- java/net/URLConnection.java	28 Sep 2004 11:02:35 -0000	1.34
+++ java/net/URLConnection.java	12 Jul 2005 09:48:57 -0000
@@ -979,17 +979,22 @@
     if (contentType == null || contentType.equals(""))
       return null;
 
-    ContentHandler handler;
+    ContentHandler handler = null;
 
     // See if a handler has been cached for this content type.
     // For efficiency, if a content type has been searched for but not
     // found, it will be in the hash table but as the contentType String
     // instead of a ContentHandler.
-    if ((handler = (ContentHandler) handlers.get(contentType)) != null)
-      if (handler instanceof ContentHandler)
-	return handler;
-      else
-	return null;
+    {
+      Object cachedHandler;
+      if ((cachedHandler = handlers.get(contentType)) != null)
+	{
+	  if (cachedHandler instanceof ContentHandler)
+	    return (ContentHandler)cachedHandler;
+	  else
+	    return null;
+	}
+    }
 
     // If a non-default factory has been set, use it.
     if (factory != null)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]