Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
858cd0f3
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看板
提交
858cd0f3
编写于
4月 08, 2014
作者:
B
bagiras
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8035737: [parfait] JNI exception pending in jdk/src/windows/native/sun/windows/awt_PrintControl.cpp
Reviewed-by: serb, pchelko
上级
0f4b346d
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
124 addition
and
34 deletion
+124
-34
src/windows/native/sun/windows/awt_PrintControl.cpp
src/windows/native/sun/windows/awt_PrintControl.cpp
+99
-33
src/windows/native/sun/windows/awt_PrintDialog.cpp
src/windows/native/sun/windows/awt_PrintDialog.cpp
+25
-1
未找到文件。
src/windows/native/sun/windows/awt_PrintControl.cpp
浏览文件 @
858cd0f3
/*
* Copyright (c) 1999, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 201
4
, 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
...
...
@@ -233,107 +233,166 @@ void AwtPrintControl::initIDs(JNIEnv *env, jclass cls)
TRY
;
jclass
cls
=
env
->
FindClass
(
"sun/awt/windows/WPrinterJob"
);
CHECK_NULL
(
cls
);
AwtPrintControl
::
dialogOwnerPeerID
=
env
->
GetFieldID
(
cls
,
"dialogOwnerPeer"
,
"Ljava/awt/peer/ComponentPeer;"
);
DASSERT
(
AwtPrintControl
::
dialogOwnerPeerID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
dialogOwnerPeerID
);
AwtPrintControl
::
getPrintDCID
=
env
->
GetMethodID
(
cls
,
"getPrintDC"
,
"()J"
);
DASSERT
(
AwtPrintControl
::
getPrintDCID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getPrintDCID
);
AwtPrintControl
::
setPrintDCID
=
env
->
GetMethodID
(
cls
,
"setPrintDC"
,
"(J)V"
);
DASSERT
(
AwtPrintControl
::
setPrintDCID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setPrintDCID
);
AwtPrintControl
::
getDevmodeID
=
env
->
GetMethodID
(
cls
,
"getDevMode"
,
"()J"
);
DASSERT
(
AwtPrintControl
::
getDevmodeID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getDevmodeID
);
AwtPrintControl
::
setDevmodeID
=
env
->
GetMethodID
(
cls
,
"setDevMode"
,
"(J)V"
);
DASSERT
(
AwtPrintControl
::
setDevmodeID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setDevmodeID
);
AwtPrintControl
::
getDevnamesID
=
env
->
GetMethodID
(
cls
,
"getDevNames"
,
"()J"
);
DASSERT
(
AwtPrintControl
::
getDevnamesID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getDevnamesID
);
AwtPrintControl
::
setDevnamesID
=
env
->
GetMethodID
(
cls
,
"setDevNames"
,
"(J)V"
);
DASSERT
(
AwtPrintControl
::
setDevnamesID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setDevnamesID
);
AwtPrintControl
::
driverDoesMultipleCopiesID
=
env
->
GetFieldID
(
cls
,
"driverDoesMultipleCopies"
,
"Z"
);
DASSERT
(
AwtPrintControl
::
driverDoesMultipleCopiesID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
driverDoesMultipleCopiesID
);
AwtPrintControl
::
driverDoesCollationID
=
env
->
GetFieldID
(
cls
,
"driverDoesCollation"
,
"Z"
);
DASSERT
(
AwtPrintControl
::
driverDoesCollationID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
driverDoesCollationID
);
AwtPrintControl
::
getCopiesID
=
env
->
GetMethodID
(
cls
,
"getCopiesAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getCopiesID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getCopiesID
);
AwtPrintControl
::
getCollateID
=
env
->
GetMethodID
(
cls
,
"getCollateAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getCollateID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getCollateID
);
AwtPrintControl
::
getOrientID
=
env
->
GetMethodID
(
cls
,
"getOrientAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getOrientID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getOrientID
);
AwtPrintControl
::
getFromPageID
=
env
->
GetMethodID
(
cls
,
"getFromPageAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getFromPageID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getFromPageID
);
AwtPrintControl
::
getToPageID
=
env
->
GetMethodID
(
cls
,
"getToPageAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getToPageID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getToPageID
);
AwtPrintControl
::
getMinPageID
=
env
->
GetMethodID
(
cls
,
"getMinPageAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getMinPageID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getMinPageID
);
AwtPrintControl
::
getMaxPageID
=
env
->
GetMethodID
(
cls
,
"getMaxPageAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getMaxPageID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getMaxPageID
);
AwtPrintControl
::
getDestID
=
env
->
GetMethodID
(
cls
,
"getDestAttrib"
,
"()Z"
);
DASSERT
(
AwtPrintControl
::
getDestID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getDestID
);
AwtPrintControl
::
getQualityID
=
env
->
GetMethodID
(
cls
,
"getQualityAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getQualityID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getQualityID
);
AwtPrintControl
::
getColorID
=
env
->
GetMethodID
(
cls
,
"getColorAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getColorID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getColorID
);
AwtPrintControl
::
getSidesID
=
env
->
GetMethodID
(
cls
,
"getSidesAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getSidesID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getSidesID
);
AwtPrintControl
::
getPrinterID
=
env
->
GetMethodID
(
cls
,
"getPrinterAttrib"
,
"()Ljava/lang/String;"
);
DASSERT
(
AwtPrintControl
::
getPrinterID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getPrinterID
);
AwtPrintControl
::
getWin32MediaID
=
env
->
GetMethodID
(
cls
,
"getWin32MediaAttrib"
,
"()[I"
);
DASSERT
(
AwtPrintControl
::
getWin32MediaID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getWin32MediaID
);
AwtPrintControl
::
setWin32MediaID
=
env
->
GetMethodID
(
cls
,
"setWin32MediaAttrib"
,
"(III)V"
);
DASSERT
(
AwtPrintControl
::
setWin32MediaID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setWin32MediaID
);
AwtPrintControl
::
getWin32MediaTrayID
=
env
->
GetMethodID
(
cls
,
"getMediaTrayAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getWin32MediaTrayID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getWin32MediaTrayID
);
AwtPrintControl
::
setWin32MediaTrayID
=
env
->
GetMethodID
(
cls
,
"setMediaTrayAttrib"
,
"(I)V"
);
DASSERT
(
AwtPrintControl
::
setWin32MediaTrayID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setWin32MediaTrayID
);
AwtPrintControl
::
getSelectID
=
env
->
GetMethodID
(
cls
,
"getSelectAttrib"
,
"()I"
);
DASSERT
(
AwtPrintControl
::
getSelectID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getSelectID
);
AwtPrintControl
::
getPrintToFileEnabledID
=
env
->
GetMethodID
(
cls
,
"getPrintToFileEnabled"
,
"()Z"
);
DASSERT
(
AwtPrintControl
::
getPrintToFileEnabledID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
getPrintToFileEnabledID
);
AwtPrintControl
::
setNativeAttID
=
env
->
GetMethodID
(
cls
,
"setNativeAttributes"
,
"(III)V"
);
DASSERT
(
AwtPrintControl
::
setNativeAttID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setNativeAttID
);
AwtPrintControl
::
setRangeCopiesID
=
env
->
GetMethodID
(
cls
,
"setRangeCopiesAttribute"
,
"(IIZI)V"
);
DASSERT
(
AwtPrintControl
::
setRangeCopiesID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setRangeCopiesID
);
AwtPrintControl
::
setResID
=
env
->
GetMethodID
(
cls
,
"setResolutionDPI"
,
"(II)V"
);
DASSERT
(
AwtPrintControl
::
setResID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setResID
);
AwtPrintControl
::
setPrinterID
=
env
->
GetMethodID
(
cls
,
"setPrinterNameAttrib"
,
"(Ljava/lang/String;)V"
);
DASSERT
(
AwtPrintControl
::
setPrinterID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setPrinterID
);
AwtPrintControl
::
setJobAttributesID
=
env
->
GetMethodID
(
cls
,
"setJobAttributes"
,
"(Ljavax/print/attribute/PrintRequestAttributeSet;IISSSSSSS)V"
);
DASSERT
(
AwtPrintControl
::
driverDoesMultipleCopiesID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getPrintDCID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setPrintDCID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getDevmodeID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setDevmodeID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getDevnamesID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setDevnamesID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
driverDoesCollationID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getWin32MediaID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setWin32MediaID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getWin32MediaTrayID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setWin32MediaTrayID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setRangeCopiesID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setResID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setNativeAttID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
dialogOwnerPeerID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getCopiesID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getOrientID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getPrinterID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getCollateID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getFromPageID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getToPageID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getMinPageID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getMaxPageID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getDestID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getQualityID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getColorID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getSidesID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getSelectID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
getPrintToFileEnabledID
!=
NULL
);
DASSERT
(
AwtPrintControl
::
setJobAttributesID
!=
NULL
);
CHECK_NULL
(
AwtPrintControl
::
setJobAttributesID
);
CATCH_BAD_ALLOC
;
}
...
...
@@ -606,6 +665,10 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
LPTSTR
getName
=
(
LPTSTR
)
JNU_GetStringPlatformChars
(
env
,
printerName
,
NULL
);
if
(
getName
==
NULL
)
{
env
->
DeleteLocalRef
(
printerName
);
throw
std
::
bad_alloc
();
}
BOOL
samePrinter
=
FALSE
;
...
...
@@ -652,6 +715,7 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
if
(
portName
!=
NULL
)
{
free
(
portName
);
}
env
->
DeleteLocalRef
(
printerName
);
return
FALSE
;
}
...
...
@@ -664,11 +728,13 @@ BOOL AwtPrintControl::InitPrintDialog(JNIEnv *env,
if
(
portName
!=
NULL
)
{
free
(
portName
);
}
env
->
DeleteLocalRef
(
printerName
);
return
FALSE
;
}
delete
[]
buffer
;
}
env
->
DeleteLocalRef
(
printerName
);
// PrintDlg may change the values of hDevMode and hDevNames so we
// re-initialize our saved handles.
AwtPrintControl
::
setPrintHDMode
(
env
,
printCtrl
,
NULL
);
...
...
src/windows/native/sun/windows/awt_PrintDialog.cpp
浏览文件 @
858cd0f3
...
...
@@ -204,11 +204,24 @@ Java_sun_awt_windows_WPrintDialogPeer__1show(JNIEnv *env, jobject peer)
// as peer object is used later on another thread, create a global ref
jobject
peerGlobalRef
=
env
->
NewGlobalRef
(
peer
);
DASSERT
(
peerGlobalRef
!=
NULL
);
CHECK_NULL_RETURN
(
peerGlobalRef
,
0
);
jobject
target
=
env
->
GetObjectField
(
peerGlobalRef
,
AwtObject
::
targetID
);
DASSERT
(
target
!=
NULL
);
if
(
target
==
NULL
)
{
env
->
DeleteGlobalRef
(
peerGlobalRef
);
return
0
;
}
jobject
parent
=
env
->
GetObjectField
(
peerGlobalRef
,
AwtPrintDialog
::
parentID
);
jobject
control
=
env
->
GetObjectField
(
target
,
AwtPrintDialog
::
controlID
);
DASSERT
(
control
!=
NULL
);
if
(
control
==
NULL
)
{
env
->
DeleteGlobalRef
(
peerGlobalRef
);
env
->
DeleteLocalRef
(
target
);
if
(
parent
!=
NULL
)
{
env
->
DeleteLocalRef
(
parent
);
}
return
0
;
}
AwtComponent
*
awtParent
=
(
parent
!=
NULL
)
?
(
AwtComponent
*
)
JNI_GET_PDATA
(
parent
)
:
NULL
;
HWND
hwndOwner
=
awtParent
?
awtParent
->
GetHWnd
()
:
NULL
;
...
...
@@ -217,7 +230,18 @@ Java_sun_awt_windows_WPrintDialogPeer__1show(JNIEnv *env, jobject peer)
memset
(
&
pd
,
0
,
sizeof
(
PRINTDLG
));
pd
.
lStructSize
=
sizeof
(
PRINTDLG
);
pd
.
lCustData
=
(
LPARAM
)
peerGlobalRef
;
BOOL
ret
=
AwtPrintControl
::
InitPrintDialog
(
env
,
control
,
pd
);
BOOL
ret
;
try
{
ret
=
AwtPrintControl
::
InitPrintDialog
(
env
,
control
,
pd
);
}
catch
(
std
::
bad_alloc
&
)
{
env
->
DeleteGlobalRef
(
peerGlobalRef
);
env
->
DeleteLocalRef
(
target
);
if
(
parent
!=
NULL
)
{
env
->
DeleteLocalRef
(
parent
);
}
env
->
DeleteLocalRef
(
control
);
throw
;
}
if
(
!
ret
)
{
/* Couldn't use the printer, or spooler isn't running
* Call Page dialog with ' PD_RETURNDEFAULT' so it doesn't try
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录