jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
changeset 12040 558b0e0d5910
parent 5506 202f599c92aa
child 16094 ac85c7fc438d
child 14342 8435a30053c1
--- a/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java	Fri Mar 02 17:24:08 2012 +0000
+++ b/jdk/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java	Fri Mar 02 13:48:43 2012 -0800
@@ -33,6 +33,7 @@
  * in a client's request.
  */
 class CGIClientException extends Exception {
+    private static final long serialVersionUID = 8147981687059865216L;
 
     public CGIClientException(String s) {
         super(s);
@@ -44,6 +45,8 @@
  */
 class CGIServerException extends Exception {
 
+    private static final long serialVersionUID = 6928425456704527017L;
+
     public CGIServerException(String s) {
         super(s);
     }
@@ -111,9 +114,9 @@
     };
 
     /* construct table mapping command strings to handlers */
-    private static Hashtable commandLookup;
+    private static Hashtable<String, CGICommandHandler> commandLookup;
     static {
-        commandLookup = new Hashtable();
+        commandLookup = new Hashtable<>();
         for (int i = 0; i < commands.length; ++ i)
             commandLookup.put(commands[i].getName(), commands[i]);
     }
@@ -140,7 +143,7 @@
                 param = QueryString.substring(delim + 1);
             }
             CGICommandHandler handler =
-                (CGICommandHandler) commandLookup.get(command);
+                commandLookup.get(command);
             if (handler != null)
                 try {
                     handler.execute(param);
@@ -200,7 +203,7 @@
 
 /**
  * "forward" command: Forward request body to local port on the server,
- * and send reponse back to client.
+ * and send response back to client.
  */
 final class CGIForwardCommand implements CGICommandHandler {
 
@@ -208,6 +211,11 @@
         return "forward";
     }
 
+    @SuppressWarnings("deprecation")
+    private String getLine (DataInputStream socketIn) throws IOException {
+        return socketIn.readLine();
+    }
+
     public void execute(String param) throws CGIClientException, CGIServerException
     {
         if (!CGIHandler.RequestMethod.equals("POST"))
@@ -276,7 +284,7 @@
         int responseContentLength = -1;
         do {
             try {
-                line = socketIn.readLine();
+                line = getLine(socketIn);
             } catch (IOException e) {
                 throw new CGIServerException("error reading from server");
             }
@@ -285,8 +293,8 @@
                     "unexpected EOF reading server response");
 
             if (line.toLowerCase().startsWith(key)) {
-                if (contentLengthFound)
-                    ; // what would we want to do in this case??
+                // if contentLengthFound is true
+                // we should probably do something here
                 responseContentLength =
                     Integer.parseInt(line.substring(key.length()).trim());
                 contentLengthFound = true;