mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 12:04:39 +02:00
6850783: InvalidityDateExtension returns reference to internal mutable state
Return cloned instead of referenced object Reviewed-by: weijun
This commit is contained in:
parent
5bf951e2a6
commit
71306719d3
2 changed files with 5 additions and 2 deletions
|
@ -28,7 +28,6 @@ package sun.security.x509;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
|
|
||||||
import sun.security.util.*;
|
import sun.security.util.*;
|
||||||
|
|
|
@ -140,7 +140,11 @@ public class InvalidityDateExtension extends Extension
|
||||||
*/
|
*/
|
||||||
public Object get(String name) throws IOException {
|
public Object get(String name) throws IOException {
|
||||||
if (name.equalsIgnoreCase(DATE)) {
|
if (name.equalsIgnoreCase(DATE)) {
|
||||||
return date;
|
if (date == null) {
|
||||||
|
return null;
|
||||||
|
} else {
|
||||||
|
return (new Date(date.getTime())); // clone
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new IOException
|
throw new IOException
|
||||||
("Name not supported by InvalidityDateExtension");
|
("Name not supported by InvalidityDateExtension");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue