Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
77dfb26e
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看板
提交
77dfb26e
编写于
2月 25, 2019
作者:
S
sveerabhadra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8212202: [Windows] Exception if no printers are installed.
Reviewed-by: prr
上级
5b8a6848
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
45 addition
and
17 deletion
+45
-17
src/windows/classes/sun/print/PrintServiceLookupProvider.java
...windows/classes/sun/print/PrintServiceLookupProvider.java
+30
-8
src/windows/native/sun/windows/WPrinterJob.cpp
src/windows/native/sun/windows/WPrinterJob.cpp
+14
-8
test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java
...emotePrinterStatusRefresh/RemotePrinterStatusRefresh.java
+1
-1
未找到文件。
src/windows/classes/sun/print/PrintServiceLookupProvider.java
浏览文件 @
77dfb26e
...
...
@@ -400,18 +400,36 @@ public class PrintServiceLookupProvider extends PrintServiceLookup {
list.
*/
class
RemotePrinterChangeListener
extends
Thread
{
private
String
[]
prevRemotePrinters
;
private
String
[]
prevRemotePrinters
=
null
;
RemotePrinterChangeListener
()
{
prevRemotePrinters
=
getRemotePrintersNames
();
}
boolean
doCompare
(
String
[]
str1
,
String
[]
str2
)
{
if
(
str1
==
null
&&
str2
==
null
)
{
return
false
;
}
else
if
(
str1
==
null
||
str2
==
null
)
{
return
true
;
}
if
(
str1
.
length
!=
str2
.
length
)
{
return
true
;
}
else
{
for
(
int
i
=
0
;
i
<
str1
.
length
;
i
++)
{
for
(
int
j
=
0
;
j
<
str2
.
length
;
j
++)
{
// skip if both are nulls
if
(
str1
[
i
]
==
null
&&
str2
[
j
]
==
null
)
{
continue
;
}
// return true if there is a 'difference' but
// no need to access the individual string
if
(
str1
[
i
]
==
null
||
str2
[
j
]
==
null
)
{
return
true
;
}
// do comparison only if they are non-nulls
if
(!
str1
[
i
].
equals
(
str2
[
j
]))
{
return
true
;
}
...
...
@@ -425,15 +443,19 @@ public class PrintServiceLookupProvider extends PrintServiceLookup {
@Override
public
void
run
()
{
while
(
true
)
{
String
[]
currentRemotePrinters
=
getRemotePrintersNames
();
if
(
doCompare
(
prevRemotePrinters
,
currentRemotePrinters
))
{
if
(
prevRemotePrinters
!=
null
&&
prevRemotePrinters
.
length
>
0
)
{
String
[]
currentRemotePrinters
=
getRemotePrintersNames
();
if
(
doCompare
(
prevRemotePrinters
,
currentRemotePrinters
))
{
// updated the printers data
// printers list now contains both local and network printer data
refreshServices
();
// updated the printers data
// printers list now contains both local and network printer data
refreshServices
();
// store the current data for next comparison
prevRemotePrinters
=
currentRemotePrinters
;
// store the current data for next comparison
prevRemotePrinters
=
currentRemotePrinters
;
}
}
else
{
prevRemotePrinters
=
getRemotePrintersNames
();
}
try
{
...
...
src/windows/native/sun/windows/WPrinterJob.cpp
浏览文件 @
77dfb26e
...
...
@@ -249,7 +249,7 @@ Java_sun_print_PrintServiceLookupProvider_getRemotePrintersNames(JNIEnv *env,
if
(
clazz
==
NULL
)
{
return
NULL
;
}
jobjectArray
nameArray
;
jobjectArray
nameArray
=
NULL
;
try
{
::
EnumPrinters
(
PRINTER_ENUM_LOCAL
|
PRINTER_ENUM_CONNECTIONS
,
...
...
@@ -270,13 +270,14 @@ Java_sun_print_PrintServiceLookupProvider_getRemotePrintersNames(JNIEnv *env,
}
}
// Allocate space only for the network type printers
nameArray
=
env
->
NewObjectArray
(
remotePrintersCount
,
clazz
,
NULL
);
if
(
nameArray
==
NULL
)
{
throw
std
::
bad_alloc
();
// return remote printers only if the list contains it.
if
(
remotePrintersCount
>
0
)
{
// Allocate space only for the network type printers
nameArray
=
env
->
NewObjectArray
(
remotePrintersCount
,
clazz
,
NULL
);
if
(
nameArray
==
NULL
)
{
throw
std
::
bad_alloc
();
}
}
}
else
{
nameArray
=
NULL
;
}
// Loop thro' network printers list only
...
...
@@ -298,7 +299,12 @@ Java_sun_print_PrintServiceLookupProvider_getRemotePrintersNames(JNIEnv *env,
delete
[]
pPrinterEnum
;
delete
[]
pNetworkPrinterLoc
;
return
nameArray
;
if
(
nameArray
!=
NULL
)
{
return
nameArray
;
}
else
{
return
env
->
NewObjectArray
(
0
,
clazz
,
NULL
);
}
CATCH_BAD_ALLOC_RET
(
NULL
);
}
...
...
test/jdk/java/awt/print/RemotePrinterStatusRefresh/RemotePrinterStatusRefresh.java
浏览文件 @
77dfb26e
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 8153732
* @bug 8153732
8212202
* @requires (os.family == "Windows")
* @summary Windows remote printer changes do not reflect in lookupPrintServices()
* @ignore Requires a new network printer installation\removal
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录