Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
957c2d62
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看板
提交
957c2d62
编写于
4月 04, 2011
作者:
L
lana
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
abac9621
7e27df0c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
222 addition
and
37 deletion
+222
-37
make/sun/xawt/mapfile-vers
make/sun/xawt/mapfile-vers
+1
-0
src/share/classes/java/awt/Toolkit.java
src/share/classes/java/awt/Toolkit.java
+2
-15
src/share/classes/sun/awt/HeadlessToolkit.java
src/share/classes/sun/awt/HeadlessToolkit.java
+2
-4
src/solaris/classes/sun/awt/X11/XRobotPeer.java
src/solaris/classes/sun/awt/X11/XRobotPeer.java
+2
-1
src/solaris/classes/sun/awt/X11/XToolkit.java
src/solaris/classes/sun/awt/X11/XToolkit.java
+6
-7
src/solaris/native/sun/awt/awt_Robot.c
src/solaris/native/sun/awt/awt_Robot.c
+104
-3
src/windows/classes/sun/awt/windows/WToolkit.java
src/windows/classes/sun/awt/windows/WToolkit.java
+4
-4
src/windows/native/sun/windows/awt_Toolkit.cpp
src/windows/native/sun/windows/awt_Toolkit.cpp
+3
-3
test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJob.java
test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJob.java
+48
-0
test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJobHeadless.java
...awt/Toolkit/Headless/GetPrintJob/GetPrintJobHeadless.java
+50
-0
未找到文件。
make/sun/xawt/mapfile-vers
浏览文件 @
957c2d62
...
@@ -158,6 +158,7 @@ SUNWprivate_1.1 {
...
@@ -158,6 +158,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl;
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
Java_sun_awt_X11_XRobotPeer_mouseWheelImpl;
Java_sun_awt_X11_XRobotPeer_setup;
Java_sun_awt_X11_XRobotPeer_setup;
Java_sun_awt_X11_XRobotPeer__1dispose;
Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl;
Java_java_awt_Component_initIDs;
Java_java_awt_Component_initIDs;
Java_java_awt_Container_initIDs;
Java_java_awt_Container_initIDs;
...
...
src/share/classes/java/awt/Toolkit.java
浏览文件 @
957c2d62
...
@@ -1157,12 +1157,9 @@ public abstract class Toolkit {
...
@@ -1157,12 +1157,9 @@ public abstract class Toolkit {
* takes JobAttributes and PageAttributes objects. This object
* takes JobAttributes and PageAttributes objects. This object
* may be updated to reflect the user's job choices on exit. May
* may be updated to reflect the user's job choices on exit. May
* be null.
* be null.
*
* @return a <code>PrintJob</code> object, or <code>null</code> if the
* @return a <code>PrintJob</code> object, or <code>null</code> if the
* user cancelled the print job.
* user cancelled the print job.
* @throws NullPointerException if frame is null. This exception is
* @throws NullPointerException if frame is null
* always thrown when GraphicsEnvironment.isHeadless() returns
* true.
* @throws SecurityException if this thread is not allowed to initiate a
* @throws SecurityException if this thread is not allowed to initiate a
* print job request
* print job request
* @see java.awt.GraphicsEnvironment#isHeadless
* @see java.awt.GraphicsEnvironment#isHeadless
...
@@ -1201,12 +1198,9 @@ public abstract class Toolkit {
...
@@ -1201,12 +1198,9 @@ public abstract class Toolkit {
* job. The attributes will be updated to reflect the user's
* job. The attributes will be updated to reflect the user's
* choices as outlined in the PageAttributes documentation. May be
* choices as outlined in the PageAttributes documentation. May be
* null.
* null.
*
* @return a <code>PrintJob</code> object, or <code>null</code> if the
* @return a <code>PrintJob</code> object, or <code>null</code> if the
* user cancelled the print job.
* user cancelled the print job.
* @throws NullPointerException if frame is null and either jobAttributes
* @throws NullPointerException if frame is null
* is null or jobAttributes.getDialog() returns
* JobAttributes.DialogType.NATIVE.
* @throws IllegalArgumentException if pageAttributes specifies differing
* @throws IllegalArgumentException if pageAttributes specifies differing
* cross feed and feed resolutions. Also if this thread has
* cross feed and feed resolutions. Also if this thread has
* access to the file system and jobAttributes specifies
* access to the file system and jobAttributes specifies
...
@@ -1218,9 +1212,6 @@ public abstract class Toolkit {
...
@@ -1218,9 +1212,6 @@ public abstract class Toolkit {
* opportunity to select a file and proceed with printing.
* opportunity to select a file and proceed with printing.
* The dialog will ensure that the selected output file
* The dialog will ensure that the selected output file
* is valid before returning from this method.
* is valid before returning from this method.
* <p>
* This exception is always thrown when GraphicsEnvironment.isHeadless()
* returns true.
* @throws SecurityException if this thread is not allowed to initiate a
* @throws SecurityException if this thread is not allowed to initiate a
* print job request, or if jobAttributes specifies print to file,
* print job request, or if jobAttributes specifies print to file,
* and this thread is not allowed to access the file system
* and this thread is not allowed to access the file system
...
@@ -1236,10 +1227,6 @@ public abstract class Toolkit {
...
@@ -1236,10 +1227,6 @@ public abstract class Toolkit {
PageAttributes
pageAttributes
)
{
PageAttributes
pageAttributes
)
{
// Override to add printing support with new job/page control classes
// Override to add printing support with new job/page control classes
if
(
GraphicsEnvironment
.
isHeadless
())
{
throw
new
IllegalArgumentException
();
}
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
if
(
this
!=
Toolkit
.
getDefaultToolkit
())
{
return
Toolkit
.
getDefaultToolkit
().
getPrintJob
(
frame
,
jobtitle
,
return
Toolkit
.
getDefaultToolkit
().
getPrintJob
(
frame
,
jobtitle
,
jobAttributes
,
jobAttributes
,
...
...
src/share/classes/sun/awt/HeadlessToolkit.java
浏览文件 @
957c2d62
...
@@ -320,8 +320,7 @@ public class HeadlessToolkit extends Toolkit
...
@@ -320,8 +320,7 @@ public class HeadlessToolkit extends Toolkit
// Should never happen
// Should never happen
throw
new
HeadlessException
();
throw
new
HeadlessException
();
}
}
throw
new
IllegalArgumentException
(
throw
new
NullPointerException
(
"frame must not be null"
);
"PrintJob not supported in a headless environment"
);
}
}
public
PrintJob
getPrintJob
(
Frame
frame
,
String
doctitle
,
Properties
props
)
public
PrintJob
getPrintJob
(
Frame
frame
,
String
doctitle
,
Properties
props
)
...
@@ -330,8 +329,7 @@ public class HeadlessToolkit extends Toolkit
...
@@ -330,8 +329,7 @@ public class HeadlessToolkit extends Toolkit
// Should never happen
// Should never happen
throw
new
HeadlessException
();
throw
new
HeadlessException
();
}
}
throw
new
IllegalArgumentException
(
throw
new
NullPointerException
(
"frame must not be null"
);
"PrintJob not supported in a headless environment"
);
}
}
/*
/*
...
...
src/solaris/classes/sun/awt/X11/XRobotPeer.java
浏览文件 @
957c2d62
...
@@ -48,7 +48,7 @@ class XRobotPeer implements RobotPeer {
...
@@ -48,7 +48,7 @@ class XRobotPeer implements RobotPeer {
}
}
public
void
dispose
()
{
public
void
dispose
()
{
// does nothing
_dispose
();
}
}
public
void
mouseMove
(
int
x
,
int
y
)
{
public
void
mouseMove
(
int
x
,
int
y
)
{
...
@@ -88,6 +88,7 @@ class XRobotPeer implements RobotPeer {
...
@@ -88,6 +88,7 @@ class XRobotPeer implements RobotPeer {
}
}
private
static
native
synchronized
void
setup
(
int
numberOfButtons
,
int
[]
buttonDownMasks
);
private
static
native
synchronized
void
setup
(
int
numberOfButtons
,
int
[]
buttonDownMasks
);
private
static
native
synchronized
void
_dispose
();
private
static
native
synchronized
void
mouseMoveImpl
(
X11GraphicsConfig
xgc
,
int
x
,
int
y
);
private
static
native
synchronized
void
mouseMoveImpl
(
X11GraphicsConfig
xgc
,
int
x
,
int
y
);
private
static
native
synchronized
void
mousePressImpl
(
int
buttons
);
private
static
native
synchronized
void
mousePressImpl
(
int
buttons
);
...
...
src/solaris/classes/sun/awt/X11/XToolkit.java
浏览文件 @
957c2d62
...
@@ -1222,8 +1222,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
...
@@ -1222,8 +1222,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
public
PrintJob
getPrintJob
(
final
Frame
frame
,
final
String
doctitle
,
public
PrintJob
getPrintJob
(
final
Frame
frame
,
final
String
doctitle
,
final
Properties
props
)
{
final
Properties
props
)
{
if
(
GraphicsEnvironment
.
isHeadless
()
)
{
if
(
frame
==
null
)
{
throw
new
IllegalArgumentException
(
);
throw
new
NullPointerException
(
"frame must not be null"
);
}
}
PrintJob2D
printJob
=
new
PrintJob2D
(
frame
,
doctitle
,
props
);
PrintJob2D
printJob
=
new
PrintJob2D
(
frame
,
doctitle
,
props
);
...
@@ -1236,11 +1236,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
...
@@ -1236,11 +1236,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
public
PrintJob
getPrintJob
(
final
Frame
frame
,
final
String
doctitle
,
public
PrintJob
getPrintJob
(
final
Frame
frame
,
final
String
doctitle
,
final
JobAttributes
jobAttributes
,
final
JobAttributes
jobAttributes
,
final
PageAttributes
pageAttributes
)
{
final
PageAttributes
pageAttributes
)
{
if
(
frame
==
null
)
{
if
(
GraphicsEnvironment
.
isHeadless
())
{
throw
new
NullPointerException
(
"frame must not be null"
);
throw
new
IllegalArgumentException
();
}
}
PrintJob2D
printJob
=
new
PrintJob2D
(
frame
,
doctitle
,
PrintJob2D
printJob
=
new
PrintJob2D
(
frame
,
doctitle
,
...
...
src/solaris/native/sun/awt/awt_Robot.c
浏览文件 @
957c2d62
...
@@ -48,12 +48,28 @@
...
@@ -48,12 +48,28 @@
#ifdef __linux__
#ifdef __linux__
#include <sys/socket.h>
#include <sys/socket.h>
#endif
#endif
#include <dlfcn.h>
extern
struct
X11GraphicsConfigIDs
x11GraphicsConfigIDs
;
extern
struct
X11GraphicsConfigIDs
x11GraphicsConfigIDs
;
static
jint
*
masks
;
static
jint
*
masks
;
static
jint
num_buttons
;
static
jint
num_buttons
;
static
unsigned
int
s_robotInstanceCounter
=
0
;
static
void
*
xcompositeLibHandle
=
NULL
;
static
Bool
xcompositeExtAvailable
=
False
;
static
Bool
xcompositeExtTested
=
False
;
typedef
Status
(
*
T_XCompositeQueryVersion
)(
Display
*
dpy
,
int
*
major_versionp
,
int
*
minor_versionp
);
typedef
Window
(
*
T_XCompositeGetOverlayWindow
)(
Display
*
dpy
,
Window
window
);
typedef
void
(
*
T_XCompositeReleaseOverlayWindow
)(
Display
*
dpy
,
Window
window
);
static
T_XCompositeQueryVersion
XCompositeQueryVersion
=
NULL
;
static
T_XCompositeGetOverlayWindow
XCompositeGetOverlayWindow
=
NULL
;
static
T_XCompositeReleaseOverlayWindow
XCompositeReleaseOverlayWindow
=
NULL
;
static
int32_t
isXTestAvailable
()
{
static
int32_t
isXTestAvailable
()
{
int32_t
major_opcode
,
first_event
,
first_error
;
int32_t
major_opcode
,
first_event
,
first_error
;
int32_t
event_basep
,
error_basep
,
majorp
,
minorp
;
int32_t
event_basep
,
error_basep
,
majorp
,
minorp
;
...
@@ -194,8 +210,80 @@ Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButton
...
@@ -194,8 +210,80 @@ Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButton
}
}
AWT_UNLOCK
();
AWT_UNLOCK
();
s_robotInstanceCounter
++
;
}
}
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_XRobotPeer__1dispose
(
JNIEnv
*
env
,
jclass
cls
)
{
if
(
--
s_robotInstanceCounter
)
{
return
;
}
// This is the last instance of the XRobotPeer being released
if
(
xcompositeExtTested
&&
xcompositeExtAvailable
&&
xcompositeLibHandle
)
{
// The lib is loaded in IsXCompositeAvailable(). Unload under AWT_LOCK
// so that the shutdown function of the lib behaves correctly.
AWT_LOCK
();
dlclose
(
xcompositeLibHandle
);
AWT_UNLOCK
();
}
xcompositeExtTested
=
False
;
xcompositeExtAvailable
=
False
;
xcompositeLibHandle
=
NULL
;
}
/*
* Returns True only if XCOMPOSITE is of version 0.3 or higher.
* The functions that we need are available since that version.
*
* Must be invoked under AWT_LOCK.
*
* Leaves the library loaded if the version is correct.
*/
static
Bool
IsXCompositeAvailable
()
{
if
(
!
xcompositeExtTested
)
{
int
opcode
,
eventb
,
errorb
;
if
(
XQueryExtension
(
awt_display
,
"Composite"
,
&
opcode
,
&
eventb
,
&
errorb
))
{
xcompositeLibHandle
=
dlopen
(
"libXcomposite.so.1"
,
RTLD_LAZY
|
RTLD_GLOBAL
);
#ifndef __linux__
/* SOLARIS */
if
(
xcompositeLibHandle
==
NULL
)
{
xcompositeLibHandle
=
dlopen
(
"/usr/sfw/lib/libXcomposite.so.1"
,
RTLD_LAZY
|
RTLD_GLOBAL
);
}
#endif
if
(
xcompositeLibHandle
)
{
int
major
,
minor
;
XCompositeQueryVersion
=
(
T_XCompositeQueryVersion
)
dlsym
(
xcompositeLibHandle
,
"XCompositeQueryVersion"
);
if
(
XCompositeQueryVersion
&&
XCompositeQueryVersion
(
awt_display
,
&
major
,
&
minor
))
{
if
(
major
>=
0
&&
minor
>=
3
)
{
XCompositeGetOverlayWindow
=
(
T_XCompositeGetOverlayWindow
)
dlsym
(
xcompositeLibHandle
,
"XCompositeGetOverlayWindow"
);
XCompositeReleaseOverlayWindow
=
(
T_XCompositeReleaseOverlayWindow
)
dlsym
(
xcompositeLibHandle
,
"XCompositeReleaseOverlayWindow"
);
if
(
XCompositeGetOverlayWindow
&&
XCompositeReleaseOverlayWindow
)
{
xcompositeExtAvailable
=
True
;
}
}
}
if
(
!
xcompositeExtAvailable
)
{
dlclose
(
xcompositeLibHandle
);
}
/* else the lib is unloaded in _dispose() */
}
}
xcompositeExtTested
=
True
;
}
return
xcompositeExtAvailable
;
}
JNIEXPORT
void
JNICALL
JNIEXPORT
void
JNICALL
Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl
(
JNIEnv
*
env
,
Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl
(
JNIEnv
*
env
,
...
@@ -211,7 +299,7 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
...
@@ -211,7 +299,7 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
jint
*
ary
;
/* Array of jints for sending pixel values back
jint
*
ary
;
/* Array of jints for sending pixel values back
* to parent process.
* to parent process.
*/
*/
Window
rootW
indow
;
Window
w
indow
;
AwtGraphicsConfigDataPtr
adata
;
AwtGraphicsConfigDataPtr
adata
;
DTRACE_PRINTLN6
(
"RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)"
,
xgc
,
x
,
y
,
width
,
height
,
pixelArray
);
DTRACE_PRINTLN6
(
"RobotPeer: getRGBPixelsImpl(%lx, %d, %d, %d, %d, %x)"
,
xgc
,
x
,
y
,
width
,
height
,
pixelArray
);
...
@@ -228,14 +316,24 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
...
@@ -228,14 +316,24 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
adata
=
(
AwtGraphicsConfigDataPtr
)
JNU_GetLongFieldAsPtr
(
env
,
xgc
,
x11GraphicsConfigIDs
.
aData
);
adata
=
(
AwtGraphicsConfigDataPtr
)
JNU_GetLongFieldAsPtr
(
env
,
xgc
,
x11GraphicsConfigIDs
.
aData
);
DASSERT
(
adata
!=
NULL
);
DASSERT
(
adata
!=
NULL
);
rootWindow
=
XRootWindow
(
awt_display
,
adata
->
awt_visInfo
.
screen
);
window
=
XRootWindow
(
awt_display
,
adata
->
awt_visInfo
.
screen
);
image
=
getWindowImage
(
awt_display
,
rootWindow
,
x
,
y
,
width
,
height
);
if
(
IsXCompositeAvailable
())
{
// Use 'composite overlay window' instead of the root window.
// See 6903034 for details.
window
=
XCompositeGetOverlayWindow
(
awt_display
,
window
);
}
image
=
getWindowImage
(
awt_display
,
window
,
x
,
y
,
width
,
height
);
/* Array to use to crunch around the pixel values */
/* Array to use to crunch around the pixel values */
ary
=
(
jint
*
)
malloc
(
width
*
height
*
sizeof
(
jint
));
ary
=
(
jint
*
)
malloc
(
width
*
height
*
sizeof
(
jint
));
if
(
ary
==
NULL
)
{
if
(
ary
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"OutOfMemoryError"
);
JNU_ThrowOutOfMemoryError
(
env
,
"OutOfMemoryError"
);
XDestroyImage
(
image
);
XDestroyImage
(
image
);
if
(
IsXCompositeAvailable
())
{
XCompositeReleaseOverlayWindow
(
awt_display
,
window
);
}
AWT_UNLOCK
();
AWT_UNLOCK
();
return
;
return
;
}
}
...
@@ -256,6 +354,9 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
...
@@ -256,6 +354,9 @@ Java_sun_awt_X11_XRobotPeer_getRGBPixelsImpl( JNIEnv *env,
free
(
ary
);
free
(
ary
);
XDestroyImage
(
image
);
XDestroyImage
(
image
);
if
(
IsXCompositeAvailable
())
{
XCompositeReleaseOverlayWindow
(
awt_display
,
window
);
}
AWT_UNLOCK
();
AWT_UNLOCK
();
}
}
...
...
src/windows/classes/sun/awt/windows/WToolkit.java
浏览文件 @
957c2d62
...
@@ -630,10 +630,10 @@ public class WToolkit extends SunToolkit implements Runnable {
...
@@ -630,10 +630,10 @@ public class WToolkit extends SunToolkit implements Runnable {
public
PrintJob
getPrintJob
(
Frame
frame
,
String
doctitle
,
public
PrintJob
getPrintJob
(
Frame
frame
,
String
doctitle
,
JobAttributes
jobAttributes
,
JobAttributes
jobAttributes
,
PageAttributes
pageAttributes
)
{
PageAttributes
pageAttributes
)
{
if
(
GraphicsEnvironment
.
isHeadless
()
)
{
if
(
frame
==
null
)
{
throw
new
IllegalArgumentException
(
);
throw
new
NullPointerException
(
"frame must not be null"
);
}
}
PrintJob2D
printJob
=
new
PrintJob2D
(
frame
,
doctitle
,
PrintJob2D
printJob
=
new
PrintJob2D
(
frame
,
doctitle
,
...
...
src/windows/native/sun/windows/awt_Toolkit.cpp
浏览文件 @
957c2d62
...
@@ -528,9 +528,6 @@ BOOL AwtToolkit::Dispose() {
...
@@ -528,9 +528,6 @@ BOOL AwtToolkit::Dispose() {
tk
.
m_isActive
=
FALSE
;
tk
.
m_isActive
=
FALSE
;
awt_dnd_uninitialize
();
awt_clipboard_uninitialize
((
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
));
// dispose Direct3D-related resources. This should be done
// dispose Direct3D-related resources. This should be done
// before AwtObjectList::Cleanup() as the d3d will attempt to
// before AwtObjectList::Cleanup() as the d3d will attempt to
// shutdown when the last of its windows is disposed of
// shutdown when the last of its windows is disposed of
...
@@ -539,6 +536,9 @@ BOOL AwtToolkit::Dispose() {
...
@@ -539,6 +536,9 @@ BOOL AwtToolkit::Dispose() {
AwtObjectList
::
Cleanup
();
AwtObjectList
::
Cleanup
();
AwtFont
::
Cleanup
();
AwtFont
::
Cleanup
();
awt_dnd_uninitialize
();
awt_clipboard_uninitialize
((
JNIEnv
*
)
JNU_GetEnv
(
jvm
,
JNI_VERSION_1_2
));
if
(
tk
.
m_inputMethodHWnd
!=
NULL
)
{
if
(
tk
.
m_inputMethodHWnd
!=
NULL
)
{
::
SendMessage
(
tk
.
m_inputMethodHWnd
,
WM_IME_CONTROL
,
IMC_OPENSTATUSWINDOW
,
0
);
::
SendMessage
(
tk
.
m_inputMethodHWnd
,
WM_IME_CONTROL
,
IMC_OPENSTATUSWINDOW
,
0
);
}
}
...
...
test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJob.java
0 → 100644
浏览文件 @
957c2d62
/*
@test
@bug 7023011
@library ../../../regtesthelpers
@build Sysout
@summary Toolkit.getPrintJob() throws wrong exceptions
@author andrei dmitriev: area=awt.headless
@run main GetPrintJob
*/
import
java.awt.*
;
import
java.util.Properties
;
import
test.java.awt.regtesthelpers.Sysout
;
/*
* In headfull mode we should always getting NPE on the getPrintJob() call if frame == null.
*/
public
class
GetPrintJob
{
public
static
void
main
(
String
[]
s
)
{
boolean
stage1Passed
=
false
;
boolean
stage2Passed
=
false
;
try
{
Toolkit
.
getDefaultToolkit
().
getPrintJob
(
(
Frame
)
null
,
"title"
,
new
Properties
());
}
catch
(
NullPointerException
e
)
{
stage1Passed
=
true
;
Sysout
.
println
(
"Stage 1 passed. getPrintJob(null, String, property) has thrown NPE."
);
}
if
(!
stage1Passed
)
{
throw
new
RuntimeException
(
"getPrintJob() should have thrown NPE but didn't."
);
}
try
{
Toolkit
.
getDefaultToolkit
().
getPrintJob
(
(
Frame
)
null
,
"title"
,
new
JobAttributes
(),
new
PageAttributes
());
}
catch
(
NullPointerException
e
)
{
stage2Passed
=
true
;
Sysout
.
println
(
"Stage 2 passed. getPrintJob(null, String, jobAttrs, pageAttr) has thrown NPE."
);
}
if
(!
stage2Passed
)
{
throw
new
RuntimeException
(
"getPrintJob() should have thrown NPE but didn't."
);
}
Sysout
.
println
(
"Test PASSED"
);
}
}
test/java/awt/Toolkit/Headless/GetPrintJob/GetPrintJobHeadless.java
0 → 100644
浏览文件 @
957c2d62
/*
@test
@bug 7023011
@library ../../../regtesthelpers
@build Sysout
@summary Toolkit.getPrintJob() throws wrong exceptions
@author andrei dmitriev: area=awt.headless
@run main/othervm -Djava.awt.headless=true GetPrintJobHeadless
*/
/*
* In headless mode we should always getting NPE on the getPrintJob() call
*/
import
java.awt.*
;
import
java.util.Properties
;
import
test.java.awt.regtesthelpers.Sysout
;
public
class
GetPrintJobHeadless
{
public
static
void
main
(
String
[]
s
)
{
boolean
stage1Passed
=
false
;
boolean
stage2Passed
=
false
;
try
{
Toolkit
.
getDefaultToolkit
().
getPrintJob
(
(
Frame
)
null
,
"title"
,
new
Properties
());
}
catch
(
NullPointerException
e
)
{
stage1Passed
=
true
;
e
.
printStackTrace
();
Sysout
.
println
(
"Stage 1 passed. getPrintJob(null, String, property) has thrown NPE."
);
}
if
(!
stage1Passed
)
{
throw
new
RuntimeException
(
"getPrintJob() should have thrown NPE but didn't."
);
}
try
{
Toolkit
.
getDefaultToolkit
().
getPrintJob
(
(
Frame
)
null
,
"title"
,
new
JobAttributes
(),
new
PageAttributes
());
}
catch
(
NullPointerException
e
)
{
stage2Passed
=
true
;
e
.
printStackTrace
();
Sysout
.
println
(
"Stage 2 passed. getPrintJob(null, String, jobAttrs, pageAttr) has thrown NPE."
);
}
if
(!
stage2Passed
)
{
throw
new
RuntimeException
(
"getPrintJob() should have thrown NPE but didn't."
);
}
Sysout
.
println
(
"Test PASSED"
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录