Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_langtools
提交
4a3c9e25
D
dragonwell8_langtools
项目概览
openanolis
/
dragonwell8_langtools
通知
0
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_langtools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4a3c9e25
编写于
15年前
作者:
J
jjg
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6879371: javap does not close internal default file manager
Reviewed-by: darcy
上级
3d30e20d
master
8.0-preview
v8.2.2-GA
v8.1.1-GA
v8.0.0_GA
v8.0.0-GA
jdk8u252-b06
jdk8u252-b05
jdk8u252-b04
jdk8u252-b03
jdk8u252-b02
jdk8u252-b01
jdk8u252-b00
jdk8u242-ga
jdk8u242-b08
jdk8u242-b07
jdk8u242-b06
jdk8u242-b05
jdk8u242-b04
jdk8u242-b03
jdk8u242-b02
jdk8u242-b01
jdk8u242-b00
jdk8u232-ga
jdk8u232-b09
jdk8u232-b08
jdk8u232-b07
jdk8u232-b06
jdk8u232-b05
jdk8u232-b04
jdk8u232-b03
jdk8u232-b02
jdk8u232-b01
jdk8u232-b00
jdk8u222-ga
jdk8u222-b10
jdk8u222-b09
jdk8u222-b08
jdk8u222-b07
jdk8u222-b06
jdk8u222-b05
jdk8u222-b04
jdk8u222-b03
jdk8u222-b02
jdk8u222-b01
jdk8u222-b00
jdk8u212-ga
jdk8u212-b04
jdk8u212-b03
jdk8u212-b02
jdk8u212-b01
jdk8u212-b00
jdk8u202-ga
jdk8u202-b26
jdk8u202-b25
jdk8u202-b08
jdk8u202-b07
jdk8u202-b06
jdk8u202-b05
jdk8u202-b04
jdk8u202-b03
jdk8u202-b02
jdk8u202-b01
jdk8u202-b00
jdk8u201-ga
jdk8u201-b79
jdk8u201-b77
jdk8u201-b76
jdk8u201-b75
jdk8u201-b74
jdk8u201-b26
jdk8u201-b25
jdk8u201-b09
jdk8u201-b08
jdk8u201-b07
jdk8u201-b06
jdk8u201-b05
jdk8u201-b04
jdk8u201-b03
jdk8u201-b02
jdk8u201-b01
jdk8u201-b00
jdk8u192-b26
jdk8u192-b25
jdk8u192-b12
jdk8u192-b11
jdk8u192-b10
jdk8u192-b09
jdk8u192-b08
jdk8u192-b07
jdk8u192-b06
jdk8u192-b05
jdk8u192-b04
jdk8u192-b03
jdk8u192-b02
jdk8u192-b01
jdk8u192-b00
jdk8u191-b26
jdk8u191-b25
jdk8u191-b12
jdk8u191-b11
jdk8u191-b10
jdk8u191-b09
jdk8u191-b08
jdk8u191-b07
jdk8u191-b06
jdk8u191-b05
jdk8u191-b04
jdk8u191-b03
jdk8u191-b02
jdk8u191-b01
jdk8u191-b00
jdk8u182-b00
jdk8u181-b37
jdk8u181-b36
jdk8u181-b35
jdk8u181-b34
jdk8u181-b33
jdk8u181-b32
jdk8u181-b31
jdk8u181-b13
jdk8u181-b12
jdk8u181-b11
jdk8u181-b10
jdk8u181-b09
jdk8u181-b08
jdk8u181-b07
jdk8u181-b06
jdk8u181-b05
jdk8u181-b04
jdk8u181-b03
jdk8u181-b02
jdk8u181-b01
jdk8u181-b00
jdk8u172-b37
jdk8u172-b36
jdk8u172-b35
jdk8u172-b34
jdk8u172-b33
jdk8u172-b32
jdk8u172-b31
jdk8u172-b11
jdk8u172-b10
jdk8u172-b09
jdk8u172-b08
jdk8u172-b07
jdk8u172-b06
jdk8u172-b05
jdk8u172-b04
jdk8u172-b03
jdk8u172-b02
jdk8u172-b01
jdk8u172-b00
jdk8u171-b11
jdk8u171-b10
jdk8u171-b09
jdk8u171-b08
jdk8u171-b07
jdk8u171-b06
jdk8u171-b05
jdk8u171-b04
jdk8u171-b03
jdk8u171-b02
jdk8u171-b01
jdk8u171-b00
jdk8u162-b38
jdk8u162-b37
jdk8u162-b36
jdk8u162-b35
jdk8u162-b34
jdk8u162-b33
jdk8u162-b32
jdk8u162-b31
jdk8u162-b12
jdk8u162-b11
jdk8u162-b10
jdk8u162-b09
jdk8u162-b08
jdk8u162-b07
jdk8u162-b06
jdk8u162-b05
jdk8u162-b04
jdk8u162-b03
jdk8u162-b02
jdk8u162-b01
jdk8u162-b00
jdk8u161-b12
jdk8u161-b11
jdk8u161-b10
jdk8u161-b09
jdk8u161-b08
jdk8u161-b07
jdk8u161-b06
jdk8u161-b05
jdk8u161-b04
jdk8u161-b03
jdk8u161-b02
jdk8u161-b01
jdk8u161-b00
jdk8u152-b35
jdk8u152-b34
jdk8u152-b33
jdk8u152-b32
jdk8u152-b31
jdk8u152-b16
jdk8u152-b15
jdk8u152-b14
jdk8u152-b13
jdk8u152-b12
jdk8u152-b11
jdk8u152-b10
jdk8u152-b09
jdk8u152-b08
jdk8u152-b07
jdk8u152-b06
jdk8u152-b05
jdk8u152-b04
jdk8u152-b03
jdk8u152-b02
jdk8u152-b01
jdk8u152-b00
jdk8u151-b12
jdk8u151-b11
jdk8u151-b10
jdk8u151-b09
jdk8u151-b08
jdk8u151-b07
jdk8u151-b06
jdk8u151-b05
jdk8u151-b04
jdk8u151-b03
jdk8u151-b02
jdk8u151-b01
jdk8u151-b00
jdk8u144-b34
jdk8u144-b33
jdk8u144-b32
jdk8u144-b31
jdk8u144-b01
jdk8u144-b00
jdk8u141-b32
jdk8u141-b31
jdk8u141-b15
jdk8u141-b14
jdk8u141-b13
jdk8u141-b12
jdk8u141-b11
jdk8u141-b10
jdk8u141-b09
jdk8u141-b08
jdk8u141-b07
jdk8u141-b06
jdk8u141-b05
jdk8u141-b04
jdk8u141-b03
jdk8u141-b02
jdk8u141-b01
jdk8u141-b00
jdk8u132-b00
jdk8u131-b34
jdk8u131-b33
jdk8u131-b32
jdk8u131-b31
jdk8u131-b11
jdk8u131-b10
jdk8u131-b09
jdk8u131-b08
jdk8u131-b07
jdk8u131-b06
jdk8u131-b05
jdk8u131-b04
jdk8u131-b03
jdk8u131-b02
jdk8u131-b01
jdk8u131-b00
jdk8u122-b04
jdk8u122-b03
jdk8u122-b02
jdk8u122-b01
jdk8u122-b00
jdk8u121-b36
jdk8u121-b35
jdk8u121-b34
jdk8u121-b33
jdk8u121-b32
jdk8u121-b31
jdk8u121-b13
jdk8u121-b12
jdk8u121-b11
jdk8u121-b10
jdk8u121-b09
jdk8u121-b08
jdk8u121-b07
jdk8u121-b06
jdk8u121-b05
jdk8u121-b04
jdk8u121-b03
jdk8u121-b02
jdk8u121-b01
jdk8u121-b00
jdk8u112-b33
jdk8u112-b32
jdk8u112-b31
jdk8u112-b16
jdk8u112-b15
jdk8u112-b14
jdk8u112-b13
jdk8u112-b12
jdk8u112-b11
jdk8u112-b10
jdk8u112-b09
jdk8u112-b08
jdk8u112-b07
jdk8u112-b06
jdk8u112-b04
jdk8u112-b03
jdk8u112-b02
jdk8u112-b01
jdk8u112-b00
jdk8u111-b14
jdk8u111-b13
jdk8u111-b12
jdk8u111-b11
jdk8u111-b10
jdk8u111-b09
jdk8u111-b08
jdk8u111-b07
jdk8u111-b06
jdk8u111-b05
jdk8u111-b04
jdk8u111-b03
jdk8u111-b02
jdk8u111-b01
jdk8u111-b00
jdk8u102-b35
jdk8u102-b34
jdk8u102-b33
jdk8u102-b32
jdk8u102-b31
jdk8u102-b14
jdk8u102-b13
jdk8u102-b12
jdk8u102-b11
jdk8u102-b10
jdk8u102-b09
jdk8u102-b08
jdk8u102-b07
jdk8u102-b06
jdk8u102-b05
jdk8u102-b04
jdk8u102-b03
jdk8u102-b02
jdk8u102-b01
jdk8u102-b00
jdk8u101-b13
jdk8u101-b12
jdk8u101-b11
jdk8u101-b10
jdk8u101-b09
jdk8u101-b08
jdk8u101-b07
jdk8u101-b06
jdk8u101-b05
jdk8u101-b04
jdk8u101-b03
jdk8u101-b02
jdk8u101-b01
jdk8u101-b00
jdk8u92-b34
jdk8u92-b33
jdk8u92-b32
jdk8u92-b31
jdk8u92-b14
jdk8u92-b13
jdk8u92-b00
jdk8u91-b15
jdk8u91-b14
jdk8u91-b13
jdk8u91-b00
jdk8u82-b00
jdk8u81-b00
jdk8u77-b31
jdk8u77-b03
jdk8u77-b02
jdk8u77-b01
jdk8u77-b00
jdk8u76-b12
jdk8u76-b11
jdk8u76-b10
jdk8u76-b09
jdk8u76-b08
jdk8u76-b07
jdk8u76-b06
jdk8u76-b05
jdk8u76-b04
jdk8u76-b03
jdk8u76-b02
jdk8u76-b01
jdk8u76-b00
jdk8u75-b12
jdk8u75-b10
jdk8u75-b09
jdk8u75-b08
jdk8u75-b07
jdk8u75-b06
jdk8u75-b05
jdk8u75-b04
jdk8u75-b03
jdk8u75-b02
jdk8u75-b01
jdk8u75-b00
jdk8u74-b32
jdk8u74-b31
jdk8u74-b02
jdk8u74-b01
jdk8u74-b00
jdk8u73-b02
jdk8u73-b01
jdk8u73-b00
jdk8u72-b31
jdk8u72-b15
jdk8u72-b14
jdk8u72-b13
jdk8u72-b12
jdk8u72-b11
jdk8u72-b10
jdk8u72-b09
jdk8u72-b08
jdk8u72-b07
jdk8u72-b06
jdk8u72-b05
jdk8u72-b04
jdk8u72-b03
jdk8u72-b02
jdk8u72-b01
jdk8u72-b00
jdk8u71-b15
jdk8u71-b14
jdk8u71-b13
jdk8u71-b12
jdk8u71-b11
jdk8u71-b10
jdk8u71-b09
jdk8u71-b08
jdk8u71-b07
jdk8u71-b06
jdk8u71-b05
jdk8u71-b04
jdk8u71-b03
jdk8u71-b02
jdk8u71-b01
jdk8u71-b00
jdk8u66-b36
jdk8u66-b35
jdk8u66-b34
jdk8u66-b33
jdk8u66-b32
jdk8u66-b31
jdk8u66-b18
jdk8u66-b17
jdk8u66-b16
jdk8u66-b15
jdk8u66-b14
jdk8u66-b13
jdk8u66-b12
jdk8u66-b11
jdk8u66-b10
jdk8u66-b09
jdk8u66-b08
jdk8u66-b07
jdk8u66-b02
jdk8u66-b01
jdk8u66-b00
jdk8u65-b17
jdk8u65-b16
jdk8u65-b15
jdk8u65-b14
jdk8u65-b13
jdk8u65-b12
jdk8u65-b11
jdk8u65-b10
jdk8u65-b09
jdk8u65-b08
jdk8u65-b07
jdk8u65-b06
jdk8u65-b05
jdk8u65-b04
jdk8u65-b03
jdk8u65-b02
jdk8u65-b01
jdk8u65-b00
jdk8u60-b32
jdk8u60-b31
jdk8u60-b27
jdk8u60-b26
jdk8u60-b25
jdk8u60-b24
jdk8u60-b23
jdk8u60-b22
jdk8u60-b21
jdk8u60-b20
jdk8u60-b19
jdk8u60-b18
jdk8u60-b17
jdk8u60-b16
jdk8u60-b15
jdk8u60-b14
jdk8u60-b13
jdk8u60-b12
jdk8u60-b11
jdk8u60-b10
jdk8u60-b09
jdk8u60-b08
jdk8u60-b07
jdk8u60-b06
jdk8u60-b05
jdk8u60-b04
jdk8u60-b03
jdk8u60-b02
jdk8u60-b01
jdk8u60-b00
jdk8u52-b07
jdk8u52-b06
jdk8u51-b34
jdk8u51-b33
jdk8u51-b32
jdk8u51-b31
jdk8u51-b16
jdk8u51-b15
jdk8u51-b14
jdk8u51-b13
jdk8u51-b12
jdk8u51-b11
jdk8u51-b10
jdk8u51-b09
jdk8u51-b08
jdk8u51-b07
jdk8u51-b06
jdk8u51-b05
jdk8u51-b04
jdk8u51-b03
jdk8u51-b02
jdk8u51-b01
jdk8u51-b00
jdk8u45-b37
jdk8u45-b36
jdk8u45-b35
jdk8u45-b34
jdk8u45-b33
jdk8u45-b32
jdk8u45-b31
jdk8u45-b15
jdk8u45-b14
jdk8u45-b13
jdk8u45-b12
jdk8u45-b11
jdk8u45-b10
jdk8u45-b09
jdk8u45-b08
jdk8u45-b07
jdk8u45-b06
jdk8u45-b05
jdk8u45-b04
jdk8u45-b03
jdk8u45-b02
jdk8u45-b01
jdk8u45-b00
jdk8u40-b33
jdk8u40-b32
jdk8u40-b31
jdk8u40-b27
jdk8u40-b26
jdk8u40-b25
jdk8u40-b24
jdk8u40-b23
jdk8u40-b22
jdk8u40-b21
jdk8u40-b20
jdk8u40-b19
jdk8u40-b18
jdk8u40-b17
jdk8u40-b16
jdk8u40-b15
jdk8u40-b14
jdk8u40-b13
jdk8u40-b12
jdk8u40-b11
jdk8u40-b10
jdk8u40-b09
jdk8u40-b08
jdk8u40-b07
jdk8u40-b06
jdk8u40-b05
jdk8u40-b04
jdk8u40-b03
jdk8u40-b02
jdk8u40-b01
jdk8u40-b00
jdk8u31-b34
jdk8u31-b33
jdk8u31-b32
jdk8u31-b31
jdk8u31-b13
jdk8u31-b12
jdk8u31-b11
jdk8u31-b10
jdk8u31-b09
jdk8u31-b08
jdk8u31-b07
jdk8u31-b06
jdk8u31-b05
jdk8u31-b04
jdk8u31-b03
jdk8u31-b02
jdk8u31-b01
jdk8u31-b00
jdk8u25-b33
jdk8u25-b32
jdk8u25-b31
jdk8u25-b18
jdk8u25-b17
jdk8u25-b16
jdk8u25-b15
jdk8u25-b14
jdk8u25-b13
jdk8u25-b12
jdk8u25-b11
jdk8u25-b10
jdk8u25-b09
jdk8u25-b08
jdk8u25-b07
jdk8u25-b06
jdk8u25-b05
jdk8u25-b04
jdk8u25-b03
jdk8u25-b02
jdk8u25-b01
jdk8u25-b00
jdk8u20-b32
jdk8u20-b31
jdk8u20-b26
jdk8u20-b25
jdk8u20-b24
jdk8u20-b23
jdk8u20-b22
jdk8u20-b21
jdk8u20-b20
jdk8u20-b19
jdk8u20-b18
jdk8u20-b17
jdk8u20-b16
jdk8u20-b15
jdk8u20-b14
jdk8u20-b13
jdk8u20-b12
jdk8u20-b11
jdk8u20-b10
jdk8u20-b09
jdk8u20-b08
jdk8u20-b07
jdk8u20-b06
jdk8u20-b05
jdk8u20-b04
jdk8u20-b03
jdk8u20-b02
jdk8u20-b01
jdk8u20-b00
jdk8u11-b31
jdk8u11-b12
jdk8u11-b11
jdk8u11-b10
jdk8u11-b09
jdk8u11-b08
jdk8u11-b07
jdk8u11-b06
jdk8u11-b05
jdk8u11-b04
jdk8u11-b03
jdk8u11-b02
jdk8u11-b01
jdk8u11-b00
jdk8u5-b31
jdk8u5-b13
jdk8u5-b12
jdk8u5-b11
jdk8u5-b10
jdk8u5-b09
jdk8u5-b08
jdk8u5-b07
jdk8u5-b06
jdk8u5-b05
jdk8u5-b04
jdk8u5-b03
jdk8u5-b02
jdk8u5-b01
jdk8-b132
jdk8-b131
jdk8-b130
jdk8-b129
jdk8-b128
jdk8-b127
jdk8-b126
jdk8-b125
jdk8-b124
jdk8-b123
jdk8-b122
jdk8-b121
jdk8-b120
jdk8-b119
jdk8-b118
jdk8-b117
jdk8-b116
jdk8-b115
jdk8-b114
jdk8-b113
jdk8-b112
jdk8-b111
jdk8-b110
jdk8-b109
jdk8-b108
jdk8-b107
jdk8-b106
jdk8-b105
jdk8-b104
jdk8-b103
jdk8-b102
jdk8-b101
jdk8-b100
jdk8-b99
jdk8-b98
jdk8-b97
jdk8-b96
jdk8-b95
jdk8-b94
jdk8-b93
jdk8-b92
jdk8-b91
jdk8-b90
jdk8-b89
jdk8-b88
jdk8-b87
jdk8-b86
jdk8-b85
jdk8-b84
jdk8-b83
jdk8-b82
jdk8-b81
jdk8-b80
jdk8-b79
jdk8-b78
jdk8-b77
jdk8-b76
jdk8-b75
jdk8-b74
jdk8-b73
jdk8-b72
jdk8-b71
jdk8-b70
jdk8-b69
jdk8-b68
jdk8-b67
jdk8-b66
jdk8-b65
jdk8-b64
jdk8-b63
jdk8-b62
jdk8-b61
jdk8-b60
jdk8-b59
jdk8-b58
jdk8-b57
jdk8-b56
jdk8-b55
jdk8-b54
jdk8-b53
jdk8-b52
jdk8-b51
jdk8-b50
jdk8-b49
jdk8-b48
jdk8-b47
jdk8-b46
jdk8-b45
jdk8-b44
jdk8-b43
jdk8-b42
jdk8-b41
jdk8-b40
jdk8-b39
jdk8-b38
jdk8-b37
jdk8-b36
jdk8-b35
jdk8-b34
jdk8-b33
jdk8-b32
jdk8-b31
jdk8-b30
jdk8-b29
jdk8-b28
jdk8-b27
jdk8-b26
jdk8-b25
jdk8-b24
jdk8-b23
jdk8-b22
jdk8-b21
jdk8-b20
jdk8-b19
jdk8-b18
jdk8-b17
jdk8-b16
jdk8-b15
jdk8-b14
jdk8-b13
jdk8-b12
jdk8-b11
jdk8-b10
jdk8-b09
jdk8-b08
jdk8-b07
jdk8-b06
jdk8-b05
jdk8-b04
jdk8-b03
jdk8-b02
jdk8-b01
jdk7-b147
jdk7-b146
jdk7-b145
jdk7-b144
jdk7-b143
jdk7-b142
jdk7-b141
jdk7-b140
jdk7-b139
jdk7-b138
jdk7-b137
jdk7-b136
jdk7-b135
jdk7-b134
jdk7-b133
jdk7-b132
jdk7-b131
jdk7-b130
jdk7-b129
jdk7-b128
jdk7-b127
jdk7-b126
jdk7-b125
jdk7-b124
jdk7-b123
jdk7-b122
jdk7-b121
jdk7-b120
jdk7-b119
jdk7-b118
jdk7-b117
jdk7-b116
jdk7-b115
jdk7-b114
jdk7-b113
jdk7-b112
jdk7-b111
jdk7-b110
jdk7-b109
jdk7-b108
jdk7-b107
jdk7-b106
jdk7-b105
jdk7-b104
jdk7-b103
jdk7-b102
jdk7-b101
jdk7-b100
jdk7-b99
jdk7-b98
jdk7-b97
jdk7-b96
jdk7-b95
jdk7-b94
jdk7-b93
jdk7-b92
jdk7-b91
jdk7-b90
jdk7-b89
jdk7-b88
jdk7-b87
jdk7-b86
jdk7-b85
jdk7-b84
jdk7-b83
jdk7-b82
jdk7-b81
jdk7-b80
jdk7-b79
jdk7-b78
jdk7-b77
jdk7-b76
jdk7-b75
jdk7-b74
jdk7-b73
jdk7-b72
dragonwell-8.4.4_jdk8u262-ga
dragonwell-8.4.4_jdk8u262-b10
dragonwell-8.3.3-GA
无相关合并请求
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
136 addition
and
3 deletion
+136
-3
src/share/classes/com/sun/tools/javap/JavapTask.java
src/share/classes/com/sun/tools/javap/JavapTask.java
+17
-3
test/tools/javap/T6879371.java
test/tools/javap/T6879371.java
+119
-0
未找到文件。
src/share/classes/com/sun/tools/javap/JavapTask.java
浏览文件 @
4a3c9e25
...
...
@@ -455,8 +455,19 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
return
EXIT_CMDERR
;
}
try
{
boolean
ok
=
run
();
return
ok
?
EXIT_OK
:
EXIT_ERROR
;
}
finally
{
if
(
defaultFileManager
!=
null
)
{
try
{
defaultFileManager
.
close
();
defaultFileManager
=
null
;
}
catch
(
IOException
e
)
{
throw
new
InternalError
(
e
);
}
}
}
}
catch
(
BadArgs
e
)
{
reportError
(
e
.
key
,
e
.
args
);
if
(
e
.
showUsage
)
{
...
...
@@ -856,7 +867,9 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
}
private
JavaFileManager
getDefaultFileManager
(
final
DiagnosticListener
<?
super
JavaFileObject
>
dl
,
PrintWriter
log
)
{
return
JavapFileManager
.
create
(
dl
,
log
);
if
(
defaultFileManager
==
null
)
defaultFileManager
=
JavapFileManager
.
create
(
dl
,
log
);
return
defaultFileManager
;
}
private
JavaFileObject
getClassFileObject
(
String
className
)
throws
IOException
{
...
...
@@ -1004,6 +1017,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
protected
Context
context
;
JavaFileManager
fileManager
;
JavaFileManager
defaultFileManager
;
PrintWriter
log
;
DiagnosticListener
<?
super
JavaFileObject
>
diagnosticListener
;
List
<
String
>
classes
;
...
...
This diff is collapsed.
Click to expand it.
test/tools/javap/T6879371.java
0 → 100644
浏览文件 @
4a3c9e25
/*
* Copyright 2009 Sun Microsystems, Inc. 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*/
/*
* @test
* @bug 6879371
* @summary javap does not close internal default file manager
*/
import
java.io.*
;
import
java.util.zip.*
;
public
class
T6879371
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
new
T6879371
().
run
();
}
public
void
run
()
throws
Exception
{
// create a simple test class which we can put into
// a test zip file and know that it will be used by
// javap.
File
classDir
=
new
File
(
"classes"
);
classDir
.
mkdir
();
String
className
=
"Test"
;
File
javaFile
=
writeTestFile
(
className
);
compileTestFile
(
classDir
,
javaFile
);
test
(
classDir
,
className
,
false
);
test
(
classDir
,
className
,
true
);
}
void
test
(
File
classDir
,
String
className
,
boolean
useJavaUtilZip
)
throws
Exception
{
// javac should really not be using system properties like this
// -- it should really be using (hidden) options -- but until then
// take care to leave system properties as we find them, so as not
// to adversely affect other tests that might follow.
String
prev
=
System
.
getProperty
(
"useJavaUtilZip"
);
setProperty
(
"useJavaUtilZip"
,
(
useJavaUtilZip
?
"true"
:
null
));
try
{
File
zipFile
=
zip
(
classDir
,
new
File
(
classDir
+
".zip"
));
javap
(
"-classpath"
,
zipFile
.
getPath
(),
className
);
if
(!
zipFile
.
delete
())
throw
new
Exception
(
"failed to delete "
+
zipFile
);
}
finally
{
setProperty
(
"useJavaUtilZip"
,
prev
);
}
}
File
writeTestFile
(
String
name
)
throws
IOException
{
File
f
=
new
File
(
name
+
".java"
);
PrintWriter
out
=
new
PrintWriter
(
new
BufferedWriter
(
new
FileWriter
(
f
)));
out
.
println
(
"class "
+
name
+
" { }"
);
out
.
close
();
return
f
;
}
void
compileTestFile
(
File
classDir
,
File
file
)
{
int
rc
=
com
.
sun
.
tools
.
javac
.
Main
.
compile
(
new
String
[]
{
"-d"
,
classDir
.
getPath
(),
file
.
getPath
()
});
if
(
rc
!=
0
)
throw
new
Error
(
"compilation failed. rc="
+
rc
);
}
File
zip
(
File
dir
,
File
zipFile
)
throws
IOException
{
ZipOutputStream
zipOut
=
new
ZipOutputStream
(
new
FileOutputStream
(
zipFile
));
for
(
File
file:
dir
.
listFiles
())
{
if
(
file
.
isFile
())
{
byte
[]
data
=
new
byte
[(
int
)
file
.
length
()];
DataInputStream
in
=
new
DataInputStream
(
new
FileInputStream
(
file
));
in
.
readFully
(
data
);
in
.
close
();
zipOut
.
putNextEntry
(
new
ZipEntry
(
file
.
getName
()));
zipOut
.
write
(
data
,
0
,
data
.
length
);
zipOut
.
closeEntry
();
}
}
zipOut
.
close
();
return
zipFile
;
}
String
javap
(
String
...
args
)
{
StringWriter
sw
=
new
StringWriter
();
PrintWriter
out
=
new
PrintWriter
(
sw
);
int
rc
=
com
.
sun
.
tools
.
javap
.
Main
.
run
(
args
,
out
);
if
(
rc
!=
0
)
throw
new
Error
(
"javap failed. rc="
+
rc
);
out
.
close
();
return
sw
.
toString
();
}
void
setProperty
(
String
key
,
String
value
)
{
if
(
value
!=
null
)
System
.
setProperty
(
key
,
value
);
else
System
.
getProperties
().
remove
(
key
);
}
}
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部