Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ea3cbca9
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看板
提交
ea3cbca9
编写于
6月 03, 2014
作者:
A
amurillo
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
aabce631
12c16df9
变更
45
隐藏空白更改
内联
并排
Showing
45 changed file
with
1398 addition
and
169 deletion
+1398
-169
src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java
src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java
+4
-0
src/macosx/classes/sun/lwawt/LWChoicePeer.java
src/macosx/classes/sun/lwawt/LWChoicePeer.java
+3
-1
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
+2
-1
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
+5
-2
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
+1
-1
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+2
-0
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
+8
-2
src/macosx/native/sun/awt/AWTView.m
src/macosx/native/sun/awt/AWTView.m
+6
-3
src/macosx/native/sun/awt/AWTWindow.m
src/macosx/native/sun/awt/AWTWindow.m
+5
-1
src/share/classes/com/sun/jndi/ldap/Connection.java
src/share/classes/com/sun/jndi/ldap/Connection.java
+3
-3
src/share/classes/java/lang/invoke/LambdaForm.java
src/share/classes/java/lang/invoke/LambdaForm.java
+1
-1
src/share/classes/java/lang/invoke/MethodHandleImpl.java
src/share/classes/java/lang/invoke/MethodHandleImpl.java
+1
-2
src/share/classes/java/lang/invoke/MethodTypeForm.java
src/share/classes/java/lang/invoke/MethodTypeForm.java
+4
-2
src/share/classes/java/time/temporal/IsoFields.java
src/share/classes/java/time/temporal/IsoFields.java
+16
-6
src/share/classes/java/time/temporal/WeekFields.java
src/share/classes/java/time/temporal/WeekFields.java
+2
-1
src/share/classes/javax/swing/JComboBox.java
src/share/classes/javax/swing/JComboBox.java
+9
-7
src/share/classes/javax/swing/JComponent.java
src/share/classes/javax/swing/JComponent.java
+2
-7
src/share/classes/javax/swing/PopupFactory.java
src/share/classes/javax/swing/PopupFactory.java
+24
-2
src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
...are/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
+2
-3
src/share/classes/sun/awt/image/FileImageSource.java
src/share/classes/sun/awt/image/FileImageSource.java
+4
-0
src/share/classes/sun/security/smartcardio/CardImpl.java
src/share/classes/sun/security/smartcardio/CardImpl.java
+1
-1
src/share/native/sun/security/smartcardio/pcsc.c
src/share/native/sun/security/smartcardio/pcsc.c
+152
-43
src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
+5
-10
src/solaris/classes/sun/awt/X11/XFramePeer.java
src/solaris/classes/sun/awt/X11/XFramePeer.java
+5
-0
src/solaris/classes/sun/awt/X11/XNETProtocol.java
src/solaris/classes/sun/awt/X11/XNETProtocol.java
+28
-1
src/solaris/native/java/net/NetworkInterface.c
src/solaris/native/java/net/NetworkInterface.c
+40
-12
src/solaris/native/sun/awt/gtk2_interface.c
src/solaris/native/sun/awt/gtk2_interface.c
+0
-2
src/solaris/native/sun/nio/ch/FileChannelImpl.c
src/solaris/native/sun/nio/ch/FileChannelImpl.c
+43
-2
src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h
...solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h
+19
-0
src/solaris/native/sun/security/smartcardio/pcsc_md.c
src/solaris/native/sun/security/smartcardio/pcsc_md.c
+36
-1
src/solaris/native/sun/xawt/XlibWrapper.c
src/solaris/native/sun/xawt/XlibWrapper.c
+1
-3
src/windows/native/java/io/io_util_md.c
src/windows/native/java/io/io_util_md.c
+20
-2
src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
...indows/native/java/net/DualStackPlainDatagramSocketImpl.c
+10
-6
src/windows/native/java/net/NetworkInterface.c
src/windows/native/java/net/NetworkInterface.c
+21
-16
src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
+17
-10
src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
+8
-6
test/com/sun/jndi/ldap/LdapTimeoutTest.java
test/com/sun/jndi/ldap/LdapTimeoutTest.java
+36
-9
test/java/awt/Choice/RemoveAllShrinkTest/RemoveAllShrinkTest.java
...a/awt/Choice/RemoveAllShrinkTest/RemoveAllShrinkTest.java
+85
-0
test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java
test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java
+99
-0
test/java/awt/image/ImageIconHang.java
test/java/awt/image/ImageIconHang.java
+48
-0
test/java/time/test/java/time/temporal/TestIsoWeekFields.java
.../java/time/test/java/time/temporal/TestIsoWeekFields.java
+280
-0
test/javax/swing/JComboBox/8019180/Test8019180.java
test/javax/swing/JComboBox/8019180/Test8019180.java
+68
-0
test/javax/swing/JTabbedPane/8007563/Test8007563.java
test/javax/swing/JTabbedPane/8007563/Test8007563.java
+124
-0
test/javax/xml/ws/8043129/MailTest.java
test/javax/xml/ws/8043129/MailTest.java
+148
-0
test/javax/xml/ws/8043129/javax.mail.jar
test/javax/xml/ws/8043129/javax.mail.jar
+0
-0
未找到文件。
src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java
浏览文件 @
ea3cbca9
...
...
@@ -120,6 +120,10 @@ class AquaComboBoxPopup extends BasicComboPopup {
public
void
show
()
{
final
int
startItemCount
=
comboBox
.
getItemCount
();
if
(
startItemCount
==
0
)
{
return
;
}
final
Rectangle
popupBounds
=
adjustPopupAndGetBounds
();
if
(
popupBounds
==
null
)
return
;
// null means don't show
...
...
src/macosx/classes/sun/lwawt/LWChoicePeer.java
浏览文件 @
ea3cbca9
...
...
@@ -171,7 +171,9 @@ final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
SwingUtilities
.
invokeLater
(()
->
{
JPopupMenu
popupMenu
=
getPopupMenu
();
// Need to override the invoker for proper grab handling
if
(
popupMenu
!=
null
&&
popupMenu
.
getInvoker
()
!=
getTarget
())
{
if
(
popupMenu
!=
null
&&
popupMenu
.
isShowing
()
&&
popupMenu
.
getInvoker
()
!=
getTarget
())
{
// The popup is now visible with correct location
// Save it and restore after toggling visibility and changing invoker
Point
loc
=
popupMenu
.
getLocationOnScreen
();
...
...
src/macosx/classes/sun/lwawt/macosx/CEmbeddedFrame.java
浏览文件 @
ea3cbca9
...
...
@@ -96,7 +96,8 @@ public class CEmbeddedFrame extends EmbeddedFrame {
public
void
handleKeyEvent
(
int
eventType
,
int
modifierFlags
,
String
characters
,
String
charsIgnoringMods
,
boolean
isRepeat
,
short
keyCode
,
boolean
needsKeyTyped
)
{
responder
.
handleKeyEvent
(
eventType
,
modifierFlags
,
charsIgnoringMods
,
keyCode
,
needsKeyTyped
,
isRepeat
);
responder
.
handleKeyEvent
(
eventType
,
modifierFlags
,
characters
,
charsIgnoringMods
,
keyCode
,
needsKeyTyped
,
isRepeat
);
}
public
void
handleInputEvent
(
String
text
)
{
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformResponder.java
浏览文件 @
ea3cbca9
...
...
@@ -125,7 +125,7 @@ final class CPlatformResponder {
/**
* Handles key events.
*/
void
handleKeyEvent
(
int
eventType
,
int
modifierFlags
,
String
chars
,
void
handleKeyEvent
(
int
eventType
,
int
modifierFlags
,
String
chars
,
String
charsIgnoringModifiers
,
short
keyCode
,
boolean
needsKeyTyped
,
boolean
needsKeyReleased
)
{
boolean
isFlagsChangedEvent
=
isNpapiCallback
?
(
eventType
==
CocoaConstants
.
NPCocoaEventFlagsChanged
)
:
...
...
@@ -153,7 +153,10 @@ final class CPlatformResponder {
testChar
=
chars
.
charAt
(
0
);
}
int
[]
in
=
new
int
[]
{
testChar
,
isDeadChar
?
1
:
0
,
modifierFlags
,
keyCode
};
char
testCharIgnoringModifiers
=
charsIgnoringModifiers
!=
null
&&
charsIgnoringModifiers
.
length
()
>
0
?
charsIgnoringModifiers
.
charAt
(
0
)
:
KeyEvent
.
CHAR_UNDEFINED
;
int
[]
in
=
new
int
[]
{
testCharIgnoringModifiers
,
isDeadChar
?
1
:
0
,
modifierFlags
,
keyCode
};
int
[]
out
=
new
int
[
3
];
// [jkeyCode, jkeyLocation, deadChar]
postsTyped
=
NSEvent
.
nsToJavaKeyInfo
(
in
,
out
);
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
浏览文件 @
ea3cbca9
...
...
@@ -200,7 +200,7 @@ public class CPlatformView extends CFRetainedResource {
}
private
void
deliverKeyEvent
(
NSEvent
event
)
{
responder
.
handleKeyEvent
(
event
.
getType
(),
event
.
getModifierFlags
(),
responder
.
handleKeyEvent
(
event
.
getType
(),
event
.
getModifierFlags
(),
event
.
getCharacters
(),
event
.
getCharactersIgnoringModifiers
(),
event
.
getKeyCode
(),
true
,
false
);
}
...
...
src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
浏览文件 @
ea3cbca9
...
...
@@ -119,6 +119,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
static
final
int
NONACTIVATING
=
1
<<
24
;
static
final
int
IS_DIALOG
=
1
<<
25
;
static
final
int
IS_MODAL
=
1
<<
26
;
static
final
int
IS_POPUP
=
1
<<
27
;
static
final
int
_STYLE_PROP_BITMASK
=
DECORATED
|
TEXTURED
|
UNIFIED
|
UTILITY
|
HUD
|
SHEET
|
CLOSEABLE
|
MINIMIZABLE
|
RESIZABLE
;
...
...
@@ -318,6 +319,7 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
styleBits
=
SET
(
styleBits
,
TEXTURED
,
false
);
// Popups in applets don't activate applet's process
styleBits
=
SET
(
styleBits
,
NONACTIVATING
,
true
);
styleBits
=
SET
(
styleBits
,
IS_POPUP
,
true
);
}
if
(
Window
.
Type
.
UTILITY
.
equals
(
target
.
getType
()))
{
...
...
src/macosx/classes/sun/lwawt/macosx/NSEvent.java
浏览文件 @
ea3cbca9
...
...
@@ -47,13 +47,15 @@ final class NSEvent {
// Key event information
private
short
keyCode
;
private
String
characters
;
private
String
charactersIgnoringModifiers
;
// Called from native
NSEvent
(
int
type
,
int
modifierFlags
,
short
keyCode
,
String
charactersIgnoringModifiers
)
{
NSEvent
(
int
type
,
int
modifierFlags
,
short
keyCode
,
String
characters
,
String
characters
IgnoringModifiers
)
{
this
.
type
=
type
;
this
.
modifierFlags
=
modifierFlags
;
this
.
keyCode
=
keyCode
;
this
.
characters
=
characters
;
this
.
charactersIgnoringModifiers
=
charactersIgnoringModifiers
;
}
...
...
@@ -121,12 +123,16 @@ final class NSEvent {
return
charactersIgnoringModifiers
;
}
String
getCharacters
()
{
return
characters
;
}
@Override
public
String
toString
()
{
return
"NSEvent["
+
getType
()
+
" ,"
+
getModifierFlags
()
+
" ,"
+
getClickCount
()
+
" ,"
+
getButtonNumber
()
+
" ,"
+
getX
()
+
" ,"
+
getY
()
+
" ,"
+
getAbsX
()
+
" ,"
+
getAbsY
()+
" ,"
+
getKeyCode
()
+
" ,"
+
getCharactersIgnoringModifiers
()
+
"]"
;
+
getCharacters
()
+
" ,"
+
getCharacters
IgnoringModifiers
()
+
"]"
;
}
/*
...
...
src/macosx/native/sun/awt/AWTView.m
浏览文件 @
ea3cbca9
...
...
@@ -367,7 +367,7 @@ AWT_ASSERT_APPKIT_THREAD;
// TODO: need consitent way for doing that both with global as well as with local coordinates.
// The reason to do it here is one more native method for getting screen dimension otherwise.
NSRect
screenRect
=
[[
NSScreen
mainScreen
]
frame
];
NSRect
screenRect
=
[[
[
NSScreen
screens
]
objectAtIndex
:
0
]
frame
];
absP
.
y
=
screenRect
.
size
.
height
-
absP
.
y
;
jint
clickCount
;
...
...
@@ -441,17 +441,20 @@ AWT_ASSERT_APPKIT_THREAD;
JNIEnv
*
env
=
[
ThreadUtilities
getJNIEnv
];
jstring
characters
=
NULL
;
jstring
charactersIgnoringModifiers
=
NULL
;
if
([
event
type
]
!=
NSFlagsChanged
)
{
characters
=
JNFNSToJavaString
(
env
,
[
event
characters
]);
charactersIgnoringModifiers
=
JNFNSToJavaString
(
env
,
[
event
charactersIgnoringModifiers
]);
}
static
JNF_CLASS_CACHE
(
jc_NSEvent
,
"sun/lwawt/macosx/NSEvent"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IISLjava/lang/String;)V"
);
static
JNF_CTOR_CACHE
(
jctor_NSEvent
,
jc_NSEvent
,
"(IISLjava/lang/String;
Ljava/lang/String;
)V"
);
jobject
jevent
=
JNFNewObject
(
env
,
jctor_NSEvent
,
[
event
type
],
[
event
modifierFlags
],
[
event
keyCode
],
characters
);
characters
,
charactersIgnoringModifiers
);
static
JNF_CLASS_CACHE
(
jc_PlatformView
,
"sun/lwawt/macosx/CPlatformView"
);
static
JNF_MEMBER_CACHE
(
jm_deliverKeyEvent
,
jc_PlatformView
,
...
...
src/macosx/native/sun/awt/AWTWindow.m
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2011, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
...
...
@@ -252,6 +252,10 @@ AWT_ASSERT_APPKIT_THREAD;
self
.
ownerWindow
=
owner
;
[
self
setPropertiesForStyleBits
:
styleBits
mask
:
MASK
(
_METHOD_PROP_BITMASK
)];
if
(
IS
(
self
.
styleBits
,
IS_POPUP
))
{
[
self
.
nsWindow
setCollectionBehavior
:(
1
<<
8
)
/*NSWindowCollectionBehaviorFullScreenAuxiliary*/
];
}
return
self
;
}
...
...
src/share/classes/com/sun/jndi/ldap/Connection.java
浏览文件 @
ea3cbca9
/*
* 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
...
...
@@ -459,10 +459,10 @@ public final class Connection implements Runnable {
// will be woken up before readTimeout only if reply is
// available
ldr
.
wait
(
readTimeout
);
waited
=
true
;
}
else
{
ldr
.
wait
(
15
*
1000
);
// 15 second timeout
}
waited
=
true
;
}
else
{
break
;
}
...
...
@@ -474,7 +474,7 @@ public final class Connection implements Runnable {
}
if
((
rber
==
null
)
&&
waited
)
{
removeRequest
(
ldr
);
abandonRequest
(
ldr
,
null
);
throw
new
NamingException
(
"LDAP response read timed out, timeout used:"
+
readTimeout
+
"ms."
);
...
...
src/share/classes/java/lang/invoke/LambdaForm.java
浏览文件 @
ea3cbca9
...
...
@@ -482,7 +482,7 @@ class LambdaForm {
assert
(
m
.
getName
().
equals
(
"interpret"
+
sig
.
substring
(
sig
.
indexOf
(
'_'
))));
LambdaForm
form
=
new
LambdaForm
(
sig
);
form
.
vmentry
=
m
;
mt
.
form
().
setCachedLambdaForm
(
MethodTypeForm
.
LF_COUNTER
,
form
);
form
=
mt
.
form
().
setCachedLambdaForm
(
MethodTypeForm
.
LF_COUNTER
,
form
);
// FIXME: get rid of PREPARED_FORMS; use MethodTypeForm cache only
forms
.
put
(
sig
,
form
);
}
...
...
src/share/classes/java/lang/invoke/MethodHandleImpl.java
浏览文件 @
ea3cbca9
...
...
@@ -692,8 +692,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
lform
=
new
LambdaForm
(
"guardWithCatch"
,
lambdaType
.
parameterCount
(),
names
);
basicType
.
form
().
setCachedLambdaForm
(
MethodTypeForm
.
LF_GWC
,
lform
);
return
lform
;
return
basicType
.
form
().
setCachedLambdaForm
(
MethodTypeForm
.
LF_GWC
,
lform
);
}
static
...
...
src/share/classes/java/lang/invoke/MethodTypeForm.java
浏览文件 @
ea3cbca9
...
...
@@ -91,8 +91,10 @@ final class MethodTypeForm {
return
lambdaForms
[
which
];
}
public
LambdaForm
setCachedLambdaForm
(
int
which
,
LambdaForm
form
)
{
// Should we perform some sort of CAS, to avoid racy duplication?
synchronized
public
LambdaForm
setCachedLambdaForm
(
int
which
,
LambdaForm
form
)
{
// Simulate a CAS, to avoid racy duplication of results.
LambdaForm
prev
=
lambdaForms
[
which
];
if
(
prev
!=
null
)
return
prev
;
return
lambdaForms
[
which
]
=
form
;
}
...
...
src/share/classes/java/time/temporal/IsoFields.java
浏览文件 @
ea3cbca9
...
...
@@ -535,11 +535,17 @@ public final class IsoFields {
if
(
isSupportedBy
(
temporal
)
==
false
)
{
throw
new
UnsupportedTemporalTypeException
(
"Unsupported field: WeekBasedYear"
);
}
int
new
Val
=
range
().
checkValidIntValue
(
newValue
,
WEEK_BASED_YEAR
);
// strict check
int
new
Wby
=
range
().
checkValidIntValue
(
newValue
,
WEEK_BASED_YEAR
);
// strict check
LocalDate
date
=
LocalDate
.
from
(
temporal
);
int
dow
=
date
.
get
(
DAY_OF_WEEK
);
int
week
=
getWeek
(
date
);
date
=
date
.
withDayOfYear
(
180
).
withYear
(
newVal
).
with
(
WEEK_OF_WEEK_BASED_YEAR
,
week
);
return
(
R
)
date
.
with
(
date
);
if
(
week
==
53
&&
getWeekRange
(
newWby
)
==
52
)
{
week
=
52
;
}
LocalDate
resolved
=
LocalDate
.
of
(
newWby
,
1
,
4
);
// 4th is guaranteed to be in week one
int
days
=
(
dow
-
resolved
.
get
(
DAY_OF_WEEK
))
+
((
week
-
1
)
*
7
);
resolved
=
resolved
.
plusDays
(
days
);
return
(
R
)
temporal
.
with
(
resolved
);
}
@Override
public
String
toString
()
{
...
...
@@ -577,12 +583,16 @@ public final class IsoFields {
private
static
ValueRange
getWeekRange
(
LocalDate
date
)
{
int
wby
=
getWeekBasedYear
(
date
);
date
=
date
.
withDayOfYear
(
1
).
withYear
(
wby
);
return
ValueRange
.
of
(
1
,
getWeekRange
(
wby
));
}
private
static
int
getWeekRange
(
int
wby
)
{
LocalDate
date
=
LocalDate
.
of
(
wby
,
1
,
1
);
// 53 weeks if standard year starts on Thursday, or Wed in a leap year
if
(
date
.
getDayOfWeek
()
==
THURSDAY
||
(
date
.
getDayOfWeek
()
==
WEDNESDAY
&&
date
.
isLeapYear
()))
{
return
ValueRange
.
of
(
1
,
53
)
;
return
53
;
}
return
ValueRange
.
of
(
1
,
52
)
;
return
52
;
}
private
static
int
getWeek
(
LocalDate
date
)
{
...
...
src/share/classes/java/time/temporal/WeekFields.java
浏览文件 @
ea3cbca9
...
...
@@ -700,7 +700,7 @@ public final class WeekFields implements Serializable {
* @see WeekFields#weekOfWeekBasedYear()
*/
static
ComputedDayOfField
ofWeekOfWeekBasedYearField
(
WeekFields
weekDef
)
{
return
new
ComputedDayOfField
(
"WeekOfWeekBasedYear"
,
weekDef
,
WEEKS
,
IsoFields
.
WEEK_BASED_YEARS
,
WEEK_OF_YEAR_RANGE
);
return
new
ComputedDayOfField
(
"WeekOfWeekBasedYear"
,
weekDef
,
WEEKS
,
IsoFields
.
WEEK_BASED_YEARS
,
WEEK_OF_
WEEK_BASED_
YEAR_RANGE
);
}
/**
...
...
@@ -753,6 +753,7 @@ public final class WeekFields implements Serializable {
private
static
final
ValueRange
DAY_OF_WEEK_RANGE
=
ValueRange
.
of
(
1
,
7
);
private
static
final
ValueRange
WEEK_OF_MONTH_RANGE
=
ValueRange
.
of
(
0
,
1
,
4
,
6
);
private
static
final
ValueRange
WEEK_OF_YEAR_RANGE
=
ValueRange
.
of
(
0
,
1
,
52
,
54
);
private
static
final
ValueRange
WEEK_OF_WEEK_BASED_YEAR_RANGE
=
ValueRange
.
of
(
1
,
52
,
53
);
@Override
public
long
getFrom
(
TemporalAccessor
temporal
)
{
...
...
src/share/classes/javax/swing/JComboBox.java
浏览文件 @
ea3cbca9
...
...
@@ -1307,13 +1307,15 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
* do not call or override.
*/
public
void
actionPerformed
(
ActionEvent
e
)
{
Object
newItem
=
getEditor
().
getItem
();
setPopupVisible
(
false
);
getModel
().
setSelectedItem
(
newItem
);
String
oldCommand
=
getActionCommand
();
setActionCommand
(
"comboBoxEdited"
);
fireActionEvent
();
setActionCommand
(
oldCommand
);
ComboBoxEditor
editor
=
getEditor
();
if
((
editor
!=
null
)
&&
(
e
!=
null
)
&&
(
editor
==
e
.
getSource
()))
{
setPopupVisible
(
false
);
getModel
().
setSelectedItem
(
editor
.
getItem
());
String
oldCommand
=
getActionCommand
();
setActionCommand
(
"comboBoxEdited"
);
fireActionEvent
();
setActionCommand
(
oldCommand
);
}
}
/**
...
...
src/share/classes/javax/swing/JComponent.java
浏览文件 @
ea3cbca9
...
...
@@ -3676,8 +3676,8 @@ public abstract class JComponent extends Container implements Serializable,
private
volatile
transient
int
propertyListenersCount
=
0
;
/**
* This field duplicates the
one in java.awt.Component.AccessibleAWTComponent,
* so it has been deprecated.
* This field duplicates the
function of the accessibleAWTFocusHandler field
*
in java.awt.Component.AccessibleAWTComponent,
so it has been deprecated.
*/
@Deprecated
protected
FocusListener
accessibleFocusHandler
=
null
;
...
...
@@ -3735,14 +3735,10 @@ public abstract class JComponent extends Container implements Serializable,
* @param listener the PropertyChangeListener to be added
*/
public
void
addPropertyChangeListener
(
PropertyChangeListener
listener
)
{
if
(
accessibleFocusHandler
==
null
)
{
accessibleFocusHandler
=
new
AccessibleFocusHandler
();
}
if
(
accessibleContainerHandler
==
null
)
{
accessibleContainerHandler
=
new
AccessibleContainerHandler
();
}
if
(
propertyListenersCount
++
==
0
)
{
JComponent
.
this
.
addFocusListener
(
accessibleFocusHandler
);
JComponent
.
this
.
addContainerListener
(
accessibleContainerHandler
);
}
super
.
addPropertyChangeListener
(
listener
);
...
...
@@ -3757,7 +3753,6 @@ public abstract class JComponent extends Container implements Serializable,
*/
public
void
removePropertyChangeListener
(
PropertyChangeListener
listener
)
{
if
(--
propertyListenersCount
==
0
)
{
JComponent
.
this
.
removeFocusListener
(
accessibleFocusHandler
);
JComponent
.
this
.
removeContainerListener
(
accessibleContainerHandler
);
}
super
.
removePropertyChangeListener
(
listener
);
...
...
src/share/classes/javax/swing/PopupFactory.java
浏览文件 @
ea3cbca9
...
...
@@ -25,10 +25,14 @@
package
javax.swing
;
import
sun.awt.EmbeddedFrame
;
import
sun.awt.OSInfo
;
import
java.applet.Applet
;
import
java.awt.*
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
java.security.AccessController
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
...
...
@@ -226,7 +230,12 @@ public class PopupFactory {
case
MEDIUM_WEIGHT_POPUP:
return
getMediumWeightPopup
(
owner
,
contents
,
ownerX
,
ownerY
);
case
HEAVY_WEIGHT_POPUP:
return
getHeavyWeightPopup
(
owner
,
contents
,
ownerX
,
ownerY
);
Popup
popup
=
getHeavyWeightPopup
(
owner
,
contents
,
ownerX
,
ownerY
);
if
((
AccessController
.
doPrivileged
(
OSInfo
.
getOSTypeAction
())
==
OSInfo
.
OSType
.
MACOSX
)
&&
(
EmbeddedFrame
.
getAppletIfAncestorOf
(
owner
)
!=
null
))
{
((
HeavyWeightPopup
)
popup
).
setCacheEnabled
(
false
);
}
return
popup
;
}
return
null
;
}
...
...
@@ -294,6 +303,8 @@ public class PopupFactory {
private
static
final
Object
heavyWeightPopupCacheKey
=
new
StringBuffer
(
"PopupFactory.heavyWeightPopupCache"
);
private
volatile
boolean
isCacheEnabled
=
true
;
/**
* Returns either a new or recycled <code>Popup</code> containing
* the specified children.
...
...
@@ -448,12 +459,23 @@ public class PopupFactory {
}
}
/**
* Enables or disables cache for current object.
*/
void
setCacheEnabled
(
boolean
enable
)
{
isCacheEnabled
=
enable
;
}
//
// Popup methods
//
public
void
hide
()
{
super
.
hide
();
recycleHeavyWeightPopup
(
this
);
if
(
isCacheEnabled
)
{
recycleHeavyWeightPopup
(
this
);
}
else
{
this
.
_dispose
();
}
}
/**
...
...
src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java
浏览文件 @
ea3cbca9
...
...
@@ -806,9 +806,8 @@ public class MetalTabbedPaneUI extends BasicTabbedPaneUI {
// Paint the background for the tab area
if
(
tabPane
.
isOpaque
()
)
{
Color
bg
=
UIManager
.
getColor
(
"TabbedPane.tabAreaBackground"
);
if
(
bg
!=
null
)
{
g
.
setColor
(
bg
);
if
(!
c
.
isBackgroundSet
()
&&
(
tabAreaBackground
!=
null
))
{
g
.
setColor
(
tabAreaBackground
);
}
else
{
g
.
setColor
(
c
.
getBackground
()
);
...
...
src/share/classes/sun/awt/image/FileImageSource.java
浏览文件 @
ea3cbca9
...
...
@@ -48,6 +48,10 @@ public class FileImageSource extends InputStreamImageSource {
}
protected
ImageDecoder
getDecoder
()
{
if
(
imagefile
==
null
)
{
return
null
;
}
InputStream
is
;
try
{
is
=
new
BufferedInputStream
(
new
FileInputStream
(
imagefile
));
...
...
src/share/classes/sun/security/smartcardio/CardImpl.java
浏览文件 @
ea3cbca9
...
...
@@ -246,7 +246,7 @@ final class CardImpl extends Card {
}
checkExclusive
();
try
{
SCardDisconnect
(
cardId
,
(
reset
?
SCARD_
LEAVE_CARD
:
SCARD_RESET
_CARD
));
SCardDisconnect
(
cardId
,
(
reset
?
SCARD_
RESET_CARD
:
SCARD_LEAVE
_CARD
));
}
catch
(
PCSCException
e
)
{
throw
new
CardException
(
"disconnect() failed"
,
e
);
}
finally
{
...
...
src/share/native/sun/security/smartcardio/pcsc.c
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2005, 20
06
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 20
14
, 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
...
...
@@ -64,17 +64,32 @@
#define J2PCSC_EXCEPTION_NAME "sun/security/smartcardio/PCSCException"
void
throwOutOfMemoryError
(
JNIEnv
*
env
,
const
char
*
msg
)
{
jclass
cls
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/OutOfMemoryError"
);
if
(
cls
!=
NULL
)
/* Otherwise an exception has already been thrown */
(
*
env
)
->
ThrowNew
(
env
,
cls
,
msg
);
}
void
throwPCSCException
(
JNIEnv
*
env
,
LONG
code
)
{
jclass
pcscClass
;
jmethodID
constructor
;
jthrowable
pcscException
;
pcscClass
=
(
*
env
)
->
FindClass
(
env
,
J2PCSC_EXCEPTION_NAME
);
assert
(
pcscClass
!=
NULL
);
if
(
pcscClass
==
NULL
)
{
return
;
}
constructor
=
(
*
env
)
->
GetMethodID
(
env
,
pcscClass
,
"<init>"
,
"(I)V"
);
assert
(
constructor
!=
NULL
);
pcscException
=
(
jthrowable
)
(
*
env
)
->
NewObject
(
env
,
pcscClass
,
constructor
,
(
jint
)
code
);
(
*
env
)
->
Throw
(
env
,
pcscException
);
if
(
constructor
==
NULL
)
{
return
;
}
pcscException
=
(
jthrowable
)
(
*
env
)
->
NewObject
(
env
,
pcscClass
,
constructor
,
(
jint
)
code
);
if
(
pcscException
!=
NULL
)
{
(
*
env
)
->
Throw
(
env
,
pcscException
);
}
}
jboolean
handleRV
(
JNIEnv
*
env
,
LONG
code
)
{
...
...
@@ -93,7 +108,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
JNIEXPORT
jlong
JNICALL
Java_sun_security_smartcardio_PCSC_SCardEstablishContext
(
JNIEnv
*
env
,
jclass
thisClass
,
jint
dwScope
)
{
SCARDCONTEXT
context
;
SCARDCONTEXT
context
=
0
;
LONG
rv
;
dprintf
(
"-establishContext
\n
"
);
rv
=
CALL_SCardEstablishContext
(
dwScope
,
NULL
,
NULL
,
&
context
);
...
...
@@ -110,7 +125,7 @@ JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardEstablishContext
jobjectArray
pcsc_multi2jstring
(
JNIEnv
*
env
,
char
*
spec
)
{
jobjectArray
result
;
jclass
stringClass
;
char
*
cp
,
**
tab
;
char
*
cp
,
**
tab
=
NULL
;
jstring
js
;
int
cnt
=
0
;
...
...
@@ -121,6 +136,10 @@ jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec) {
}
tab
=
(
char
**
)
malloc
(
cnt
*
sizeof
(
char
*
));
if
(
tab
==
NULL
)
{
throwOutOfMemoryError
(
env
,
NULL
);
return
NULL
;
}
cnt
=
0
;
cp
=
spec
;
...
...
@@ -130,12 +149,26 @@ jobjectArray pcsc_multi2jstring(JNIEnv *env, char *spec) {
}
stringClass
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/String"
);
assert
(
stringClass
!=
NULL
);
if
(
stringClass
==
NULL
)
{
free
(
tab
);
return
NULL
;
}
result
=
(
*
env
)
->
NewObjectArray
(
env
,
cnt
,
stringClass
,
NULL
);
while
(
cnt
--
>
0
)
{
js
=
(
*
env
)
->
NewStringUTF
(
env
,
tab
[
cnt
]);
(
*
env
)
->
SetObjectArrayElement
(
env
,
result
,
cnt
,
js
);
if
(
result
!=
NULL
)
{
while
(
cnt
--
>
0
)
{
js
=
(
*
env
)
->
NewStringUTF
(
env
,
tab
[
cnt
]);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
free
(
tab
);
return
NULL
;
}
(
*
env
)
->
SetObjectArrayElement
(
env
,
result
,
cnt
,
js
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
free
(
tab
);
return
NULL
;
}
(
*
env
)
->
DeleteLocalRef
(
env
,
js
);
}
}
free
(
tab
);
return
result
;
...
...
@@ -146,8 +179,8 @@ JNIEXPORT jobjectArray JNICALL Java_sun_security_smartcardio_PCSC_SCardListReade
{
SCARDCONTEXT
context
=
(
SCARDCONTEXT
)
jContext
;
LONG
rv
;
LPTSTR
mszReaders
;
DWORD
size
;
LPTSTR
mszReaders
=
NULL
;
DWORD
size
=
0
;
jobjectArray
result
;
dprintf1
(
"-context: %x
\n
"
,
context
);
...
...
@@ -157,13 +190,20 @@ JNIEXPORT jobjectArray JNICALL Java_sun_security_smartcardio_PCSC_SCardListReade
}
dprintf1
(
"-size: %d
\n
"
,
size
);
mszReaders
=
malloc
(
size
);
rv
=
CALL_SCardListReaders
(
context
,
NULL
,
mszReaders
,
&
size
);
if
(
handleRV
(
env
,
rv
))
{
free
(
mszReaders
);
return
NULL
;
if
(
size
)
{
mszReaders
=
malloc
(
size
);
if
(
mszReaders
==
NULL
)
{
throwOutOfMemoryError
(
env
,
NULL
);
return
NULL
;
}
rv
=
CALL_SCardListReaders
(
context
,
NULL
,
mszReaders
,
&
size
);
if
(
handleRV
(
env
,
rv
))
{
free
(
mszReaders
);
return
NULL
;
}
dprintf1
(
"-String: %s
\n
"
,
mszReaders
);
}
dprintf1
(
"-String: %s
\n
"
,
mszReaders
);
result
=
pcsc_multi2jstring
(
env
,
mszReaders
);
free
(
mszReaders
);
...
...
@@ -177,10 +217,13 @@ JNIEXPORT jlong JNICALL Java_sun_security_smartcardio_PCSC_SCardConnect
SCARDCONTEXT
context
=
(
SCARDCONTEXT
)
jContext
;
LONG
rv
;
LPCTSTR
readerName
;
SCARDHANDLE
card
;
DWORD
proto
;
SCARDHANDLE
card
=
0
;
DWORD
proto
=
0
;
readerName
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jReaderName
,
NULL
);
if
(
readerName
==
NULL
)
{
return
0
;
}
rv
=
CALL_SCardConnect
(
context
,
readerName
,
jShareMode
,
jPreferredProtocols
,
&
card
,
&
proto
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jReaderName
,
readerName
);
dprintf1
(
"-cardhandle: %x
\n
"
,
card
);
...
...
@@ -210,6 +253,9 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_smartcardio_PCSC_SCardTransmit
sendPci
.
cbPciLength
=
sizeof
(
SCARD_IO_REQUEST
);
sbuf
=
(
unsigned
char
*
)
((
*
env
)
->
GetByteArrayElements
(
env
,
jBuf
,
NULL
));
if
(
sbuf
==
NULL
)
{
return
NULL
;
}
rv
=
CALL_SCardTransmit
(
card
,
&
sendPci
,
sbuf
+
ofs
,
len
,
NULL
,
rbuf
,
&
rlen
);
(
*
env
)
->
ReleaseByteArrayElements
(
env
,
jBuf
,
(
jbyte
*
)
sbuf
,
JNI_ABORT
);
...
...
@@ -218,7 +264,12 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_smartcardio_PCSC_SCardTransmit
}
jOut
=
(
*
env
)
->
NewByteArray
(
env
,
rlen
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
jOut
,
0
,
rlen
,
(
jbyte
*
)
rbuf
);
if
(
jOut
!=
NULL
)
{
(
*
env
)
->
SetByteArrayRegion
(
env
,
jOut
,
0
,
rlen
,
(
jbyte
*
)
rbuf
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
NULL
;
}
}
return
jOut
;
}
...
...
@@ -231,10 +282,10 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_smartcardio_PCSC_SCardStatus
DWORD
readerLen
=
READERNAME_BUFFER_SIZE
;
unsigned
char
atr
[
ATR_BUFFER_SIZE
];
DWORD
atrLen
=
ATR_BUFFER_SIZE
;
DWORD
state
;
DWORD
protocol
;
DWORD
state
=
0
;
DWORD
protocol
=
0
;
jbyteArray
jArray
;
jbyte
tmp
;
jbyte
status
[
2
]
;
rv
=
CALL_SCardStatus
(
card
,
readerName
,
&
readerLen
,
&
state
,
&
protocol
,
atr
,
&
atrLen
);
if
(
handleRV
(
env
,
rv
))
{
...
...
@@ -245,13 +296,19 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_smartcardio_PCSC_SCardStatus
dprintf1
(
"-protocol: %d
\n
"
,
protocol
);
jArray
=
(
*
env
)
->
NewByteArray
(
env
,
atrLen
);
if
(
jArray
==
NULL
)
{
return
NULL
;
}
(
*
env
)
->
SetByteArrayRegion
(
env
,
jArray
,
0
,
atrLen
,
(
jbyte
*
)
atr
);
tmp
=
(
jbyte
)
state
;
(
*
env
)
->
SetByteArrayRegion
(
env
,
jStatus
,
0
,
1
,
&
tmp
);
tmp
=
(
jbyte
)
protocol
;
(
*
env
)
->
SetByteArrayRegion
(
env
,
jStatus
,
1
,
1
,
&
tmp
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
NULL
;
}
status
[
0
]
=
(
jbyte
)
state
;
status
[
1
]
=
(
jbyte
)
protocol
;
(
*
env
)
->
SetByteArrayRegion
(
env
,
jStatus
,
0
,
2
,
status
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
NULL
;
}
return
jArray
;
}
...
...
@@ -274,36 +331,78 @@ JNIEXPORT jintArray JNICALL Java_sun_security_smartcardio_PCSC_SCardGetStatusCha
SCARDCONTEXT
context
=
(
SCARDCONTEXT
)
jContext
;
LONG
rv
;
int
readers
=
(
*
env
)
->
GetArrayLength
(
env
,
jReaderNames
);
SCARD_READERSTATE
*
readerState
=
malloc
(
readers
*
sizeof
(
SCARD_READERSTATE
))
;
SCARD_READERSTATE
*
readerState
;
int
i
;
jintArray
jEventState
;
int
*
currentState
=
(
*
env
)
->
GetIntArrayElements
(
env
,
jCurrentState
,
NULL
);
jintArray
jEventState
=
NULL
;
int
*
currentState
=
NULL
;
const
char
*
readerName
;
readerState
=
calloc
(
readers
,
sizeof
(
SCARD_READERSTATE
));
if
(
readerState
==
NULL
&&
readers
>
0
)
{
throwOutOfMemoryError
(
env
,
NULL
);
return
NULL
;
}
currentState
=
(
*
env
)
->
GetIntArrayElements
(
env
,
jCurrentState
,
NULL
);
if
(
currentState
==
NULL
)
{
free
(
readerState
);
return
NULL
;
}
for
(
i
=
0
;
i
<
readers
;
i
++
)
{
readerState
[
i
].
szReader
=
NULL
;
}
for
(
i
=
0
;
i
<
readers
;
i
++
)
{
jobject
jReaderName
=
(
*
env
)
->
GetObjectArrayElement
(
env
,
jReaderNames
,
i
);
readerState
[
i
].
szReader
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jReaderName
,
NULL
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
goto
cleanup
;
}
readerName
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jReaderName
,
NULL
);
if
(
readerName
==
NULL
)
{
goto
cleanup
;
}
readerState
[
i
].
szReader
=
strdup
(
readerName
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jReaderName
,
readerName
);
if
(
readerState
[
i
].
szReader
==
NULL
)
{
throwOutOfMemoryError
(
env
,
NULL
);
goto
cleanup
;
}
readerState
[
i
].
pvUserData
=
NULL
;
readerState
[
i
].
dwCurrentState
=
currentState
[
i
];
readerState
[
i
].
dwEventState
=
SCARD_STATE_UNAWARE
;
readerState
[
i
].
cbAtr
=
0
;
(
*
env
)
->
DeleteLocalRef
(
env
,
jReaderName
);
}
(
*
env
)
->
ReleaseIntArrayElements
(
env
,
jCurrentState
,
currentState
,
JNI_ABORT
);
rv
=
CALL_SCardGetStatusChange
(
context
,
(
DWORD
)
jTimeout
,
readerState
,
readers
);
if
(
readers
>
0
)
{
rv
=
CALL_SCardGetStatusChange
(
context
,
(
DWORD
)
jTimeout
,
readerState
,
readers
);
if
(
handleRV
(
env
,
rv
))
{
goto
cleanup
;
}
}
jEventState
=
(
*
env
)
->
NewIntArray
(
env
,
readers
);
if
(
jEventState
==
NULL
)
{
goto
cleanup
;
}
for
(
i
=
0
;
i
<
readers
;
i
++
)
{
jint
eventStateTmp
;
jobject
jReaderName
=
(
*
env
)
->
GetObjectArrayElement
(
env
,
jReaderNames
,
i
);
dprintf3
(
"-reader status %s: 0x%X, 0x%X
\n
"
,
readerState
[
i
].
szReader
,
readerState
[
i
].
dwCurrentState
,
readerState
[
i
].
dwEventState
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jReaderName
,
readerState
[
i
].
szReader
);
eventStateTmp
=
(
jint
)
readerState
[
i
].
dwEventState
;
(
*
env
)
->
SetIntArrayRegion
(
env
,
jEventState
,
i
,
1
,
&
eventStateTmp
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
jEventState
=
NULL
;
goto
cleanup
;
}
}
cleanup:
(
*
env
)
->
ReleaseIntArrayElements
(
env
,
jCurrentState
,
currentState
,
JNI_ABORT
);
for
(
i
=
0
;
i
<
readers
;
i
++
)
{
free
((
char
*
)
readerState
[
i
].
szReader
);
}
free
(
readerState
);
handleRV
(
env
,
rv
);
return
jEventState
;
}
...
...
@@ -336,13 +435,18 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_smartcardio_PCSC_SCardControl
{
SCARDHANDLE
card
=
(
SCARDHANDLE
)
jCard
;
LONG
rv
;
jbyte
*
sendBuffer
=
(
*
env
)
->
GetByteArrayElements
(
env
,
jSendBuffer
,
NULL
)
;
jbyte
*
sendBuffer
;
jint
sendBufferLength
=
(
*
env
)
->
GetArrayLength
(
env
,
jSendBuffer
);
jbyte
receiveBuffer
[
MAX_STACK_BUFFER_SIZE
];
jint
receiveBufferLength
=
MAX_STACK_BUFFER_SIZE
;
ULONG
returnedLength
=
0
;
jbyteArray
jReceiveBuffer
;
sendBuffer
=
(
*
env
)
->
GetByteArrayElements
(
env
,
jSendBuffer
,
NULL
);
if
(
sendBuffer
==
NULL
)
{
return
NULL
;
}
#ifdef J2PCSC_DEBUG
{
int
k
;
...
...
@@ -375,7 +479,12 @@ JNIEXPORT jbyteArray JNICALL Java_sun_security_smartcardio_PCSC_SCardControl
#endif
jReceiveBuffer
=
(
*
env
)
->
NewByteArray
(
env
,
returnedLength
);
if
(
jReceiveBuffer
==
NULL
)
{
return
NULL
;
}
(
*
env
)
->
SetByteArrayRegion
(
env
,
jReceiveBuffer
,
0
,
returnedLength
,
receiveBuffer
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
NULL
;
}
return
jReceiveBuffer
;
}
src/solaris/classes/sun/awt/X11/XErrorHandlerUtil.java
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013,
2014,
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
...
...
@@ -97,6 +97,7 @@ public final class XErrorHandlerUtil {
* @param handler the synthetic error handler to set
*/
public
static
void
WITH_XERROR_HANDLER
(
XErrorHandler
handler
)
{
XSync
();
saved_error
=
null
;
current_error_handler
=
handler
;
}
...
...
@@ -105,15 +106,9 @@ public final class XErrorHandlerUtil {
* Unsets a current synthetic error handler. Must be called with the acquired AWT lock.
*/
public
static
void
RESTORE_XERROR_HANDLER
()
{
RESTORE_XERROR_HANDLER
(
true
);
}
private
static
void
RESTORE_XERROR_HANDLER
(
boolean
doXSync
)
{
if
(
doXSync
)
{
// Wait until all requests are processed by the X server
// and only then uninstall the error handler.
XSync
();
}
// Wait until all requests are processed by the X server
// and only then uninstall the error handler.
XSync
();
current_error_handler
=
null
;
}
...
...
src/solaris/classes/sun/awt/X11/XFramePeer.java
浏览文件 @
ea3cbca9
...
...
@@ -284,6 +284,11 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
if
(
stateLog
.
isLoggable
(
PlatformLogger
.
Level
.
FINER
))
{
stateLog
.
finer
(
"DeIconifying "
+
this
);
}
XNETProtocol
net_protocol
=
XWM
.
getWM
().
getNETProtocol
();
if
(
net_protocol
!=
null
)
{
net_protocol
.
setActiveWindow
(
this
);
}
xSetVisible
(
true
);
}
}
...
...
src/solaris/classes/sun/awt/X11/XNETProtocol.java
浏览文件 @
ea3cbca9
...
...
@@ -213,7 +213,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
* If window is showing then it uses ClientMessage, otherwise adjusts NET_WM_STATE list
* @param window Window which NET_WM_STATE property is being modified
* @param state State atom to be set/reset
* @param
re
set Indicates operation, 'set' if false, 'reset' if true
* @param set Indicates operation, 'set' if false, 'reset' if true
*/
private
void
setStateHelper
(
XWindowPeer
window
,
XAtom
state
,
boolean
set
)
{
if
(
log
.
isLoggable
(
PlatformLogger
.
Level
.
FINER
))
{
...
...
@@ -249,6 +249,7 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
XAtom
XA_UTF8_STRING
=
XAtom
.
get
(
"UTF8_STRING"
);
/* like STRING but encoding is UTF-8 */
XAtom
XA_NET_SUPPORTING_WM_CHECK
=
XAtom
.
get
(
"_NET_SUPPORTING_WM_CHECK"
);
XAtom
XA_NET_SUPPORTED
=
XAtom
.
get
(
"_NET_SUPPORTED"
);
/* list of protocols (property of root) */
XAtom
XA_NET_ACTIVE_WINDOW
=
XAtom
.
get
(
"_NET_ACTIVE_WINDOW"
);
XAtom
XA_NET_WM_NAME
=
XAtom
.
get
(
"_NET_WM_NAME"
);
/* window property */
XAtom
XA_NET_WM_STATE
=
XAtom
.
get
(
"_NET_WM_STATE"
);
/* both window property and request */
...
...
@@ -325,6 +326,32 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
return
res
;
}
public
void
setActiveWindow
(
XWindow
window
)
{
if
(!
active
()
||
!
checkProtocol
(
XA_NET_SUPPORTED
,
XA_NET_ACTIVE_WINDOW
))
{
return
;
}
XClientMessageEvent
msg
=
new
XClientMessageEvent
();
msg
.
zero
();
msg
.
set_type
(
XConstants
.
ClientMessage
);
msg
.
set_message_type
(
XA_NET_ACTIVE_WINDOW
.
getAtom
());
msg
.
set_display
(
XToolkit
.
getDisplay
());
msg
.
set_window
(
window
.
getWindow
());
msg
.
set_format
(
32
);
msg
.
set_data
(
0
,
1
);
msg
.
set_data
(
1
,
XToolkit
.
getCurrentServerTime
());
msg
.
set_data
(
2
,
0
);
XToolkit
.
awtLock
();
try
{
XlibWrapper
.
XSendEvent
(
XToolkit
.
getDisplay
(),
XToolkit
.
getDefaultRootWindow
(),
false
,
XConstants
.
SubstructureRedirectMask
|
XConstants
.
SubstructureNotifyMask
,
msg
.
getPData
());
}
finally
{
XToolkit
.
awtUnlock
();
msg
.
dispose
();
}
}
boolean
isWMName
(
String
name
)
{
if
(!
active
())
{
return
false
;
...
...
src/solaris/native/java/net/NetworkInterface.c
浏览文件 @
ea3cbca9
...
...
@@ -250,7 +250,11 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
}
name_utf
=
(
*
env
)
->
GetStringUTFChars
(
env
,
name
,
&
isCopy
);
if
(
name_utf
==
NULL
)
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
NULL
;
}
/*
* Search the list of interface based on name
*/
...
...
@@ -518,7 +522,11 @@ JNIEXPORT jbyteArray JNICALL Java_java_net_NetworkInterface_getMacAddr0(JNIEnv *
const
char
*
name_utf
;
name_utf
=
(
*
env
)
->
GetStringUTFChars
(
env
,
name
,
&
isCopy
);
if
(
name_utf
==
NULL
)
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
NULL
;
}
if
((
sock
=
openSocketWithFallback
(
env
,
name_utf
))
<
0
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
name
,
name_utf
);
return
JNI_FALSE
;
...
...
@@ -565,6 +573,11 @@ JNIEXPORT jint JNICALL Java_java_net_NetworkInterface_getMTU0(JNIEnv *env, jclas
const
char
*
name_utf
;
name_utf
=
(
*
env
)
->
GetStringUTFChars
(
env
,
name
,
&
isCopy
);
if
(
name_utf
==
NULL
)
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
ret
;
}
if
((
sock
=
openSocketWithFallback
(
env
,
name_utf
))
<
0
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
name
,
name_utf
);
...
...
@@ -588,7 +601,11 @@ static int getFlags0(JNIEnv *env, jstring name) {
int
flags
=
0
;
name_utf
=
(
*
env
)
->
GetStringUTFChars
(
env
,
name
,
&
isCopy
);
if
(
name_utf
==
NULL
)
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
return
-
1
;
}
if
((
sock
=
openSocketWithFallback
(
env
,
name_utf
))
<
0
)
{
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
name
,
name_utf
);
return
-
1
;
...
...
@@ -632,10 +649,9 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
* Create a NetworkInterface object and populate it
*/
netifObj
=
(
*
env
)
->
NewObject
(
env
,
ni_class
,
ni_ctrID
);
CHECK_NULL_RETURN
(
netifObj
,
NULL
);
name
=
(
*
env
)
->
NewStringUTF
(
env
,
ifs
->
name
);
if
(
netifObj
==
NULL
||
name
==
NULL
)
{
return
NULL
;
}
CHECK_NULL_RETURN
(
name
,
NULL
);
(
*
env
)
->
SetObjectField
(
env
,
netifObj
,
ni_nameID
,
name
);
(
*
env
)
->
SetObjectField
(
env
,
netifObj
,
ni_descID
,
name
);
(
*
env
)
->
SetIntField
(
env
,
netifObj
,
ni_indexID
,
ifs
->
index
);
...
...
@@ -674,6 +690,8 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
iaObj
=
(
*
env
)
->
NewObject
(
env
,
ni_ia4cls
,
ni_ia4ctrID
);
if
(
iaObj
)
{
setInetAddress_addr
(
env
,
iaObj
,
htonl
(((
struct
sockaddr_in
*
)
addrP
->
addr
)
->
sin_addr
.
s_addr
));
}
else
{
return
NULL
;
}
ibObj
=
(
*
env
)
->
NewObject
(
env
,
ni_ibcls
,
ni_ibctrID
);
if
(
ibObj
)
{
...
...
@@ -684,10 +702,14 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
if
(
ia2Obj
)
{
setInetAddress_addr
(
env
,
ia2Obj
,
htonl
(((
struct
sockaddr_in
*
)
addrP
->
brdcast
)
->
sin_addr
.
s_addr
));
(
*
env
)
->
SetObjectField
(
env
,
ibObj
,
ni_ib4broadcastID
,
ia2Obj
);
}
else
{
return
NULL
;
}
}
(
*
env
)
->
SetShortField
(
env
,
ibObj
,
ni_ib4maskID
,
addrP
->
mask
);
(
*
env
)
->
SetObjectArrayElement
(
env
,
bindArr
,
bind_index
++
,
ibObj
);
}
else
{
return
NULL
;
}
}
...
...
@@ -707,20 +729,20 @@ jobject createNetworkInterface(JNIEnv *env, netif *ifs) {
setInet6Address_scopeid
(
env
,
iaObj
,
scope
);
setInet6Address_scopeifname
(
env
,
iaObj
,
netifObj
);
}
}
else
{
return
NULL
;
}
ibObj
=
(
*
env
)
->
NewObject
(
env
,
ni_ibcls
,
ni_ibctrID
);
if
(
ibObj
)
{
(
*
env
)
->
SetObjectField
(
env
,
ibObj
,
ni_ibaddressID
,
iaObj
);
(
*
env
)
->
SetShortField
(
env
,
ibObj
,
ni_ib4maskID
,
addrP
->
mask
);
(
*
env
)
->
SetObjectArrayElement
(
env
,
bindArr
,
bind_index
++
,
ibObj
);
}
else
{
return
NULL
;
}
}
#endif
if
(
iaObj
==
NULL
)
{
return
NULL
;
}
(
*
env
)
->
SetObjectArrayElement
(
env
,
addrArr
,
addr_index
++
,
iaObj
);
addrP
=
addrP
->
next
;
}
...
...
@@ -912,9 +934,14 @@ netif *addif(JNIEnv *env, int sock, const char * if_name,
// Deal with broadcast addr & subnet mask
struct
sockaddr
*
brdcast_to
=
(
struct
sockaddr
*
)
((
char
*
)
addrP
+
sizeof
(
netaddr
)
+
addr_size
);
addrP
->
brdcast
=
getBroadcast
(
env
,
sock
,
name
,
brdcast_to
);
if
((
mask
=
getSubnet
(
env
,
sock
,
name
))
!=
-
1
)
if
((
*
env
)
->
ExceptionCheck
(
env
)
==
JNI_TRUE
)
{
return
ifs
;
}
if
((
mask
=
getSubnet
(
env
,
sock
,
name
))
!=
-
1
)
{
addrP
->
mask
=
mask
;
}
else
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
ifs
;
}
}
/**
...
...
@@ -1396,6 +1423,7 @@ static int getMacAddress(JNIEnv *env, int sock, const char* ifname, const struct
nddp
=
(
struct
kinfo_ndd
*
)
malloc
(
size
);
if
(
!
nddp
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"Network interface getMacAddress native buffer allocation failed"
);
return
-
1
;
}
...
...
src/solaris/native/sun/awt/gtk2_interface.c
浏览文件 @
ea3cbca9
...
...
@@ -538,9 +538,7 @@ gboolean gtk2_show_uri_load(JNIEnv *env) {
fprintf
(
stderr
,
"dlsym(gtk_show_uri) returned NULL
\n
"
);
#endif
/* INTERNAL_BUILD */
}
else
{
#ifdef __solaris__
update_supported_actions
(
env
);
#endif
success
=
TRUE
;
}
}
...
...
src/solaris/native/sun/nio/ch/FileChannelImpl.c
浏览文件 @
ea3cbca9
...
...
@@ -39,6 +39,8 @@
#if defined(__linux__) || defined(__solaris__)
#include <sys/sendfile.h>
#elif defined(_AIX)
#include <sys/socket.h>
#elif defined(_ALLBSD_SOURCE)
#include <sys/types.h>
#include <sys/socket.h>
...
...
@@ -207,9 +209,7 @@ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
numBytes
=
count
;
#ifdef __APPLE__
result
=
sendfile
(
srcFD
,
dstFD
,
position
,
&
numBytes
,
NULL
,
0
);
#endif
if
(
numBytes
>
0
)
return
numBytes
;
...
...
@@ -228,7 +228,48 @@ Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
}
return
result
;
#elif defined(_AIX)
jlong
max
=
(
jlong
)
java_lang_Integer_MAX_VALUE
;
struct
sf_parms
sf_iobuf
;
jlong
result
;
if
(
position
>
max
)
return
IOS_UNSUPPORTED_CASE
;
if
(
count
>
max
)
count
=
max
;
memset
(
&
sf_iobuf
,
0
,
sizeof
(
sf_iobuf
));
sf_iobuf
.
file_descriptor
=
srcFD
;
sf_iobuf
.
file_offset
=
(
off_t
)
position
;
sf_iobuf
.
file_bytes
=
count
;
result
=
send_file
(
&
dstFD
,
&
sf_iobuf
,
SF_SYNC_CACHE
);
/* AIX send_file() will return 0 when this operation complete successfully,
* return 1 when partial bytes transfered and return -1 when an error has
* Occured.
*/
if
(
result
==
-
1
)
{
if
(
errno
==
EWOULDBLOCK
)
return
IOS_UNAVAILABLE
;
if
((
errno
==
EINVAL
)
&&
((
ssize_t
)
count
>=
0
))
return
IOS_UNSUPPORTED_CASE
;
if
(
errno
==
EINTR
)
return
IOS_INTERRUPTED
;
if
(
errno
==
ENOTSOCK
)
return
IOS_UNSUPPORTED
;
JNU_ThrowIOExceptionWithLastError
(
env
,
"Transfer failed"
);
return
IOS_THROWN
;
}
if
(
sf_iobuf
.
bytes_sent
>
0
)
return
(
jlong
)
sf_iobuf
.
bytes_sent
;
return
IOS_UNSUPPORTED_CASE
;
#else
return
IOS_UNSUPPORTED_CASE
;
#endif
}
src/solaris/native/sun/security/smartcardio/MUSCLE/pcsclite.h
浏览文件 @
ea3cbca9
...
...
@@ -62,6 +62,8 @@ typedef SCARDHANDLE *LPSCARDHANDLE;
#define MAX_ATR_SIZE 33
/* Maximum ATR size */
#ifndef __APPLE__
typedef
struct
{
const
char
*
szReader
;
...
...
@@ -73,6 +75,23 @@ typedef struct
}
SCARD_READERSTATE_A
;
#else // __APPLE__
#pragma pack(1)
typedef
struct
{
const
char
*
szReader
;
void
*
pvUserData
;
uint32_t
dwCurrentState
;
uint32_t
dwEventState
;
uint32_t
cbAtr
;
unsigned
char
rgbAtr
[
MAX_ATR_SIZE
];
}
SCARD_READERSTATE_A
;
#pragma pack()
#endif // __APPLE__
typedef
SCARD_READERSTATE_A
SCARD_READERSTATE
,
*
PSCARD_READERSTATE_A
,
*
LPSCARD_READERSTATE_A
;
...
...
src/solaris/native/sun/security/smartcardio/pcsc_md.c
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2005, 201
3
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
...
...
@@ -89,6 +89,10 @@ void *findFunction(JNIEnv *env, void *hModule, char *functionName) {
JNIEXPORT
void
JNICALL
Java_sun_security_smartcardio_PlatformPCSC_initialize
(
JNIEnv
*
env
,
jclass
thisClass
,
jstring
jLibName
)
{
const
char
*
libName
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jLibName
,
NULL
);
if
(
libName
==
NULL
)
{
throwNullPointerException
(
env
,
"PCSC library name is null"
);
return
;
}
hModule
=
dlopen
(
libName
,
RTLD_LAZY
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jLibName
,
libName
);
...
...
@@ -97,13 +101,44 @@ JNIEXPORT void JNICALL Java_sun_security_smartcardio_PlatformPCSC_initialize
return
;
}
scardEstablishContext
=
(
FPTR_SCardEstablishContext
)
findFunction
(
env
,
hModule
,
"SCardEstablishContext"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardConnect
=
(
FPTR_SCardConnect
)
findFunction
(
env
,
hModule
,
"SCardConnect"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardDisconnect
=
(
FPTR_SCardDisconnect
)
findFunction
(
env
,
hModule
,
"SCardDisconnect"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardStatus
=
(
FPTR_SCardStatus
)
findFunction
(
env
,
hModule
,
"SCardStatus"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardGetStatusChange
=
(
FPTR_SCardGetStatusChange
)
findFunction
(
env
,
hModule
,
"SCardGetStatusChange"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardTransmit
=
(
FPTR_SCardTransmit
)
findFunction
(
env
,
hModule
,
"SCardTransmit"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardListReaders
=
(
FPTR_SCardListReaders
)
findFunction
(
env
,
hModule
,
"SCardListReaders"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardBeginTransaction
=
(
FPTR_SCardBeginTransaction
)
findFunction
(
env
,
hModule
,
"SCardBeginTransaction"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
scardEndTransaction
=
(
FPTR_SCardEndTransaction
)
findFunction
(
env
,
hModule
,
"SCardEndTransaction"
);
if
((
*
env
)
->
ExceptionCheck
(
env
))
{
return
;
}
#ifndef __APPLE__
scardControl
=
(
FPTR_SCardControl
)
findFunction
(
env
,
hModule
,
"SCardControl"
);
#else
scardControl
=
(
FPTR_SCardControl
)
findFunction
(
env
,
hModule
,
"SCardControl132"
);
#endif // __APPLE__
}
src/solaris/native/sun/xawt/XlibWrapper.c
浏览文件 @
ea3cbca9
...
...
@@ -1236,10 +1236,8 @@ JNIEXPORT jbyteArray JNICALL Java_sun_awt_X11_XlibWrapper_getStringBytes
long
length
=
strlen
((
char
*
)
str
);
jbyteArray
res
=
(
*
env
)
->
NewByteArray
(
env
,
length
);
CHECK_NULL_RETURN
(
res
,
NULL
);
void
*
storage
=
malloc
(
length
+
1
);
memcpy
(
storage
,
str
,
length
+
1
);
(
*
env
)
->
SetByteArrayRegion
(
env
,
res
,
0
,
length
,
(
const
signed
char
*
)
st
orage
);
(
const
signed
char
*
)
st
r
);
return
res
;
}
...
...
src/windows/native/java/io/io_util_md.c
浏览文件 @
ea3cbca9
...
...
@@ -161,10 +161,17 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
{
if
(
pathlen
>
max_path
-
1
)
{
pathbuf
=
prefixAbpath
(
ps
,
pathlen
,
pathlen
);
if
(
pathbuf
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
}
else
{
pathbuf
=
(
WCHAR
*
)
malloc
((
pathlen
+
6
)
*
sizeof
(
WCHAR
));
if
(
pathbuf
!=
0
)
{
wcscpy
(
pathbuf
,
ps
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
}
}
else
{
...
...
@@ -184,10 +191,17 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
int
dirlen
=
currentDirLength
(
ps
,
pathlen
);
if
(
dirlen
+
pathlen
+
1
>
max_path
-
1
)
{
pathbuf
=
prefixAbpath
(
ps
,
pathlen
,
dirlen
+
pathlen
);
if
(
pathbuf
==
NULL
)
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
}
else
{
pathbuf
=
(
WCHAR
*
)
malloc
((
pathlen
+
6
)
*
sizeof
(
WCHAR
));
if
(
pathbuf
!=
0
)
{
wcscpy
(
pathbuf
,
ps
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
return
NULL
;
}
}
}
...
...
@@ -196,7 +210,9 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
if
(
pathlen
==
0
)
{
if
(
throwFNFE
==
JNI_TRUE
)
{
throwFileNotFoundException
(
env
,
path
);
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
{
throwFileNotFoundException
(
env
,
path
);
}
return
NULL
;
}
else
{
pathbuf
=
(
WCHAR
*
)
malloc
(
sizeof
(
WCHAR
));
...
...
@@ -204,7 +220,9 @@ pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE) {
}
}
if
(
pathbuf
==
0
)
{
JNU_ThrowOutOfMemoryError
(
env
,
0
);
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
}
return
NULL
;
}
return
pathbuf
;
...
...
src/windows/native/java/net/DualStackPlainDatagramSocketImpl.c
浏览文件 @
ea3cbca9
...
...
@@ -376,15 +376,19 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketRece
if
(
packetAddress
==
NULL
)
{
packetAddress
=
NET_SockaddrToInetAddress
(
env
,
(
struct
sockaddr
*
)
&
sa
,
&
port
);
/* stuff the new Inetaddress into the packet */
(
*
env
)
->
SetObjectField
(
env
,
dpObj
,
dp_addressID
,
packetAddress
);
if
(
packetAddress
!=
NULL
)
{
/* stuff the new Inetaddress into the packet */
(
*
env
)
->
SetObjectField
(
env
,
dpObj
,
dp_addressID
,
packetAddress
);
}
}
/* populate the packet */
(
*
env
)
->
SetByteArrayRegion
(
env
,
packetBuffer
,
packetBufferOffset
,
rv
,
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
{
/* populate the packet */
(
*
env
)
->
SetByteArrayRegion
(
env
,
packetBuffer
,
packetBufferOffset
,
rv
,
(
jbyte
*
)
fullPacket
);
(
*
env
)
->
SetIntField
(
env
,
dpObj
,
dp_portID
,
port
);
(
*
env
)
->
SetIntField
(
env
,
dpObj
,
dp_lengthID
,
rv
);
(
*
env
)
->
SetIntField
(
env
,
dpObj
,
dp_portID
,
port
);
(
*
env
)
->
SetIntField
(
env
,
dpObj
,
dp_lengthID
,
rv
);
}
}
if
(
packetBufferLen
>
MAX_BUFFER_LEN
)
{
...
...
src/windows/native/java/net/NetworkInterface.c
浏览文件 @
ea3cbca9
...
...
@@ -567,16 +567,16 @@ jobject createNetworkInterface
* Create a NetworkInterface object and populate it
*/
netifObj
=
(
*
env
)
->
NewObject
(
env
,
ni_class
,
ni_ctor
);
CHECK_NULL_RETURN
(
netifObj
,
NULL
);
name
=
(
*
env
)
->
NewStringUTF
(
env
,
ifs
->
name
);
CHECK_NULL_RETURN
(
name
,
NULL
);
if
(
ifs
->
dNameIsUnicode
)
{
displayName
=
(
*
env
)
->
NewString
(
env
,
(
PWCHAR
)
ifs
->
displayName
,
(
jsize
)
wcslen
((
PWCHAR
)
ifs
->
displayName
));
}
else
{
displayName
=
(
*
env
)
->
NewStringUTF
(
env
,
ifs
->
displayName
);
}
if
(
netifObj
==
NULL
||
name
==
NULL
||
displayName
==
NULL
)
{
return
NULL
;
}
CHECK_NULL_RETURN
(
displayName
,
NULL
);
(
*
env
)
->
SetObjectField
(
env
,
netifObj
,
ni_nameID
,
name
);
(
*
env
)
->
SetObjectField
(
env
,
netifObj
,
ni_displayNameID
,
displayName
);
(
*
env
)
->
SetIntField
(
env
,
netifObj
,
ni_indexID
,
ifs
->
index
);
...
...
@@ -706,23 +706,28 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
/* get the name as a C string */
name_utf
=
(
*
env
)
->
GetStringUTFChars
(
env
,
name
,
&
isCopy
);
if
(
name_utf
!=
NULL
)
{
/* Search by name */
curr
=
ifList
;
while
(
curr
!=
NULL
)
{
if
(
strcmp
(
name_utf
,
curr
->
name
)
==
0
)
{
break
;
/* Search by name */
curr
=
ifList
;
while
(
curr
!=
NULL
)
{
if
(
strcmp
(
name_utf
,
curr
->
name
)
==
0
)
{
break
;
}
curr
=
curr
->
next
;
}
curr
=
curr
->
next
;
}
/* if found create a NetworkInterface */
if
(
curr
!=
NULL
)
{;
netifObj
=
createNetworkInterface
(
env
,
curr
,
-
1
,
NULL
);
}
/* if found create a NetworkInterface */
if
(
curr
!=
NULL
)
{;
netifObj
=
createNetworkInterface
(
env
,
curr
,
-
1
,
NULL
);
}
/* release the UTF string */
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
name
,
name_utf
);
/* release the UTF string */
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
name
,
name_utf
);
}
else
{
if
(
!
(
*
env
)
->
ExceptionCheck
(
env
))
JNU_ThrowOutOfMemoryError
(
env
,
NULL
);
}
/* release the interface list */
free_netif
(
ifList
);
...
...
src/windows/native/sun/net/dns/ResolverConfigurationImpl.c
浏览文件 @
ea3cbca9
...
...
@@ -39,6 +39,7 @@
#define STS_NO_CONFIG 0x0
/* no configuration found */
#define STS_SL_FOUND 0x1
/* search list found */
#define STS_NS_FOUND 0x2
/* name servers found */
#define STS_ERROR -1
/* error return lodConfig failed memory allccation failure*/
#define IS_SL_FOUND(sts) (sts & STS_SL_FOUND)
#define IS_NS_FOUND(sts) (sts & STS_NS_FOUND)
...
...
@@ -123,14 +124,14 @@ static int loadConfig(char *sl, char *ns) {
size
=
sizeof
(
IP_ADAPTER_INFO
);
adapterP
=
(
IP_ADAPTER_INFO
*
)
malloc
(
size
);
if
(
adapterP
==
NULL
)
{
return
-
1
;
return
STS_ERROR
;
}
ret
=
GetAdaptersInfo
(
adapterP
,
&
size
);
if
(
ret
==
ERROR_BUFFER_OVERFLOW
)
{
IP_ADAPTER_INFO
*
newAdapterP
=
(
IP_ADAPTER_INFO
*
)
realloc
(
adapterP
,
size
);
if
(
newAdapterP
==
NULL
)
{
free
(
adapterP
);
return
-
1
;
return
STS_ERROR
;
}
adapterP
=
newAdapterP
;
...
...
@@ -239,6 +240,7 @@ Java_sun_net_dns_ResolverConfigurationImpl_init0(JNIEnv *env, jclass cls)
{
searchlistID
=
(
*
env
)
->
GetStaticFieldID
(
env
,
cls
,
"os_searchlist"
,
"Ljava/lang/String;"
);
CHECK_NULL
(
searchlistID
);
nameserversID
=
(
*
env
)
->
GetStaticFieldID
(
env
,
cls
,
"os_nameservers"
,
"Ljava/lang/String;"
);
}
...
...
@@ -258,16 +260,21 @@ Java_sun_net_dns_ResolverConfigurationImpl_loadDNSconfig0(JNIEnv *env, jclass cl
searchlist
[
0
]
=
'\0'
;
nameservers
[
0
]
=
'\0'
;
loadConfig
(
searchlist
,
nameservers
);
if
(
loadConfig
(
searchlist
,
nameservers
)
!=
STS_ERROR
)
{
/*
* Populate static fields in sun.net.DefaultResolverConfiguration
*/
obj
=
(
*
env
)
->
NewStringUTF
(
env
,
searchlist
);
(
*
env
)
->
SetStaticObjectField
(
env
,
cls
,
searchlistID
,
obj
);
/*
* Populate static fields in sun.net.DefaultResolverConfiguration
*/
obj
=
(
*
env
)
->
NewStringUTF
(
env
,
searchlist
);
CHECK_NULL
(
obj
);
(
*
env
)
->
SetStaticObjectField
(
env
,
cls
,
searchlistID
,
obj
);
obj
=
(
*
env
)
->
NewStringUTF
(
env
,
nameservers
);
(
*
env
)
->
SetStaticObjectField
(
env
,
cls
,
nameserversID
,
obj
);
obj
=
(
*
env
)
->
NewStringUTF
(
env
,
nameservers
);
CHECK_NULL
(
obj
);
(
*
env
)
->
SetStaticObjectField
(
env
,
cls
,
nameserversID
,
obj
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failed"
);
}
}
...
...
src/windows/native/sun/nio/fs/WindowsNativeDispatcher.c
浏览文件 @
ea3cbca9
...
...
@@ -1118,11 +1118,13 @@ Java_sun_nio_fs_WindowsNativeDispatcher_GetFullPathName0(JNIEnv *env,
JNU_ThrowInternalError
(
env
,
"GetFullPathNameW failed"
);
}
free
(
lpBuf
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failure"
);
}
}
}
if
(
len
==
0
)
}
else
{
throwWindowsException
(
env
,
GetLastError
());
}
return
rv
;
}
...
...
@@ -1157,13 +1159,13 @@ Java_sun_nio_fs_WindowsNativeDispatcher_GetFinalPathNameByHandle(JNIEnv* env,
JNU_ThrowInternalError
(
env
,
"GetFinalPathNameByHandleW failed"
);
}
free
(
lpBuf
);
}
else
{
JNU_ThrowOutOfMemoryError
(
env
,
"native memory allocation failure"
);
}
}
}
if
(
len
==
0
)
}
else
{
throwWindowsException
(
env
,
GetLastError
());
}
return
rv
;
}
...
...
test/com/sun/jndi/ldap/LdapTimeoutTest.java
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2011, 201
2
, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
...
...
@@ -64,11 +64,12 @@ public class LdapTimeoutTest {
env
.
put
(
Context
.
SECURITY_PRINCIPAL
,
"user"
);
env
.
put
(
Context
.
SECURITY_CREDENTIALS
,
"password"
);
env
.
put
(
"com.sun.jndi.ldap.connect.timeout"
,
"10"
);
env
.
put
(
"com.sun.jndi.ldap.read.timeout"
,
"3000"
);
InitialContext
ctx
=
null
;
try
{
new
LdapTimeoutTest
().
deadServerNoTimeout
(
env
);
env
.
put
(
"com.sun.jndi.ldap.connect.timeout"
,
"10"
);
env
.
put
(
"com.sun.jndi.ldap.read.timeout"
,
"3000"
);
new
LdapTimeoutTest
().
ldapReadTimeoutTest
(
env
,
false
);
new
LdapTimeoutTest
().
ldapReadTimeoutTest
(
env
,
true
);
new
LdapTimeoutTest
().
simpleAuthConnectTest
(
env
);
...
...
@@ -84,7 +85,7 @@ public class LdapTimeoutTest {
void
ldapReadTimeoutTest
(
Hashtable
env
,
boolean
ssl
)
{
InitialContext
ctx
=
null
;
if
(
ssl
)
env
.
put
(
Context
.
SECURITY_PROTOCOL
,
"ssl"
);
ScheduledFuture
killer
=
killSwitch
();
ScheduledFuture
killer
=
killSwitch
(
5000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
...
...
@@ -112,7 +113,7 @@ public class LdapTimeoutTest {
void
simpleAuthConnectTest
(
Hashtable
env
)
{
InitialContext
ctx
=
null
;
ScheduledFuture
killer
=
killSwitch
();
ScheduledFuture
killer
=
killSwitch
(
5000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
...
...
@@ -139,6 +140,32 @@ public class LdapTimeoutTest {
}
}
void
deadServerNoTimeout
(
Hashtable
env
)
{
InitialContext
ctx
=
null
;
ScheduledFuture
killer
=
killSwitch
(
30000
);
long
start
=
System
.
nanoTime
();
try
{
ctx
=
new
InitialDirContext
(
env
);
SearchControls
scl
=
new
SearchControls
();
scl
.
setSearchScope
(
SearchControls
.
SUBTREE_SCOPE
);
NamingEnumeration
<
SearchResult
>
answer
=
((
InitialDirContext
)
ctx
)
.
search
(
"ou=People,o=JNDITutorial"
,
"(objectClass=*)"
,
scl
);
// shouldn't reach here
fail
();
}
catch
(
NamingException
e
)
{
long
end
=
System
.
nanoTime
();
if
(
TimeUnit
.
NANOSECONDS
.
toMillis
(
end
-
start
)
<
14000
)
{
System
.
err
.
println
(
"fail: timeout should be at least 15 seconds, actual time: "
+
TimeUnit
.
NANOSECONDS
.
toMillis
(
end
-
start
));
fail
();
}
else
{
pass
();
}
}
finally
{
if
(!
shutItDown
(
killer
,
ctx
))
fail
();
}
}
boolean
shutItDown
(
ScheduledFuture
killer
,
InitialContext
ctx
)
{
killer
.
cancel
(
true
);
try
{
...
...
@@ -149,15 +176,15 @@ public class LdapTimeoutTest {
}
}
ScheduledFuture
killSwitch
()
{
ScheduledFuture
killSwitch
(
int
ms
)
{
final
Thread
current
=
Thread
.
currentThread
();
return
LdapTimeoutTest
.
pool
.
schedule
(
new
Callable
<
Void
>()
{
public
Void
call
()
throws
Exception
{
System
.
err
.
println
(
"Fail: killSwitch()"
);
current
.
interrupt
(
);
System
.
exit
(
0
);
return
null
;
}
},
5000
,
TimeUnit
.
MILLISECONDS
);
},
ms
,
TimeUnit
.
MILLISECONDS
);
}
static
class
Server
extends
Thread
{
...
...
test/java/awt/Choice/RemoveAllShrinkTest/RemoveAllShrinkTest.java
0 → 100644
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2014, 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 4851798 8041896
@summary Tests Choice List shrinks after removeAll
@run main RemoveAllShrinkTest
*/
import
java.awt.*
;
import
java.awt.event.*
;
public
class
RemoveAllShrinkTest
{
public
static
void
main
(
String
[]
args
)
{
Frame
f
=
new
Frame
();
Choice
choice
=
new
Choice
();
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
choice
.
addItem
(
"Item "
+
i
);
}
f
.
add
(
choice
,
BorderLayout
.
NORTH
);
Panel
panel
=
new
Panel
();
panel
.
setBackground
(
Color
.
RED
);
f
.
add
(
panel
);
f
.
setSize
(
200
,
200
);
f
.
setVisible
(
true
);
f
.
toFront
();
choice
.
removeAll
();
try
{
Robot
robot
=
new
Robot
();
robot
.
setAutoWaitForIdle
(
true
);
robot
.
setAutoDelay
(
50
);
robot
.
waitForIdle
();
Thread
.
sleep
(
200
);
Point
pt
=
choice
.
getLocationOnScreen
();
robot
.
mouseMove
(
pt
.
x
+
choice
.
getWidth
()
-
choice
.
getHeight
()
/
2
,
pt
.
y
+
choice
.
getHeight
()
/
2
);
robot
.
mousePress
(
InputEvent
.
BUTTON1_MASK
);
robot
.
mouseRelease
(
InputEvent
.
BUTTON1_MASK
);
Thread
.
sleep
(
400
);
Point
pt1
=
panel
.
getLocationOnScreen
();
Color
color
=
robot
.
getPixelColor
(
pt1
.
x
+
panel
.
getWidth
()
/
2
,
pt1
.
y
+
panel
.
getHeight
()
/
2
);
if
(!
color
.
equals
(
Color
.
RED
))
{
throw
new
RuntimeException
(
"RemoveAllShrinkTest failed. "
+
color
);
}
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"The test was not completed.\n\n"
+
e
);
}
}
}
test/java/awt/Multiscreen/MouseEventTest/MouseEventTest.java
0 → 100644
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2014, 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 8017472
@summary MouseEvent has wrong coordinates when using multiple monitors
@run main MouseEventTest
*/
import
sun.awt.SunToolkit
;
import
java.awt.*
;
import
java.awt.event.MouseAdapter
;
import
java.awt.event.MouseEvent
;
public
class
MouseEventTest
{
static
volatile
boolean
crossed
=
false
;
static
void
sleep
()
throws
InterruptedException
{
((
SunToolkit
)
Toolkit
.
getDefaultToolkit
()).
realSync
();
Thread
.
sleep
(
500
);
}
public
static
void
main
(
String
[]
args
)
throws
AWTException
,
InterruptedException
{
GraphicsEnvironment
ge
=
GraphicsEnvironment
.
getLocalGraphicsEnvironment
();
GraphicsDevice
[]
gds
=
ge
.
getScreenDevices
();
if
(
gds
.
length
<
2
)
{
System
.
out
.
println
(
"It's a multiscreen test... skipping!"
);
return
;
}
for
(
int
i
=
0
;
i
<
gds
.
length
;
++
i
)
{
GraphicsDevice
gd
=
gds
[
i
];
GraphicsConfiguration
gc
=
gd
.
getDefaultConfiguration
();
Rectangle
screen
=
gc
.
getBounds
();
Robot
robot
=
new
Robot
(
gd
);
robot
.
setAutoDelay
(
100
);
Frame
frame
=
new
Frame
(
gc
);
frame
.
setUndecorated
(
true
);
frame
.
setSize
(
200
,
200
);
frame
.
setLocation
(
screen
.
x
+
200
,
screen
.
y
+
200
);
frame
.
setBackground
(
Color
.
YELLOW
);
frame
.
setVisible
(
true
);
sleep
();
Point
loc
=
frame
.
getLocationOnScreen
();
Dimension
size
=
frame
.
getSize
();
final
Point
point
=
new
Point
(
loc
.
x
+
size
.
width
/
2
,
loc
.
y
+
size
.
height
/
2
);
crossed
=
false
;
frame
.
addMouseMotionListener
(
new
MouseAdapter
()
{
@Override
public
void
mouseMoved
(
MouseEvent
e
)
{
if
(
point
.
equals
(
e
.
getLocationOnScreen
()))
{
crossed
=
true
;
}
}
});
robot
.
mouseMove
(
point
.
x
-
1
,
point
.
y
-
1
);
robot
.
mouseMove
(
point
.
x
,
point
.
y
);
sleep
();
frame
.
dispose
();
if
(!
crossed
)
{
throw
new
RuntimeException
(
"An expected mouse motion event was not received on the screen #"
+
i
);
}
}
System
.
out
.
println
(
"Test PASSED!"
);
}
}
test/java/awt/image/ImageIconHang.java
0 → 100644
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2014, 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.
*/
import
java.awt.*
;
/*
* @test
* @bug 8032788
* @summary Checks that null filename argument is processed correctly
*
* @run main ImageIconHang
*/
public
class
ImageIconHang
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Image
image
=
Toolkit
.
getDefaultToolkit
().
getImage
((
String
)
null
);
MediaTracker
mt
=
new
MediaTracker
(
new
Component
()
{});
mt
.
addImage
(
image
,
1
);
mt
.
waitForID
(
1
,
5000
);
int
status
=
mt
.
statusID
(
1
,
false
);
System
.
out
.
println
(
"Status: "
+
status
);
if
(
status
!=
MediaTracker
.
ERRORED
)
{
throw
new
RuntimeException
(
"MediaTracker.waitForID() hung."
);
}
}
}
test/java/time/test/java/time/temporal/TestIsoWeekFields.java
0 → 100644
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2014, 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
package
test.java.time.temporal
;
import
static
java
.
time
.
temporal
.
ChronoField
.
DAY_OF_WEEK
;
import
static
org
.
testng
.
Assert
.
assertEquals
;
import
java.time.LocalDate
;
import
java.time.LocalTime
;
import
java.time.MonthDay
;
import
java.time.OffsetDateTime
;
import
java.time.Year
;
import
java.time.chrono.ThaiBuddhistDate
;
import
java.time.temporal.ChronoUnit
;
import
java.time.temporal.IsoFields
;
import
java.time.temporal.TemporalField
;
import
java.time.temporal.ValueRange
;
import
java.time.temporal.WeekFields
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
/**
* Test.
*/
@Test
public
class
TestIsoWeekFields
{
@DataProvider
(
name
=
"fields"
)
Object
[][]
data_Fields
()
{
return
new
Object
[][]
{
{
IsoFields
.
WEEK_OF_WEEK_BASED_YEAR
,
IsoFields
.
WEEK_BASED_YEAR
},
{
WeekFields
.
ISO
.
weekOfWeekBasedYear
(),
WeekFields
.
ISO
.
weekBasedYear
()},
};
}
//-----------------------------------------------------------------------
// WEEK_OF_WEEK_BASED_YEAR
//-----------------------------------------------------------------------
@Test
(
dataProvider
=
"fields"
)
public
void
test_WOWBY_basics
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
weekField
.
isDateBased
(),
true
);
assertEquals
(
weekField
.
isTimeBased
(),
false
);
assertEquals
(
weekField
.
getBaseUnit
(),
ChronoUnit
.
WEEKS
);
assertEquals
(
weekField
.
getRangeUnit
(),
IsoFields
.
WEEK_BASED_YEARS
);
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_WOWBY_isSupportedBy
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
weekField
.
isSupportedBy
(
LocalTime
.
NOON
),
false
);
assertEquals
(
weekField
.
isSupportedBy
(
MonthDay
.
of
(
2
,
1
)),
false
);
assertEquals
(
weekField
.
isSupportedBy
(
LocalDate
.
MIN
),
true
);
assertEquals
(
weekField
.
isSupportedBy
(
OffsetDateTime
.
MAX
),
true
);
}
@Test
public
void
test_WOWBY_isSupportedBy_fieldsDiffer
()
{
assertEquals
(
IsoFields
.
WEEK_OF_WEEK_BASED_YEAR
.
isSupportedBy
(
ThaiBuddhistDate
.
now
()),
false
);
assertEquals
(
WeekFields
.
ISO
.
weekOfWeekBasedYear
().
isSupportedBy
(
ThaiBuddhistDate
.
now
()),
true
);
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_WOWBY_range
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
weekField
.
range
(),
ValueRange
.
of
(
1
,
52
,
53
));
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_WOWBY_rangeRefinedBy
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
weekField
.
rangeRefinedBy
(
LocalDate
.
of
(
2012
,
12
,
31
)),
ValueRange
.
of
(
1
,
52
));
assertEquals
(
weekField
.
rangeRefinedBy
(
LocalDate
.
of
(
2013
,
12
,
29
)),
ValueRange
.
of
(
1
,
52
));
assertEquals
(
weekField
.
rangeRefinedBy
(
LocalDate
.
of
(
2013
,
12
,
30
)),
ValueRange
.
of
(
1
,
52
));
assertEquals
(
weekField
.
rangeRefinedBy
(
LocalDate
.
of
(
2014
,
12
,
28
)),
ValueRange
.
of
(
1
,
52
));
assertEquals
(
weekField
.
rangeRefinedBy
(
LocalDate
.
of
(
2014
,
12
,
29
)),
ValueRange
.
of
(
1
,
53
));
assertEquals
(
weekField
.
rangeRefinedBy
(
LocalDate
.
of
(
2016
,
1
,
3
)),
ValueRange
.
of
(
1
,
53
));
assertEquals
(
weekField
.
rangeRefinedBy
(
LocalDate
.
of
(
2016
,
1
,
4
)),
ValueRange
.
of
(
1
,
52
));
}
//-----------------------------------------------------------------------
// WEEK_BASED_YEAR
//-----------------------------------------------------------------------
@Test
(
dataProvider
=
"fields"
)
public
void
test_WBY_basics
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
yearField
.
isDateBased
(),
true
);
assertEquals
(
yearField
.
isTimeBased
(),
false
);
assertEquals
(
yearField
.
getBaseUnit
(),
IsoFields
.
WEEK_BASED_YEARS
);
assertEquals
(
yearField
.
getRangeUnit
(),
ChronoUnit
.
FOREVER
);
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_WBY_isSupportedBy
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
yearField
.
isSupportedBy
(
LocalTime
.
NOON
),
false
);
assertEquals
(
yearField
.
isSupportedBy
(
MonthDay
.
of
(
2
,
1
)),
false
);
assertEquals
(
yearField
.
isSupportedBy
(
LocalDate
.
MIN
),
true
);
assertEquals
(
yearField
.
isSupportedBy
(
OffsetDateTime
.
MAX
),
true
);
}
@Test
public
void
test_WBY_isSupportedBy_ISO
()
{
assertEquals
(
IsoFields
.
WEEK_BASED_YEAR
.
isSupportedBy
(
ThaiBuddhistDate
.
now
()),
false
);
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_WBY_range
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
yearField
.
range
(),
ValueRange
.
of
(
Year
.
MIN_VALUE
,
Year
.
MAX_VALUE
));
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_WBY_rangeRefinedBy
(
TemporalField
weekField
,
TemporalField
yearField
)
{
assertEquals
(
yearField
.
rangeRefinedBy
(
LocalDate
.
of
(
2012
,
12
,
31
)),
ValueRange
.
of
(
Year
.
MIN_VALUE
,
Year
.
MAX_VALUE
));
}
//-----------------------------------------------------------------------
@Test
(
dataProvider
=
"fields"
)
public
void
test_getFrom
(
TemporalField
weekField
,
TemporalField
yearField
)
{
// tests every day from 2011 to 2016 inclusive
LocalDate
date
=
LocalDate
.
of
(
2011
,
1
,
3
);
int
wby
=
2011
;
int
week
=
1
;
int
dow
=
1
;
for
(
int
i
=
1
;
i
<=
((
52
+
52
+
52
+
52
+
53
+
52
)
*
7
);
i
++)
{
assertEquals
(
yearField
.
getFrom
(
date
),
wby
);
assertEquals
(
weekField
.
getFrom
(
date
),
week
);
assertEquals
(
DAY_OF_WEEK
.
getFrom
(
date
),
dow
);
if
(
dow
==
7
)
{
dow
=
1
;
week
++;
}
else
{
dow
++;
}
if
(
week
>
wbyLen
(
wby
))
{
week
=
1
;
wby
++;
}
date
=
date
.
plusDays
(
1
);
}
assertEquals
(
yearField
.
getFrom
(
date
),
2017
);
assertEquals
(
weekField
.
getFrom
(
date
),
1
);
assertEquals
(
DAY_OF_WEEK
.
getFrom
(
date
),
1
);
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_adjustInto_dow
(
TemporalField
weekField
,
TemporalField
yearField
)
{
// tests every day from 2012 to 2016 inclusive
LocalDate
date
=
LocalDate
.
of
(
2012
,
1
,
2
);
int
wby
=
2012
;
int
week
=
1
;
int
dow
=
1
;
for
(
int
i
=
1
;
i
<=
((
52
+
52
+
52
+
53
+
52
)
*
7
);
i
++)
{
for
(
int
j
=
1
;
j
<=
7
;
j
++)
{
LocalDate
adjusted
=
DAY_OF_WEEK
.
adjustInto
(
date
,
j
);
assertEquals
(
adjusted
.
get
(
DAY_OF_WEEK
),
j
);
assertEquals
(
adjusted
.
get
(
weekField
),
week
);
assertEquals
(
adjusted
.
get
(
yearField
),
wby
);
}
if
(
dow
==
7
)
{
dow
=
1
;
week
++;
}
else
{
dow
++;
}
if
(
week
>
wbyLen
(
wby
))
{
week
=
1
;
wby
++;
}
date
=
date
.
plusDays
(
1
);
}
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_adjustInto_week
(
TemporalField
weekField
,
TemporalField
yearField
)
{
// tests every day from 2012 to 2016 inclusive
LocalDate
date
=
LocalDate
.
of
(
2012
,
1
,
2
);
int
wby
=
2012
;
int
week
=
1
;
int
dow
=
1
;
for
(
int
i
=
1
;
i
<=
((
52
+
52
+
52
+
53
+
52
)
*
7
);
i
++)
{
int
weeksInYear
=
(
wby
==
2015
?
53
:
52
);
for
(
int
j
=
1
;
j
<=
weeksInYear
;
j
++)
{
LocalDate
adjusted
=
weekField
.
adjustInto
(
date
,
j
);
assertEquals
(
adjusted
.
get
(
weekField
),
j
);
assertEquals
(
adjusted
.
get
(
DAY_OF_WEEK
),
dow
);
assertEquals
(
adjusted
.
get
(
yearField
),
wby
);
}
if
(
dow
==
7
)
{
dow
=
1
;
week
++;
}
else
{
dow
++;
}
if
(
week
>
wbyLen
(
wby
))
{
week
=
1
;
wby
++;
}
date
=
date
.
plusDays
(
1
);
}
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_adjustInto_wby
(
TemporalField
weekField
,
TemporalField
yearField
)
{
// tests every day from 2012 to 2016 inclusive
LocalDate
date
=
LocalDate
.
of
(
2012
,
1
,
2
);
int
wby
=
2012
;
int
week
=
1
;
int
dow
=
1
;
for
(
int
i
=
1
;
i
<=
((
52
+
52
+
52
+
53
+
52
)
*
7
);
i
++)
{
for
(
int
j
=
2004
;
j
<=
2015
;
j
++)
{
LocalDate
adjusted
=
yearField
.
adjustInto
(
date
,
j
);
assertEquals
(
adjusted
.
get
(
yearField
),
j
);
assertEquals
(
adjusted
.
get
(
DAY_OF_WEEK
),
dow
);
assertEquals
(
adjusted
.
get
(
weekField
),
(
week
==
53
&&
wbyLen
(
j
)
==
52
?
52
:
week
),
""
+
date
+
" "
+
adjusted
);
}
if
(
dow
==
7
)
{
dow
=
1
;
week
++;
}
else
{
dow
++;
}
if
(
week
>
wbyLen
(
wby
))
{
week
=
1
;
wby
++;
}
date
=
date
.
plusDays
(
1
);
}
}
@Test
(
dataProvider
=
"fields"
)
public
void
test_addTo_weekBasedYears
(
TemporalField
weekField
,
TemporalField
yearField
)
{
// tests every day from 2012 to 2016 inclusive
LocalDate
date
=
LocalDate
.
of
(
2012
,
1
,
2
);
int
wby
=
2012
;
int
week
=
1
;
int
dow
=
1
;
for
(
int
i
=
1
;
i
<=
((
52
+
52
+
52
+
53
+
52
)
*
7
);
i
++)
{
for
(
int
j
=
-
5
;
j
<=
5
;
j
++)
{
LocalDate
adjusted
=
IsoFields
.
WEEK_BASED_YEARS
.
addTo
(
date
,
j
);
assertEquals
(
adjusted
.
get
(
yearField
),
wby
+
j
);
assertEquals
(
adjusted
.
get
(
DAY_OF_WEEK
),
dow
);
assertEquals
(
adjusted
.
get
(
weekField
),
(
week
==
53
&&
wbyLen
(
wby
+
j
)
==
52
?
52
:
week
),
""
+
date
+
" "
+
adjusted
);
}
if
(
dow
==
7
)
{
dow
=
1
;
week
++;
}
else
{
dow
++;
}
if
(
week
>
wbyLen
(
wby
))
{
week
=
1
;
wby
++;
}
date
=
date
.
plusDays
(
1
);
}
}
private
int
wbyLen
(
int
wby
)
{
return
(
wby
==
2004
||
wby
==
2009
||
wby
==
2015
||
wby
==
2020
?
53
:
52
);
}
}
test/javax/swing/JComboBox/8019180/Test8019180.java
0 → 100644
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2014, 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.
*/
import
java.util.concurrent.CountDownLatch
;
import
javax.swing.JComboBox
;
import
javax.swing.JFrame
;
import
javax.swing.SwingUtilities
;
/*
* @test
* @bug 8019180
* @summary Tests that combobox works if it is used as action listener
* @author Sergey Malenkov
*/
public
class
Test8019180
implements
Runnable
{
private
static
final
CountDownLatch
LATCH
=
new
CountDownLatch
(
1
);
private
static
final
String
[]
ITEMS
=
{
"First"
,
"Second"
,
"Third"
,
"Fourth"
};
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
{
SwingUtilities
.
invokeLater
(
new
Test8019180
());
LATCH
.
await
();
}
private
JComboBox
<
String
>
test
;
@Override
public
void
run
()
{
if
(
this
.
test
==
null
)
{
this
.
test
=
new
JComboBox
<>(
ITEMS
);
this
.
test
.
addActionListener
(
this
.
test
);
JFrame
frame
=
new
JFrame
();
frame
.
add
(
test
);
frame
.
pack
();
frame
.
setVisible
(
true
);
SwingUtilities
.
invokeLater
(
this
);
}
else
{
int
index
=
this
.
test
.
getSelectedIndex
();
this
.
test
.
setSelectedIndex
(
1
+
index
);
if
(
0
>
this
.
test
.
getSelectedIndex
())
{
System
.
err
.
println
(
"ERROR: no selection"
);
System
.
exit
(
8019180
);
}
SwingUtilities
.
getWindowAncestor
(
this
.
test
).
dispose
();
LATCH
.
countDown
();
}
}
}
test/javax/swing/JTabbedPane/8007563/Test8007563.java
0 → 100644
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2014, 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.
*/
import
java.awt.Color
;
import
java.awt.Point
;
import
java.awt.Robot
;
import
java.util.ArrayList
;
import
java.util.concurrent.CountDownLatch
;
import
javax.swing.JFrame
;
import
javax.swing.JLabel
;
import
javax.swing.JTabbedPane
;
import
static
javax
.
swing
.
UIManager
.*;
import
static
javax
.
swing
.
SwingUtilities
.*;
/*
* @test
* @bug 8007563
* @summary Tests JTabbedPane background
* @author Sergey Malenkov
*/
public
class
Test8007563
implements
Runnable
{
private
static
final
ArrayList
<
String
>
LIST
=
new
ArrayList
<>();
private
static
final
LookAndFeelInfo
[]
INFO
=
getInstalledLookAndFeels
();
private
static
final
CountDownLatch
LATCH
=
new
CountDownLatch
(
INFO
.
length
);
private
static
Robot
ROBOT
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ROBOT
=
new
Robot
();
invokeLater
(
new
Test8007563
());
LATCH
.
await
();
if
(!
LIST
.
isEmpty
())
{
throw
new
Error
(
LIST
.
toString
());
}
}
private
static
void
addOpaqueError
(
boolean
opaque
)
{
LIST
.
add
(
getLookAndFeel
().
getName
()
+
" opaque="
+
opaque
);
}
private
static
boolean
updateLookAndFeel
()
{
int
index
=
(
int
)
LATCH
.
getCount
()
-
1
;
if
(
index
>=
0
)
{
try
{
LookAndFeelInfo
info
=
INFO
[
index
];
System
.
err
.
println
(
"L&F: "
+
info
.
getName
());
setLookAndFeel
(
info
.
getClassName
());
return
true
;
}
catch
(
Exception
exception
)
{
exception
.
printStackTrace
();
}
}
return
false
;
}
private
JFrame
frame
;
private
JTabbedPane
pane
;
public
void
run
()
{
if
(
this
.
frame
==
null
)
{
if
(!
updateLookAndFeel
())
{
return
;
}
this
.
pane
=
new
JTabbedPane
();
this
.
pane
.
setOpaque
(
false
);
this
.
pane
.
setBackground
(
Color
.
RED
);
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
this
.
pane
.
addTab
(
"Tab "
+
i
,
new
JLabel
(
"Content area "
+
i
));
}
this
.
frame
=
new
JFrame
(
getClass
().
getSimpleName
());
this
.
frame
.
getContentPane
().
setBackground
(
Color
.
BLUE
);
this
.
frame
.
add
(
this
.
pane
);
this
.
frame
.
setDefaultCloseOperation
(
JFrame
.
DISPOSE_ON_CLOSE
);
this
.
frame
.
setSize
(
400
,
200
);
this
.
frame
.
setLocationRelativeTo
(
null
);
this
.
frame
.
setVisible
(
true
);
}
else
{
Point
point
=
new
Point
(
this
.
pane
.
getWidth
()
-
2
,
2
);
convertPointToScreen
(
point
,
this
.
pane
);
Color
actual
=
ROBOT
.
getPixelColor
(
point
.
x
,
point
.
y
);
boolean
opaque
=
this
.
pane
.
isOpaque
();
Color
expected
=
opaque
?
this
.
pane
.
getBackground
()
:
this
.
frame
.
getContentPane
().
getBackground
();
if
(!
expected
.
equals
(
actual
)){
addOpaqueError
(
opaque
);
}
if
(!
opaque
)
{
this
.
pane
.
setOpaque
(
true
);
this
.
pane
.
repaint
();
}
else
{
this
.
frame
.
dispose
();
this
.
frame
=
null
;
this
.
pane
=
null
;
LATCH
.
countDown
();
}
}
invokeLater
(
this
);
}
}
test/javax/xml/ws/8043129/MailTest.java
0 → 100644
浏览文件 @
ea3cbca9
/*
* Copyright (c) 2014, 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 8043129
* @summary JAF initialisation in SAAJ clashing with the one in javax.mail
* @author mkos
* @library javax.mail.jar
* @build MailTest
* @run main MailTest
*/
import
javax.activation.CommandMap
;
import
javax.activation.MailcapCommandMap
;
import
javax.mail.BodyPart
;
import
javax.mail.Message
;
import
javax.mail.MessagingException
;
import
javax.mail.Multipart
;
import
javax.mail.Session
;
import
javax.mail.internet.InternetAddress
;
import
javax.mail.internet.MimeBodyPart
;
import
javax.mail.internet.MimeMessage
;
import
javax.mail.internet.MimeMultipart
;
import
javax.xml.soap.AttachmentPart
;
import
javax.xml.soap.MessageFactory
;
import
javax.xml.soap.SOAPException
;
import
javax.xml.soap.SOAPMessage
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.util.Properties
;
public
class
MailTest
{
String
host
=
null
;
String
user
=
""
;
String
password
=
null
;
String
from
=
null
;
String
to
=
null
;
public
static
void
main
(
String
[]
args
)
{
MailTest
t
=
new
MailTest
();
t
.
user
=
"somebody@somewhere.com"
;
t
.
from
=
"somebody@somewhere.com"
;
t
.
to
=
"somebody@somewhere.com"
;
t
.
user
=
"somebody@somewhere.com"
;
t
.
password
=
"somepassword"
;
t
.
host
=
"somehost"
;
t
.
sendMail
();
//this works
t
.
addSoapAttachement
();
t
.
sendMail
();
//after addAttachmentPart to soapmessage it do not work
// workaroundJAFSetup();
// t.sendMail(); //after workaround works again
}
void
addSoapAttachement
()
{
try
{
MessageFactory
messageFactory
=
MessageFactory
.
newInstance
();
SOAPMessage
message
=
messageFactory
.
createMessage
();
AttachmentPart
a
=
message
.
createAttachmentPart
();
a
.
setContentType
(
"binary/octet-stream"
);
message
.
addAttachmentPart
(
a
);
}
catch
(
SOAPException
e
)
{
e
.
printStackTrace
();
}
}
void
sendMail
()
{
try
{
Properties
props
=
new
Properties
();
props
.
put
(
"mail.smtp.host"
,
host
);
props
.
put
(
"mail.smtp.auth"
,
"true"
);
Session
session
=
Session
.
getInstance
(
props
);
session
.
setDebug
(
true
);
// Define message
MimeMessage
message
=
new
MimeMessage
(
session
);
message
.
setFrom
(
new
InternetAddress
(
from
));
message
.
addRecipients
(
Message
.
RecipientType
.
TO
,
to
);
message
.
setSubject
(
"this is a multipart test"
);
Multipart
multipart
=
new
MimeMultipart
();
BodyPart
messageBodyPart1
=
new
MimeBodyPart
();
messageBodyPart1
.
setText
(
"please send also this Content\n ciao!"
);
multipart
.
addBodyPart
(
messageBodyPart1
);
BodyPart
messageBodyPart2
=
new
MimeBodyPart
();
messageBodyPart2
.
setContent
(
"<b>please</b> send also this Content <br>ciao!"
,
"text/html; charset=UTF-8"
);
multipart
.
addBodyPart
(
messageBodyPart2
);
message
.
setContent
(
multipart
);
/*
Transport tr = session.getTransport("smtp");
tr.connect(host,user, password);
tr.sendMessage(message,InternetAddress.parse(to));
tr.close();
*/
ByteArrayOutputStream
baos
=
new
ByteArrayOutputStream
();
message
.
writeTo
(
baos
);
String
output
=
baos
.
toString
();
System
.
out
.
println
(
"output = "
+
output
);
if
(
output
.
contains
(
"also this Content"
))
{
System
.
out
.
println
(
"Test PASSED."
);
}
else
{
System
.
out
.
println
(
"Test FAILED, missing content."
);
throw
new
IllegalStateException
(
"Test FAILED, missing content."
);
}
}
catch
(
MessagingException
ignored
)
{
}
catch
(
IOException
ignored
)
{
}
}
// this is how the error can be worked around ...
static
void
workaroundJAFSetup
()
{
MailcapCommandMap
mailMap
=
(
MailcapCommandMap
)
CommandMap
.
getDefaultCommandMap
();
mailMap
.
addMailcap
(
"multipart/mixed;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed"
);
}
}
test/javax/xml/ws/8043129/javax.mail.jar
0 → 100644
浏览文件 @
ea3cbca9
文件已添加
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录