Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
b58616eb
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看板
提交
b58616eb
编写于
5月 08, 2009
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6657133: Mutable statics in imageio plugins (findbugs)
Reviewed-by: prr
上级
9d18b9ea
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
51 addition
and
21 deletion
+51
-21
src/share/classes/com/sun/imageio/stream/StreamCloser.java
src/share/classes/com/sun/imageio/stream/StreamCloser.java
+31
-13
src/share/classes/javax/imageio/plugins/bmp/BMPImageWriteParam.java
...classes/javax/imageio/plugins/bmp/BMPImageWriteParam.java
+1
-1
src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
...asses/javax/imageio/stream/FileCacheImageInputStream.java
+8
-2
src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java
...sses/javax/imageio/stream/FileCacheImageOutputStream.java
+8
-2
src/share/lib/security/java.security
src/share/lib/security/java.security
+1
-1
src/share/lib/security/java.security-solaris
src/share/lib/security/java.security-solaris
+1
-1
src/share/lib/security/java.security-windows
src/share/lib/security/java.security-windows
+1
-1
未找到文件。
src/share/classes/com/sun/imageio/stream/StreamCloser.java
浏览文件 @
b58616eb
...
...
@@ -43,35 +43,35 @@ import javax.imageio.stream.ImageInputStream;
*/
public
class
StreamCloser
{
private
static
WeakHashMap
<
ImageInputStream
,
Object
>
toCloseQueue
;
private
static
WeakHashMap
<
CloseAction
,
Object
>
toCloseQueue
;
private
static
Thread
streamCloser
;
public
static
void
addToQueue
(
ImageInputStream
iis
)
{
public
static
void
addToQueue
(
CloseAction
ca
)
{
synchronized
(
StreamCloser
.
class
)
{
if
(
toCloseQueue
==
null
)
{
toCloseQueue
=
new
WeakHashMap
<
ImageInputStream
,
Object
>();
new
WeakHashMap
<
CloseAction
,
Object
>();
}
toCloseQueue
.
put
(
iis
,
null
);
toCloseQueue
.
put
(
ca
,
null
);
if
(
streamCloser
==
null
)
{
final
Runnable
streamCloserRunnable
=
new
Runnable
()
{
public
void
run
()
{
if
(
toCloseQueue
!=
null
)
{
synchronized
(
StreamCloser
.
class
)
{
Set
<
ImageInputStream
>
set
=
Set
<
CloseAction
>
set
=
toCloseQueue
.
keySet
();
// Make a copy of the set in order to avoid
// concurrent modification (the is.close()
// will in turn call removeFromQueue())
ImageInputStream
[]
stream
s
=
new
ImageInputStream
[
set
.
size
()];
streams
=
set
.
toArray
(
stream
s
);
for
(
ImageInputStream
is
:
stream
s
)
{
if
(
is
!=
null
)
{
CloseAction
[]
action
s
=
new
CloseAction
[
set
.
size
()];
actions
=
set
.
toArray
(
action
s
);
for
(
CloseAction
ca
:
action
s
)
{
if
(
ca
!=
null
)
{
try
{
is
.
close
();
ca
.
performAction
();
}
catch
(
IOException
e
)
{
}
}
...
...
@@ -106,10 +106,28 @@ public class StreamCloser {
}
}
public
static
void
removeFromQueue
(
ImageInputStream
iis
)
{
public
static
void
removeFromQueue
(
CloseAction
ca
)
{
synchronized
(
StreamCloser
.
class
)
{
if
(
toCloseQueue
!=
null
)
{
toCloseQueue
.
remove
(
iis
);
toCloseQueue
.
remove
(
ca
);
}
}
}
public
static
CloseAction
createCloseAction
(
ImageInputStream
iis
)
{
return
new
CloseAction
(
iis
);
}
public
static
final
class
CloseAction
{
private
ImageInputStream
iis
;
private
CloseAction
(
ImageInputStream
iis
)
{
this
.
iis
=
iis
;
}
public
void
performAction
()
throws
IOException
{
if
(
iis
!=
null
)
{
iis
.
close
();
}
}
}
...
...
src/share/classes/javax/imageio/plugins/bmp/BMPImageWriteParam.java
浏览文件 @
b58616eb
...
...
@@ -78,7 +78,7 @@ public class BMPImageWriteParam extends ImageWriteParam {
super
(
locale
);
// Set compression types ("BI_RGB" denotes uncompressed).
compressionTypes
=
BMPConstants
.
compressionTypeNames
;
compressionTypes
=
BMPConstants
.
compressionTypeNames
.
clone
()
;
// Set compression flag.
canWriteCompressed
=
true
;
...
...
src/share/classes/javax/imageio/stream/FileCacheImageInputStream.java
浏览文件 @
b58616eb
...
...
@@ -62,6 +62,10 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl {
/** The DisposerRecord that closes the underlying cache. */
private
final
DisposerRecord
disposerRecord
;
/** The CloseAction that closes the stream in
* the StreamCloser's shutdown hook */
private
final
StreamCloser
.
CloseAction
closeAction
;
/**
* Constructs a <code>FileCacheImageInputStream</code> that will read
* from a given <code>InputStream</code>.
...
...
@@ -96,7 +100,9 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl {
this
.
cacheFile
=
File
.
createTempFile
(
"imageio"
,
".tmp"
,
cacheDir
);
this
.
cache
=
new
RandomAccessFile
(
cacheFile
,
"rw"
);
StreamCloser
.
addToQueue
(
this
);
this
.
closeAction
=
StreamCloser
.
createCloseAction
(
this
);
StreamCloser
.
addToQueue
(
closeAction
);
disposerRecord
=
new
StreamDisposerRecord
(
cacheFile
,
cache
);
if
(
getClass
()
==
FileCacheImageInputStream
.
class
)
{
...
...
@@ -242,7 +248,7 @@ public class FileCacheImageInputStream extends ImageInputStreamImpl {
stream
=
null
;
cache
=
null
;
cacheFile
=
null
;
StreamCloser
.
removeFromQueue
(
this
);
StreamCloser
.
removeFromQueue
(
closeAction
);
}
/**
...
...
src/share/classes/javax/imageio/stream/FileCacheImageOutputStream.java
浏览文件 @
b58616eb
...
...
@@ -48,6 +48,10 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl {
// Pos after last (rightmost) byte written
private
long
maxStreamPos
=
0L
;
/** The CloseAction that closes the stream in
* the StreamCloser's shutdown hook */
private
final
StreamCloser
.
CloseAction
closeAction
;
/**
* Constructs a <code>FileCacheImageOutputStream</code> that will write
* to a given <code>outputStream</code>.
...
...
@@ -82,7 +86,9 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl {
this
.
cacheFile
=
File
.
createTempFile
(
"imageio"
,
".tmp"
,
cacheDir
);
this
.
cache
=
new
RandomAccessFile
(
cacheFile
,
"rw"
);
StreamCloser
.
addToQueue
(
this
);
this
.
closeAction
=
StreamCloser
.
createCloseAction
(
this
);
StreamCloser
.
addToQueue
(
closeAction
);
}
public
int
read
()
throws
IOException
{
...
...
@@ -227,7 +233,7 @@ public class FileCacheImageOutputStream extends ImageOutputStreamImpl {
cacheFile
=
null
;
stream
.
flush
();
stream
=
null
;
StreamCloser
.
removeFromQueue
(
this
);
StreamCloser
.
removeFromQueue
(
closeAction
);
}
public
void
flushBefore
(
long
pos
)
throws
IOException
{
...
...
src/share/lib/security/java.security
浏览文件 @
b58616eb
...
...
@@ -127,7 +127,7 @@ system.scope=sun.security.provider.IdentityDatabase
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.
package.access=sun.
,com.sun.imageio.
#
# List of comma-separated packages that start with or equal this string
...
...
src/share/lib/security/java.security-solaris
浏览文件 @
b58616eb
...
...
@@ -128,7 +128,7 @@ system.scope=sun.security.provider.IdentityDatabase
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.
package.access=sun.
,com.sun.imageio.
#
# List of comma-separated packages that start with or equal this string
...
...
src/share/lib/security/java.security-windows
浏览文件 @
b58616eb
...
...
@@ -128,7 +128,7 @@ system.scope=sun.security.provider.IdentityDatabase
# passed to checkPackageAccess unless the
# corresponding RuntimePermission ("accessClassInPackage."+package) has
# been granted.
package.access=sun.
package.access=sun.
,com.sun.imageio.
#
# List of comma-separated packages that start with or equal this string
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录