Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
87309953
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
87309953
编写于
7月 06, 2011
作者:
M
mullan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7054969: Null-check-in-finally pattern in java/security documentation
Reviewed-by: vinnie
上级
2c7f8030
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
9 addition
and
46 deletion
+9
-46
src/share/classes/java/security/KeyStore.java
src/share/classes/java/security/KeyStore.java
+2
-14
src/share/classes/java/security/cert/X509CRL.java
src/share/classes/java/security/cert/X509CRL.java
+2
-8
src/share/classes/java/security/cert/X509Certificate.java
src/share/classes/java/security/cert/X509Certificate.java
+2
-8
src/share/classes/java/security/cert/X509Extension.java
src/share/classes/java/security/cert/X509Extension.java
+3
-16
未找到文件。
src/share/classes/java/security/KeyStore.java
浏览文件 @
87309953
...
...
@@ -113,14 +113,8 @@ import javax.security.auth.callback.*;
* // get user password and file input stream
* char[] password = getPassword();
*
* java.io.FileInputStream fis = null;
* try {
* fis = new java.io.FileInputStream("keyStoreName");
* try (FileInputStream fis = new FileInputStream("keyStoreName")) {
* ks.load(fis, password);
* } finally {
* if (fis != null) {
* fis.close();
* }
* }
* </pre>
*
...
...
@@ -146,14 +140,8 @@ import javax.security.auth.callback.*;
* ks.setEntry("secretKeyAlias", skEntry, protParam);
*
* // store away the keystore
* java.io.FileOutputStream fos = null;
* try {
* fos = new java.io.FileOutputStream("newKeyStoreName");
* try (FileOutputStream fos = new FileOutputStream("newKeyStoreName")) {
* ks.store(fos, password);
* } finally {
* if (fos != null) {
* fos.close();
* }
* }
* </pre>
*
...
...
src/share/classes/java/security/cert/X509CRL.java
浏览文件 @
87309953
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
1
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -94,15 +94,9 @@ import sun.security.x509.X509CRLImpl;
* CRLs are instantiated using a certificate factory. The following is an
* example of how to instantiate an X.509 CRL:
* <pre><code>
* InputStream inStream = null;
* try {
* inStream = new FileInputStream("fileName-of-crl");
* try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* X509CRL crl = (X509CRL)cf.generateCRL(inStream);
* } finally {
* if (inStream != null) {
* inStream.close();
* }
* }
* </code></pre>
*
...
...
src/share/classes/java/security/cert/X509Certificate.java
浏览文件 @
87309953
/*
* Copyright (c) 1997, 201
0
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 201
1
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -89,15 +89,9 @@ import sun.security.x509.X509CertImpl;
* Certificates are instantiated using a certificate factory. The following is
* an example of how to instantiate an X.509 certificate:
* <pre>
* InputStream inStream = null;
* try {
* inStream = new FileInputStream("fileName-of-cert");
* try (InputStream inStream = new FileInputStream("fileName-of-cert")) {
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* X509Certificate cert = (X509Certificate)cf.generateCertificate(inStream);
* } finally {
* if (inStream != null) {
* inStream.close();
* }
* }
* </pre>
*
...
...
src/share/classes/java/security/cert/X509Extension.java
浏览文件 @
87309953
/*
* Copyright (c) 1997, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 20
11
, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
...
...
@@ -85,16 +85,10 @@ public interface X509Extension {
* Here is sample code to get a Set of critical extensions from an
* X509Certificate and print the OIDs:
* <pre><code>
* InputStream inStrm = null;
* X509Certificate cert = null;
* try {
* inStrm = new FileInputStream("DER-encoded-Cert");
* try (InputStream inStrm = new FileInputStream("DER-encoded-Cert")) {
* CertificateFactory cf = CertificateFactory.getInstance("X.509");
* cert = (X509Certificate)cf.generateCertificate(inStrm);
* } finally {
* if (inStrm != null) {
* inStrm.close();
* }
* }<p>
*
* Set<String> critSet = cert.getCriticalExtensionOIDs();
...
...
@@ -120,23 +114,16 @@ public interface X509Extension {
* Here is sample code to get a Set of non-critical extensions from an
* X509CRL revoked certificate entry and print the OIDs:
* <pre><code>
* InputStream inStrm = null;
* CertificateFactory cf = null;
* X509CRL crl = null;
* try {
* inStrm = new FileInputStream("DER-encoded-CRL");
* try (InputStream inStrm = new FileInputStream("DER-encoded-CRL")) {
* cf = CertificateFactory.getInstance("X.509");
* crl = (X509CRL)cf.generateCRL(inStrm);
* } finally {
* if (inStrm != null) {
* inStrm.close();
* }
* }<p>
*
* byte[] certData = <DER-encoded certificate data>
* ByteArrayInputStream bais = new ByteArrayInputStream(certData);
* X509Certificate cert = (X509Certificate)cf.generateCertificate(bais);
* bais.close();
* X509CRLEntry badCert =
* crl.getRevokedCertificate(cert.getSerialNumber());<p>
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录