Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
e2c2ec86
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看板
提交
e2c2ec86
编写于
9月 10, 2009
作者:
B
bae
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6822057: X11 and Win32GraphicsDevice don't clone arrays returned from getConfigurations()
Reviewed-by: prr, hawtin
上级
a9f39722
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
122 addition
and
4 deletion
+122
-4
src/solaris/classes/sun/awt/X11GraphicsDevice.java
src/solaris/classes/sun/awt/X11GraphicsDevice.java
+1
-1
src/windows/classes/sun/awt/Win32GraphicsDevice.java
src/windows/classes/sun/awt/Win32GraphicsDevice.java
+2
-2
src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java
src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java
+1
-1
test/java/awt/GraphicsDevice/CloneConfigsTest.java
test/java/awt/GraphicsDevice/CloneConfigsTest.java
+118
-0
未找到文件。
src/solaris/classes/sun/awt/X11GraphicsDevice.java
浏览文件 @
e2c2ec86
...
@@ -134,7 +134,7 @@ public class X11GraphicsDevice
...
@@ -134,7 +134,7 @@ public class X11GraphicsDevice
makeConfigurations
();
makeConfigurations
();
}
}
}
}
return
configs
;
return
configs
.
clone
()
;
}
}
private
void
makeConfigurations
()
{
private
void
makeConfigurations
()
{
...
...
src/windows/classes/sun/awt/Win32GraphicsDevice.java
浏览文件 @
e2c2ec86
...
@@ -165,7 +165,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
...
@@ -165,7 +165,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
if
(
defaultConfig
!=
null
)
{
if
(
defaultConfig
!=
null
)
{
configs
=
new
GraphicsConfiguration
[
1
];
configs
=
new
GraphicsConfiguration
[
1
];
configs
[
0
]
=
defaultConfig
;
configs
[
0
]
=
defaultConfig
;
return
configs
;
return
configs
.
clone
()
;
}
}
}
}
...
@@ -196,7 +196,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
...
@@ -196,7 +196,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
configs
=
new
GraphicsConfiguration
[
v
.
size
()];
configs
=
new
GraphicsConfiguration
[
v
.
size
()];
v
.
copyInto
(
configs
);
v
.
copyInto
(
configs
);
}
}
return
configs
;
return
configs
.
clone
()
;
}
}
/**
/**
...
...
src/windows/classes/sun/java2d/d3d/D3DGraphicsDevice.java
浏览文件 @
e2c2ec86
...
@@ -426,7 +426,7 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
...
@@ -426,7 +426,7 @@ public class D3DGraphicsDevice extends Win32GraphicsDevice {
if
(
defaultConfig
!=
null
)
{
if
(
defaultConfig
!=
null
)
{
configs
=
new
GraphicsConfiguration
[
1
];
configs
=
new
GraphicsConfiguration
[
1
];
configs
[
0
]
=
defaultConfig
;
configs
[
0
]
=
defaultConfig
;
return
configs
;
return
configs
.
clone
()
;
}
}
}
}
}
}
...
...
test/java/awt/GraphicsDevice/CloneConfigsTest.java
0 → 100644
浏览文件 @
e2c2ec86
/*
* 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 6822057
*
* @summary Test verifies that list of supported graphics configurations
* can not be changed via modification of elements of an array
* returned by getConfiguration() method.
*
* @run main CloneConfigsTest
* @run main/othervm -Dsun.java2d.opengl=True CloneConfigsTest
* @run main/othervm -Dsun.java2d.d3d=true CloneConfigsTest
* @run main/othervm -Dsun.java2d.noddraw=true CloneConfigsTest
*/
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsEnvironment
;
import
java.awt.Rectangle
;
import
java.awt.geom.AffineTransform
;
import
java.awt.image.BufferedImage
;
import
java.awt.image.ColorModel
;
public
class
CloneConfigsTest
{
public
static
void
main
(
String
[]
args
)
{
GraphicsEnvironment
env
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsDevice
[]
devices
=
env
.
getScreenDevices
();
GraphicsConfiguration
c
=
new
TestConfig
();
for
(
GraphicsDevice
gd
:
devices
)
{
System
.
out
.
println
(
"Device: "
+
gd
);
GraphicsConfiguration
[]
configs
=
gd
.
getConfigurations
();
for
(
int
i
=
0
;
i
<
configs
.
length
;
i
++)
{
GraphicsConfiguration
gc
=
configs
[
i
];
System
.
out
.
println
(
"\tConfig: "
+
gc
);
configs
[
i
]
=
c
;
}
// verify whether array of configs was modified
configs
=
gd
.
getConfigurations
();
for
(
GraphicsConfiguration
gc
:
configs
)
{
if
(
gc
==
c
)
{
throw
new
RuntimeException
(
"Test failed."
);
}
}
System
.
out
.
println
(
"Test passed."
);
}
}
private
static
class
TestConfig
extends
GraphicsConfiguration
{
@Override
public
GraphicsDevice
getDevice
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
BufferedImage
createCompatibleImage
(
int
width
,
int
height
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
ColorModel
getColorModel
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
ColorModel
getColorModel
(
int
transparency
)
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
AffineTransform
getDefaultTransform
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
AffineTransform
getNormalizingTransform
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
@Override
public
Rectangle
getBounds
()
{
throw
new
UnsupportedOperationException
(
"Not supported yet."
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录