提交 cbc6c68b 编写于 作者: C chegar

6992545: FindBugs scan - Malicious code vulnerability Warnings in...

6992545: FindBugs scan - Malicious code vulnerability Warnings in com.sun.net.httpserver.HttpsParameters.*
Reviewed-by: alanb
上级 d37e3333
...@@ -24,9 +24,6 @@ ...@@ -24,9 +24,6 @@
*/ */
package com.sun.net.httpserver; package com.sun.net.httpserver;
import java.net.*;
import java.io.*;
import java.util.*;
/** /**
* BasicAuthenticator provides an implementation of HTTP Basic * BasicAuthenticator provides an implementation of HTTP Basic
...@@ -57,7 +54,6 @@ public abstract class BasicAuthenticator extends Authenticator { ...@@ -57,7 +54,6 @@ public abstract class BasicAuthenticator extends Authenticator {
public Result authenticate (HttpExchange t) public Result authenticate (HttpExchange t)
{ {
HttpContext context = t.getHttpContext();
Headers rmap = (Headers) t.getRequestHeaders(); Headers rmap = (Headers) t.getRequestHeaders();
/* /*
* look for auth token * look for auth token
......
...@@ -25,11 +25,7 @@ ...@@ -25,11 +25,7 @@
package com.sun.net.httpserver; package com.sun.net.httpserver;
import java.net.*; import java.io.IOException;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import sun.net.www.MessageHeader;
import java.util.*; import java.util.*;
/** /**
...@@ -56,12 +52,10 @@ public abstract class Filter { ...@@ -56,12 +52,10 @@ public abstract class Filter {
/* the last element in the chain must invoke the users /* the last element in the chain must invoke the users
* handler * handler
*/ */
private List<Filter> filters;
private ListIterator<Filter> iter; private ListIterator<Filter> iter;
private HttpHandler handler; private HttpHandler handler;
public Chain (List<Filter> filters, HttpHandler handler) { public Chain (List<Filter> filters, HttpHandler handler) {
this.filters = filters;
iter = filters.listIterator(); iter = filters.listIterator();
this.handler = handler; this.handler = handler;
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
package com.sun.net.httpserver; package com.sun.net.httpserver;
import java.util.*; import java.util.*;
import java.io.*;
/** /**
* HTTP request and response headers are represented by this class which implements * HTTP request and response headers are represented by this class which implements
...@@ -77,9 +76,7 @@ public class Headers implements Map<String,List<String>> { ...@@ -77,9 +76,7 @@ public class Headers implements Map<String,List<String>> {
if (len == 0) { if (len == 0) {
return key; return key;
} }
char[] b = new char [len]; char[] b = key.toCharArray();
String s = null;
b = key.toCharArray();
if (b[0] >= 'a' && b[0] <= 'z') { if (b[0] >= 'a' && b[0] <= 'z') {
b[0] = (char)(b[0] - ('a' - 'A')); b[0] = (char)(b[0] - ('a' - 'A'));
} }
...@@ -88,8 +85,7 @@ public class Headers implements Map<String,List<String>> { ...@@ -88,8 +85,7 @@ public class Headers implements Map<String,List<String>> {
b[i] = (char) (b[i] + ('a' - 'A')); b[i] = (char) (b[i] + ('a' - 'A'));
} }
} }
s = new String (b); return new String(b);
return s;
} }
public int size() {return map.size();} public int size() {return map.size();}
......
...@@ -24,9 +24,7 @@ ...@@ -24,9 +24,7 @@
*/ */
package com.sun.net.httpserver; package com.sun.net.httpserver;
import java.net.*; import java.net.InetSocketAddress;
import java.io.*;
import java.util.*;
import javax.net.ssl.SSLParameters; import javax.net.ssl.SSLParameters;
/** /**
...@@ -90,7 +88,7 @@ public abstract class HttpsParameters { ...@@ -90,7 +88,7 @@ public abstract class HttpsParameters {
* have been set. * have been set.
*/ */
public String[] getCipherSuites() { public String[] getCipherSuites() {
return cipherSuites; return cipherSuites != null ? cipherSuites.clone() : null;
} }
/** /**
...@@ -99,7 +97,7 @@ public abstract class HttpsParameters { ...@@ -99,7 +97,7 @@ public abstract class HttpsParameters {
* @param cipherSuites the array of ciphersuites (or null) * @param cipherSuites the array of ciphersuites (or null)
*/ */
public void setCipherSuites(String[] cipherSuites) { public void setCipherSuites(String[] cipherSuites) {
this.cipherSuites = cipherSuites; this.cipherSuites = cipherSuites != null ? cipherSuites.clone() : null;
} }
/** /**
...@@ -110,7 +108,7 @@ public abstract class HttpsParameters { ...@@ -110,7 +108,7 @@ public abstract class HttpsParameters {
* have been set. * have been set.
*/ */
public String[] getProtocols() { public String[] getProtocols() {
return protocols; return protocols != null ? protocols.clone() : null;
} }
/** /**
...@@ -119,7 +117,7 @@ public abstract class HttpsParameters { ...@@ -119,7 +117,7 @@ public abstract class HttpsParameters {
* @param protocols the array of protocols (or null) * @param protocols the array of protocols (or null)
*/ */
public void setProtocols(String[] protocols) { public void setProtocols(String[] protocols) {
this.protocols = protocols; this.protocols = protocols != null ? protocols.clone() : null;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册