Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0583fba9
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看板
提交
0583fba9
编写于
11月 25, 2008
作者:
J
jgodinez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6653384: Variable "initialized" in class CUPSPrinter is static by mistake
Reviewed-by: tdv, prr
上级
766276c8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
76 addition
and
13 deletion
+76
-13
src/solaris/classes/sun/print/CUPSPrinter.java
src/solaris/classes/sun/print/CUPSPrinter.java
+5
-5
src/solaris/classes/sun/print/IPPPrintService.java
src/solaris/classes/sun/print/IPPPrintService.java
+25
-8
test/java/awt/print/PrinterJob/GetMediasTest.java
test/java/awt/print/PrinterJob/GetMediasTest.java
+46
-0
未找到文件。
src/solaris/classes/sun/print/CUPSPrinter.java
浏览文件 @
0583fba9
...
...
@@ -46,9 +46,9 @@ import javax.print.attribute.standard.PrinterName;
public
class
CUPSPrinter
{
private
static
final
String
debugPrefix
=
"CUPSPrinter>> "
;
private
static
final
double
PRINTER_DPI
=
72.0
;
private
static
boolean
initialized
;
private
boolean
initialized
;
private
static
native
String
getCupsServer
();
private
static
native
int
getCupsPort
();
private
static
native
boolean
canConnect
(
String
server
,
int
port
);
...
...
@@ -156,7 +156,7 @@ public class CUPSPrinter {
/**
* Initialize media by translating PPD info to PrintService attributes.
*/
private
void
initMedia
()
{
private
synchronized
void
initMedia
()
{
if
(
initialized
)
{
return
;
}
else
{
...
...
@@ -392,9 +392,9 @@ public class CUPSPrinter {
* Detects if CUPS is running.
*/
public
static
boolean
isCupsRunning
()
{
IPPPrintService
.
debug_println
(
"libFound "
+
libFound
);
IPPPrintService
.
debug_println
(
debugPrefix
+
"libFound "
+
libFound
);
if
(
libFound
)
{
IPPPrintService
.
debug_println
(
"CUPS server "
+
getServer
()+
IPPPrintService
.
debug_println
(
debugPrefix
+
"CUPS server "
+
getServer
()+
" port "
+
getPort
());
return
canConnect
(
getServer
(),
getPort
());
}
else
{
...
...
src/solaris/classes/sun/print/IPPPrintService.java
浏览文件 @
0583fba9
...
...
@@ -62,14 +62,23 @@ import java.util.HashSet;
public
class
IPPPrintService
implements
PrintService
,
SunPrinterJobService
{
public
static
boolean
debugPrint
=
false
;
private
static
String
debugPrefix
=
"IPPPrintService>> "
;
public
static
final
boolean
debugPrint
;
private
static
final
String
debugPrefix
=
"IPPPrintService>> "
;
protected
static
void
debug_println
(
String
str
)
{
if
(
debugPrint
)
{
System
.
out
.
println
(
str
);
}
}
private
static
final
String
FORCE_PIPE_PROP
=
"sun.print.ippdebug"
;
static
{
String
debugStr
=
(
String
)
java
.
security
.
AccessController
.
doPrivileged
(
new
sun
.
security
.
action
.
GetPropertyAction
(
FORCE_PIPE_PROP
));
debugPrint
=
"true"
.
equalsIgnoreCase
(
debugStr
);
}
private
String
printer
;
private
URI
myURI
;
...
...
@@ -383,7 +392,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
if
((
urlConnection
=
getIPPConnection
(
myURL
))
==
null
)
{
mediaSizeNames
=
new
MediaSizeName
[
0
];
mediaTrays
=
new
MediaTray
[
0
];
debug_println
(
"
NULL urlConnection "
);
debug_println
(
debugPrefix
+
"initAttributes,
NULL urlConnection "
);
init
=
true
;
return
;
}
...
...
@@ -408,7 +417,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
return
;
}
catch
(
Exception
e
)
{
IPPPrintService
.
debug_println
(
debugPrefix
+
" error creating CUPSPrinter e="
+
e
);
"
initAttributes,
error creating CUPSPrinter e="
+
e
);
}
}
...
...
@@ -912,6 +921,9 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
* Finds matching CustomMediaSizeName of given media.
*/
public
CustomMediaSizeName
findCustomMedia
(
MediaSizeName
media
)
{
if
(
customMediaSizeNames
==
null
)
{
return
null
;
}
for
(
int
i
=
0
;
i
<
customMediaSizeNames
.
length
;
i
++)
{
CustomMediaSizeName
custom
=
(
CustomMediaSizeName
)
customMediaSizeNames
[
i
];
...
...
@@ -1193,7 +1205,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
return
true
;
}
for
(
int
i
=
0
;
i
<
mediaSizeNames
.
length
;
i
++)
{
debug_println
(
"
mediaSizeNames[i] "
+
mediaSizeNames
[
i
]);
debug_println
(
debugPrefix
+
"isSupportedMedia,
mediaSizeNames[i] "
+
mediaSizeNames
[
i
]);
if
(
msn
.
equals
(
mediaSizeNames
[
i
]))
{
return
true
;
}
...
...
@@ -1654,9 +1666,10 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
try
{
osw
=
new
OutputStreamWriter
(
os
,
"UTF-8"
);
}
catch
(
java
.
io
.
UnsupportedEncodingException
exc
)
{
debug_println
(
"
UTF-8 not supported? Exception: "
+
exc
);
debug_println
(
debugPrefix
+
"writeIPPRequest,
UTF-8 not supported? Exception: "
+
exc
);
return
false
;
}
debug_println
(
debugPrefix
+
"writeIPPRequest, op code= "
+
operCode
);
char
[]
opCode
=
new
char
[
2
];
opCode
[
0
]
=
(
char
)
Byte
.
parseByte
(
operCode
.
substring
(
0
,
2
),
16
);
opCode
[
1
]
=
(
char
)
Byte
.
parseByte
(
operCode
.
substring
(
2
,
4
),
16
);
...
...
@@ -1697,7 +1710,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
osw
.
flush
();
osw
.
close
();
}
catch
(
java
.
io
.
IOException
ioe
)
{
debug_println
(
debugPrefix
+
"IPPPrintService Exception in writeIPPRequest: "
+
ioe
);
debug_println
(
debugPrefix
+
"
writeIPPRequest,
IPPPrintService Exception in writeIPPRequest: "
+
ioe
);
return
false
;
}
return
true
;
...
...
@@ -1734,7 +1747,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
while
((
response
[
0
]
>=
GRPTAG_OP_ATTRIBUTES
)
&&
(
response
[
0
]
<=
GRPTAG_PRINTER_ATTRIBUTES
)
&&
(
response
[
0
]
!=
GRPTAG_END_ATTRIBUTES
))
{
debug_println
(
debugPrefix
+
"checking group tag, response[0]= "
+
debug_println
(
debugPrefix
+
"
readIPPResponse,
checking group tag, response[0]= "
+
response
[
0
]);
outObj
=
new
ByteArrayOutputStream
();
...
...
@@ -1773,6 +1786,7 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
outArray
);
responseMap
.
put
(
ac
.
getName
(),
ac
);
debug_println
(
debugPrefix
+
"readIPPResponse "
+
ac
);
}
outObj
=
new
ByteArrayOutputStream
();
...
...
@@ -1845,6 +1859,9 @@ public class IPPPrintService implements PrintService, SunPrinterJobService {
}
catch
(
java
.
io
.
IOException
e
)
{
debug_println
(
debugPrefix
+
"readIPPResponse: "
+
e
);
if
(
debugPrint
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
...
...
test/java/awt/print/PrinterJob/GetMediasTest.java
0 → 100644
浏览文件 @
0583fba9
/*
* Copyright 2008 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 6653384
* @summary No exception should be thrown.
* @run main GetMediasTest
*/
import
javax.print.PrintService
;
import
javax.print.PrintServiceLookup
;
import
javax.print.attribute.standard.Media
;
public
class
GetMediasTest
{
public
static
void
main
(
String
[]
args
)
{
PrintService
[]
services
=
PrintServiceLookup
.
lookupPrintServices
(
null
,
null
);
for
(
final
PrintService
service:
services
)
{
Thread
thread
=
new
Thread
()
{
public
void
run
()
{
service
.
getSupportedAttributeValues
(
Media
.
class
,
null
,
null
);
}
};
thread
.
start
();
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录