Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
9080ea2e
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看板
提交
9080ea2e
编写于
10月 14, 2013
作者:
J
jgodinez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8022536: closed/javax/print/TextFlavorTest.java fails
Reviewed-by: prr, jchen
上级
348a6f61
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
134 addition
and
23 deletion
+134
-23
src/solaris/classes/sun/print/CUPSPrinter.java
src/solaris/classes/sun/print/CUPSPrinter.java
+18
-7
src/solaris/classes/sun/print/IPPPrintService.java
src/solaris/classes/sun/print/IPPPrintService.java
+3
-0
src/solaris/classes/sun/print/UnixPrintServiceLookup.java
src/solaris/classes/sun/print/UnixPrintServiceLookup.java
+49
-15
test/java/awt/print/PrinterJob/PrintLatinCJKTest.java
test/java/awt/print/PrinterJob/PrintLatinCJKTest.java
+3
-1
test/javax/print/TextFlavorTest.java
test/javax/print/TextFlavorTest.java
+61
-0
未找到文件。
src/solaris/classes/sun/print/CUPSPrinter.java
浏览文件 @
9080ea2e
...
...
@@ -237,8 +237,9 @@ public class CUPSPrinter {
/**
* Get CUPS default printer using IPP.
* Returns 2 values - index 0 is printer name, index 1 is the uri.
*/
public
static
String
getDefaultPrinter
()
{
static
String
[]
getDefaultPrinter
()
{
try
{
URL
url
=
new
URL
(
"http"
,
getServer
(),
getPort
(),
""
);
final
HttpURLConnection
urlConnection
=
...
...
@@ -264,8 +265,8 @@ public class CUPSPrinter {
AttributeClass
.
ATTRIBUTES_CHARSET
,
AttributeClass
.
ATTRIBUTES_NATURAL_LANGUAGE
,
new
AttributeClass
(
"requested-attributes"
,
AttributeClass
.
TAG_
KEYWORD
,
"printer-
name
"
)
AttributeClass
.
TAG_
URI
,
"printer-
uri
"
)
};
if
(
IPPPrintService
.
writeIPPRequest
(
os
,
...
...
@@ -273,6 +274,7 @@ public class CUPSPrinter {
attCl
))
{
HashMap
defaultMap
=
null
;
String
[]
printerInfo
=
new
String
[
2
];
InputStream
is
=
urlConnection
.
getInputStream
();
HashMap
[]
responseMap
=
IPPPrintService
.
readIPPResponse
(
is
);
...
...
@@ -293,21 +295,30 @@ public class CUPSPrinter {
* special behaviour for this built in.
*/
if
(
UnixPrintServiceLookup
.
isMac
())
{
return
UnixPrintServiceLookup
.
printerInfo
[
0
]
=
UnixPrintServiceLookup
.
getDefaultPrinterNameSysV
();
printerInfo
[
1
]
=
null
;
return
(
String
[])
printerInfo
.
clone
();
}
else
{
return
null
;
}
}
AttributeClass
attribClass
=
(
AttributeClass
)
defaultMap
.
get
(
"printer-name"
);
if
(
attribClass
!=
null
)
{
String
nameStr
=
attribClass
.
getStringValue
();
printerInfo
[
0
]
=
attribClass
.
getStringValue
();
attribClass
=
(
AttributeClass
)
defaultMap
.
get
(
"device-uri"
);
if
(
attribClass
!=
null
)
{
printerInfo
[
1
]
=
attribClass
.
getStringValue
();
}
else
{
printerInfo
[
1
]
=
null
;
}
os
.
close
();
urlConnection
.
disconnect
();
return
nameStr
;
return
(
String
[])
printerInfo
.
clone
()
;
}
}
os
.
close
();
...
...
@@ -322,7 +333,7 @@ public class CUPSPrinter {
/**
* Get list of all CUPS printers using IPP.
*/
public
static
String
[]
getAllPrinters
()
{
static
String
[]
getAllPrinters
()
{
try
{
URL
url
=
new
URL
(
"http"
,
getServer
(),
getPort
(),
""
);
...
...
src/solaris/classes/sun/print/IPPPrintService.java
浏览文件 @
9080ea2e
...
...
@@ -366,6 +366,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
" IPPPrintService, myURL="
+
myURL
+
" Exception= "
+
e
);
throw
new
IllegalArgumentException
(
"invalid url"
);
}
isCupsPrinter
=
isCups
;
...
...
@@ -1145,6 +1146,8 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
// REMIND: check attribute values
return
(
T
)
PDLOverrideSupported
.
NOT_ATTEMPTED
;
}
}
else
if
(
category
==
PrinterURI
.
class
)
{
return
(
T
)(
new
PrinterURI
(
myURI
));
}
else
{
return
null
;
}
...
...
src/solaris/classes/sun/print/UnixPrintServiceLookup.java
浏览文件 @
9080ea2e
...
...
@@ -48,6 +48,7 @@ import javax.print.attribute.PrintRequestAttributeSet;
import
javax.print.attribute.PrintServiceAttribute
;
import
javax.print.attribute.PrintServiceAttributeSet
;
import
javax.print.attribute.standard.PrinterName
;
import
javax.print.attribute.standard.PrinterURI
;
import
java.io.File
;
import
java.io.FileReader
;
import
java.net.URL
;
...
...
@@ -203,6 +204,33 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
}
}
private
int
addPrintServiceToList
(
ArrayList
printerList
,
PrintService
ps
)
{
int
index
=
printerList
.
indexOf
(
ps
);
// Check if PrintService with same name is already in the list.
if
(
CUPSPrinter
.
isCupsRunning
()
&&
index
!=
-
1
)
{
// Bug in Linux: Duplicate entry of a remote printer
// and treats it as local printer but it is returning wrong
// information when queried using IPP. Workaround is to remove it.
// Even CUPS ignores these entries as shown in lpstat or using
// their web configuration.
PrinterURI
uri
=
(
PrinterURI
)
ps
.
getAttribute
(
PrinterURI
.
class
);
if
(
uri
.
getURI
().
getHost
().
equals
(
"localhost"
))
{
IPPPrintService
.
debug_println
(
debugPrefix
+
"duplicate PrintService, ignoring the new local printer: "
+
ps
);
return
index
;
// Do not add this.
}
PrintService
oldPS
=
(
PrintService
)(
printerList
.
get
(
index
));
uri
=
(
PrinterURI
)
oldPS
.
getAttribute
(
PrinterURI
.
class
);
if
(
uri
.
getURI
().
getHost
().
equals
(
"localhost"
))
{
IPPPrintService
.
debug_println
(
debugPrefix
+
"duplicate PrintService, removing existing local printer: "
+
oldPS
);
printerList
.
remove
(
oldPS
);
}
else
{
return
index
;
}
}
printerList
.
add
(
ps
);
return
(
printerList
.
size
()
-
1
);
}
// refreshes "printServices"
public
synchronized
void
refreshServices
()
{
...
...
@@ -246,8 +274,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
}
if
((
defaultPrintService
!=
null
)
&&
printers
[
p
].
equals
(
getPrinterDestName
(
defaultPrintService
)))
{
printerList
.
add
(
defaultPrintService
);
defaultIndex
=
printerList
.
size
()
-
1
;
defaultIndex
=
addPrintServiceToList
(
printerList
,
defaultPrintService
);
}
else
{
if
(
printServices
==
null
)
{
IPPPrintService
.
debug_println
(
debugPrefix
+
...
...
@@ -255,9 +282,10 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
if
(
CUPSPrinter
.
isCupsRunning
())
{
try
{
printerList
.
add
(
new
IPPPrintService
(
printers
[
p
],
printerURIs
[
p
],
true
));
addPrintServiceToList
(
printerList
,
new
IPPPrintService
(
printers
[
p
],
printerURIs
[
p
],
true
));
}
catch
(
Exception
e
)
{
IPPPrintService
.
debug_println
(
debugPrefix
+
" getAllPrinters Exception "
+
...
...
@@ -282,10 +310,10 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
if
(
j
==
printServices
.
length
)
{
// not found?
if
(
CUPSPrinter
.
isCupsRunning
())
{
try
{
printerList
.
add
(
new
IPPPrintService
(
printers
[
p
],
printerURIs
[
p
],
true
));
addPrintServiceToList
(
printerList
,
new
IPPPrintService
(
printers
[
p
],
printerURIs
[
p
],
true
));
}
catch
(
Exception
e
)
{
IPPPrintService
.
debug_println
(
debugPrefix
+
" getAllPrinters Exception "
+
...
...
@@ -312,9 +340,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
//if defaultService is not found in printerList
if
(
defaultIndex
==
-
1
&&
defaultPrintService
!=
null
)
{
//add default to the list
printerList
.
add
(
defaultPrintService
);
defaultIndex
=
printerList
.
size
()
-
1
;
defaultIndex
=
addPrintServiceToList
(
printerList
,
defaultPrintService
);
}
printServices
=
(
PrintService
[])
printerList
.
toArray
(
...
...
@@ -563,11 +589,14 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
// clear defaultPrintService
defaultPrintService
=
null
;
String
psuri
=
null
;
IPPPrintService
.
debug_println
(
"isRunning ? "
+
(
CUPSPrinter
.
isCupsRunning
()));
if
(
CUPSPrinter
.
isCupsRunning
())
{
defaultPrinter
=
CUPSPrinter
.
getDefaultPrinter
();
String
[]
printerInfo
=
CUPSPrinter
.
getDefaultPrinter
();
defaultPrinter
=
printerInfo
[
0
];
psuri
=
printerInfo
[
1
];
}
else
{
if
(
isMac
()
||
isSysV
())
{
defaultPrinter
=
getDefaultPrinterNameSysV
();
...
...
@@ -590,12 +619,17 @@ public class UnixPrintServiceLookup extends PrintServiceLookup
if
(
defaultPrintService
==
null
)
{
if
(
CUPSPrinter
.
isCupsRunning
())
{
try
{
PrintService
defaultPS
=
new
IPPPrintService
(
defaultPrinter
,
PrintService
defaultPS
;
if
(
psuri
!=
null
)
{
defaultPS
=
new
IPPPrintService
(
defaultPrinter
,
psuri
,
true
);
}
else
{
defaultPS
=
new
IPPPrintService
(
defaultPrinter
,
new
URL
(
"http://"
+
CUPSPrinter
.
getServer
()+
":"
+
CUPSPrinter
.
getPort
()+
"/"
+
defaultPrinter
));
}
defaultPrintService
=
defaultPS
;
}
catch
(
Exception
e
)
{
}
...
...
test/java/awt/print/PrinterJob/PrintLatinCJKTest.java
浏览文件 @
9080ea2e
...
...
@@ -23,7 +23,7 @@
/**
* @test
* @bug 800535
* @bug 800535
8022536
* @summary JDK7 Printing: CJK and Latin Text in string overlap
* @run main/manual=yesno PrintLatinCJKTest
*/
...
...
@@ -49,6 +49,8 @@ public class PrintLatinCJKTest implements Printable, ActionListener {
private
PageFormat
pf
;
static
String
info
=
"To test 8022536, if a remote printer is the system default,"
+
"it should show in the dialog as the selected printer.\n"
+
"You need a printer for this test. If you have none, let "
+
"the test pass. If there is a printer, press Print, send "
+
"the output to the printer, and examine it. It should have "
+
...
...
test/javax/print/TextFlavorTest.java
0 → 100644
浏览文件 @
9080ea2e
/*
* Copyright (c) 2013, 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
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@test
@bug 6334074 8022536
@summary test supported text flavors reported properly
@run main TextFlavorTest
*/
import
javax.print.*
;
import
javax.print.attribute.standard.*
;
import
javax.print.attribute.*
;
import
java.io.*
;
public
class
TextFlavorTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
PrintService
service
[]
=
PrintServiceLookup
.
lookupPrintServices
(
null
,
null
);
if
(
service
.
length
==
0
)
{
System
.
out
.
println
(
"No print service found."
);
return
;
}
for
(
int
y
=
0
;
y
<
service
.
length
;
y
++)
{
DocFlavor
flavors
[]
=
service
[
y
].
getSupportedDocFlavors
();
if
(
flavors
==
null
)
continue
;
for
(
int
x
=
0
;
x
<
flavors
.
length
;
x
++)
{
if
(!
service
[
y
].
isDocFlavorSupported
(
flavors
[
x
]))
{
String
msg
=
"DocFlavor "
+
flavors
[
x
]
+
" is not supported by service "
+
service
[
y
];
throw
new
RuntimeException
(
msg
);
}
}
}
System
.
out
.
println
(
"Test passed."
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录