Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
ac03c625
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看板
提交
ac03c625
编写于
8月 25, 2008
作者:
W
wetmore
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
7181e3a9
ea0c561a
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
191 addition
and
44 deletion
+191
-44
make/java/net/mapfile-vers
make/java/net/mapfile-vers
+1
-1
src/share/classes/java/net/NetworkInterface.java
src/share/classes/java/net/NetworkInterface.java
+23
-7
src/share/classes/java/net/ServerSocket.java
src/share/classes/java/net/ServerSocket.java
+24
-12
src/share/classes/javax/net/ssl/SSLServerSocket.java
src/share/classes/javax/net/ssl/SSLServerSocket.java
+16
-10
src/share/classes/sun/security/util/DerIndefLenConverter.java
...share/classes/sun/security/util/DerIndefLenConverter.java
+13
-2
src/solaris/native/java/net/NetworkInterface.c
src/solaris/native/java/net/NetworkInterface.c
+2
-2
src/solaris/native/java/net/PlainDatagramSocketImpl.c
src/solaris/native/java/net/PlainDatagramSocketImpl.c
+1
-1
src/windows/native/java/net/NetworkInterface.c
src/windows/native/java/net/NetworkInterface.c
+5
-5
src/windows/native/java/net/NetworkInterface_winXP.c
src/windows/native/java/net/NetworkInterface_winXP.c
+2
-2
src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
...indows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
+1
-1
src/windows/native/java/net/net_util_md.h
src/windows/native/java/net/net_util_md.h
+1
-1
test/java/net/NetworkInterface/IndexTest.java
test/java/net/NetworkInterface/IndexTest.java
+58
-0
test/sun/security/util/DerValue/Indefinite.java
test/sun/security/util/DerValue/Indefinite.java
+44
-0
未找到文件。
make/java/net/mapfile-vers
浏览文件 @
ac03c625
...
@@ -57,7 +57,7 @@ SUNWprivate_1.1 {
...
@@ -57,7 +57,7 @@ SUNWprivate_1.1 {
Java_java_net_Inet6AddressImpl_isReachable0;
Java_java_net_Inet6AddressImpl_isReachable0;
Java_java_net_NetworkInterface_init;
Java_java_net_NetworkInterface_init;
Java_java_net_NetworkInterface_getByName0;
Java_java_net_NetworkInterface_getByName0;
Java_java_net_NetworkInterface_getByIndex;
Java_java_net_NetworkInterface_getByIndex
0
;
Java_java_net_NetworkInterface_getByInetAddress0;
Java_java_net_NetworkInterface_getByInetAddress0;
Java_java_net_NetworkInterface_getAll;
Java_java_net_NetworkInterface_getAll;
Java_java_net_NetworkInterface_isUp0;
Java_java_net_NetworkInterface_isUp0;
...
...
src/share/classes/java/net/NetworkInterface.java
浏览文件 @
ac03c625
...
@@ -203,11 +203,17 @@ public final class NetworkInterface {
...
@@ -203,11 +203,17 @@ public final class NetworkInterface {
}
}
/**
/**
* Get the index of this network interface.
* Returns the index of this network interface. The index is an integer greater
* or equal to zero, or {@code -1} for unknown. This is a system specific value
* and interfaces with the same name can have different indexes on different
* machines.
*
*
* @return the index of this network interface
* @return the index of this network interface or {@code -1} if the index is
* unknown
* @see #getByIndex(int)
* @since 1.7
*/
*/
int
getIndex
()
{
public
int
getIndex
()
{
return
index
;
return
index
;
}
}
...
@@ -249,11 +255,18 @@ public final class NetworkInterface {
...
@@ -249,11 +255,18 @@ public final class NetworkInterface {
* Get a network interface given its index.
* Get a network interface given its index.
*
*
* @param index an integer, the index of the interface
* @param index an integer, the index of the interface
* @return the NetworkInterface obtained from its index
* @return the NetworkInterface obtained from its index, or {@code null} if
* @exception SocketException if an I/O error occurs.
* there is no interface with such an index on the system
* @throws SocketException if an I/O error occurs.
* @throws IllegalArgumentException if index has a negative value
* @see #getIndex()
* @since 1.7
*/
*/
native
static
NetworkInterface
getByIndex
(
int
index
)
public
static
NetworkInterface
getByIndex
(
int
index
)
throws
SocketException
{
throws
SocketException
;
if
(
index
<
0
)
throw
new
IllegalArgumentException
(
"Interface index can't be negative"
);
return
getByIndex0
(
index
);
}
/**
/**
* Convenience method to search for a network interface that
* Convenience method to search for a network interface that
...
@@ -325,6 +338,9 @@ public final class NetworkInterface {
...
@@ -325,6 +338,9 @@ public final class NetworkInterface {
private
native
static
NetworkInterface
getByName0
(
String
name
)
private
native
static
NetworkInterface
getByName0
(
String
name
)
throws
SocketException
;
throws
SocketException
;
private
native
static
NetworkInterface
getByIndex0
(
int
index
)
throws
SocketException
;
private
native
static
NetworkInterface
getByInetAddress0
(
InetAddress
addr
)
private
native
static
NetworkInterface
getByInetAddress0
(
InetAddress
addr
)
throws
SocketException
;
throws
SocketException
;
...
...
src/share/classes/java/net/ServerSocket.java
浏览文件 @
ac03c625
...
@@ -142,14 +142,18 @@ class ServerSocket implements java.io.Closeable {
...
@@ -142,14 +142,18 @@ class ServerSocket implements java.io.Closeable {
* as its argument to ensure the operation is allowed.
* as its argument to ensure the operation is allowed.
* This could result in a SecurityException.
* This could result in a SecurityException.
*
*
* <P>The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed is equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
*
*
* @param port the port number, or <code>0</code> to use a port
* @param port the port number, or <code>0</code> to use a port
* number that is automatically allocated.
* number that is automatically allocated.
* @param backlog the maximum length of the queue.
* @param backlog requested maximum length of the queue of incoming
* connections.
*
*
* @exception IOException if an I/O error occurs when opening the socket.
* @exception IOException if an I/O error occurs when opening the socket.
* @exception SecurityException
* @exception SecurityException
...
@@ -187,13 +191,17 @@ class ServerSocket implements java.io.Closeable {
...
@@ -187,13 +191,17 @@ class ServerSocket implements java.io.Closeable {
* as its argument to ensure the operation is allowed.
* as its argument to ensure the operation is allowed.
* This could result in a SecurityException.
* This could result in a SecurityException.
*
*
* <P>The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed is equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
* @param port the port number, or <code>0</code> to use a port
* @param port the port number, or <code>0</code> to use a port
* number that is automatically allocated.
* number that is automatically allocated.
* @param backlog the listen backlog
* @param backlog requested maximum length of the queue of incoming
* connections.
* @param bindAddr the local InetAddress the server will bind to
* @param bindAddr the local InetAddress the server will bind to
*
*
* @throws SecurityException if a security manager exists and
* @throws SecurityException if a security manager exists and
...
@@ -321,11 +329,15 @@ class ServerSocket implements java.io.Closeable {
...
@@ -321,11 +329,15 @@ class ServerSocket implements java.io.Closeable {
* If the address is <code>null</code>, then the system will pick up
* If the address is <code>null</code>, then the system will pick up
* an ephemeral port and a valid local address to bind the socket.
* an ephemeral port and a valid local address to bind the socket.
* <P>
* <P>
* The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed is equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* @param endpoint The IP address & port number to bind to.
* @param endpoint The IP address & port number to bind to.
* @param backlog The listen backlog length.
* @param backlog requested maximum length of the queue of
* incoming connections.
* @throws IOException if the bind operation fails, or if the socket
* @throws IOException if the bind operation fails, or if the socket
* is already bound.
* is already bound.
* @throws SecurityException if a <code>SecurityManager</code> is present and
* @throws SecurityException if a <code>SecurityManager</code> is present and
...
...
src/share/classes/javax/net/ssl/SSLServerSocket.java
浏览文件 @
ac03c625
...
@@ -108,9 +108,12 @@ public abstract class SSLServerSocket extends ServerSocket
...
@@ -108,9 +108,12 @@ public abstract class SSLServerSocket extends ServerSocket
* <P>
* <P>
* A port number of <code>0</code> creates a socket on any free port.
* A port number of <code>0</code> creates a socket on any free port.
* <P>
* <P>
* The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed if equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
* If there is a security manager, its <code>checkListen</code>
* If there is a security manager, its <code>checkListen</code>
* method is called with the <code>port</code> argument as its
* method is called with the <code>port</code> argument as its
...
@@ -118,8 +121,8 @@ public abstract class SSLServerSocket extends ServerSocket
...
@@ -118,8 +121,8 @@ public abstract class SSLServerSocket extends ServerSocket
* in a SecurityException.
* in a SecurityException.
*
*
* @param port the port on which to listen
* @param port the port on which to listen
* @param backlog
how many connections may be pending before
* @param backlog
requested maximum length of the queue of incoming
*
the system should start rejecting new requests
*
connections.
* @throws IOException if an I/O error occurs when creating the socket
* @throws IOException if an I/O error occurs when creating the socket
* @throws SecurityException if a security manager exists and its
* @throws SecurityException if a security manager exists and its
* <code>checkListen</code> method doesn't allow the operation.
* <code>checkListen</code> method doesn't allow the operation.
...
@@ -150,16 +153,19 @@ public abstract class SSLServerSocket extends ServerSocket
...
@@ -150,16 +153,19 @@ public abstract class SSLServerSocket extends ServerSocket
* <P>
* <P>
* A port number of <code>0</code> creates a socket on any free port.
* A port number of <code>0</code> creates a socket on any free port.
* <P>
* <P>
* <P>The <code>backlog</code> argument must be a positive
* The <code>backlog</code> argument is the requested maximum number of
* value greater than 0. If the value passed if equal or less
* pending connections on the socket. Its exact semantics are implementation
* than 0, then the default value will be assumed.
* specific. In particular, an implementation may impose a maximum length
* or may choose to ignore the parameter altogther. The value provided
* should be greater than <code>0</code>. If it is less than or equal to
* <code>0</code>, then an implementation specific default will be used.
* <P>
* <P>
* If <i>address</i> is null, it will default accepting connections
* If <i>address</i> is null, it will default accepting connections
* on any/all local addresses.
* on any/all local addresses.
*
*
* @param port the port on which to listen
* @param port the port on which to listen
* @param backlog
how many connections may be pending before
* @param backlog
requested maximum length of the queue of incoming
*
the system should start rejecting new requests
*
connections.
* @param address the address of the network interface through
* @param address the address of the network interface through
* which connections will be accepted
* which connections will be accepted
* @throws IOException if an I/O error occurs when creating the socket
* @throws IOException if an I/O error occurs when creating the socket
...
...
src/share/classes/sun/security/util/DerIndefLenConverter.java
浏览文件 @
ac03c625
/*
/*
* Copyright 1998-200
6
Sun Microsystems, Inc. All Rights Reserved.
* Copyright 1998-200
8
Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
*
* This code is free software; you can redistribute it and/or modify it
* This code is free software; you can redistribute it and/or modify it
...
@@ -50,6 +50,7 @@ class DerIndefLenConverter {
...
@@ -50,6 +50,7 @@ class DerIndefLenConverter {
private
byte
[]
data
,
newData
;
private
byte
[]
data
,
newData
;
private
int
newDataPos
,
dataPos
,
dataSize
,
index
;
private
int
newDataPos
,
dataPos
,
dataSize
,
index
;
private
int
unresolved
=
0
;
private
ArrayList
<
Object
>
ndefsList
=
new
ArrayList
<
Object
>();
private
ArrayList
<
Object
>
ndefsList
=
new
ArrayList
<
Object
>();
...
@@ -113,6 +114,7 @@ class DerIndefLenConverter {
...
@@ -113,6 +114,7 @@ class DerIndefLenConverter {
numOfEncapsulatedLenBytes
;
numOfEncapsulatedLenBytes
;
byte
[]
sectionLenBytes
=
getLengthBytes
(
sectionLen
);
byte
[]
sectionLenBytes
=
getLengthBytes
(
sectionLen
);
ndefsList
.
set
(
index
,
sectionLenBytes
);
ndefsList
.
set
(
index
,
sectionLenBytes
);
unresolved
--;
// Add the number of bytes required to represent this section
// Add the number of bytes required to represent this section
// to the total number of length bytes,
// to the total number of length bytes,
...
@@ -149,6 +151,7 @@ class DerIndefLenConverter {
...
@@ -149,6 +151,7 @@ class DerIndefLenConverter {
int
lenByte
=
data
[
dataPos
++]
&
0xff
;
int
lenByte
=
data
[
dataPos
++]
&
0xff
;
if
(
isIndefinite
(
lenByte
))
{
if
(
isIndefinite
(
lenByte
))
{
ndefsList
.
add
(
new
Integer
(
dataPos
));
ndefsList
.
add
(
new
Integer
(
dataPos
));
unresolved
++;
return
curLen
;
return
curLen
;
}
}
if
(
isLongForm
(
lenByte
))
{
if
(
isLongForm
(
lenByte
))
{
...
@@ -308,15 +311,21 @@ class DerIndefLenConverter {
...
@@ -308,15 +311,21 @@ class DerIndefLenConverter {
dataPos
=
0
;
index
=
0
;
dataPos
=
0
;
index
=
0
;
dataSize
=
data
.
length
;
dataSize
=
data
.
length
;
int
len
=
0
;
int
len
=
0
;
int
unused
=
0
;
// parse and set up the vectors of all the indefinite-lengths
// parse and set up the vectors of all the indefinite-lengths
while
(
dataPos
<
dataSize
)
{
while
(
dataPos
<
dataSize
)
{
parseTag
();
parseTag
();
len
=
parseLength
();
len
=
parseLength
();
parseValue
(
len
);
parseValue
(
len
);
if
(
unresolved
==
0
)
{
unused
=
dataSize
-
dataPos
;
dataSize
=
dataPos
;
break
;
}
}
}
newData
=
new
byte
[
dataSize
+
numOfTotalLenBytes
];
newData
=
new
byte
[
dataSize
+
numOfTotalLenBytes
+
unused
];
dataPos
=
0
;
newDataPos
=
0
;
index
=
0
;
dataPos
=
0
;
newDataPos
=
0
;
index
=
0
;
// write out the new byte array replacing all the indefinite-lengths
// write out the new byte array replacing all the indefinite-lengths
...
@@ -325,6 +334,8 @@ class DerIndefLenConverter {
...
@@ -325,6 +334,8 @@ class DerIndefLenConverter {
writeTag
();
writeTag
();
writeLengthAndValue
();
writeLengthAndValue
();
}
}
System
.
arraycopy
(
indefData
,
dataSize
,
newData
,
dataSize
+
numOfTotalLenBytes
,
unused
);
return
newData
;
return
newData
;
}
}
...
...
src/solaris/native/java/net/NetworkInterface.c
浏览文件 @
ac03c625
...
@@ -206,10 +206,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
...
@@ -206,10 +206,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
/*
/*
* Class: java_net_NetworkInterface
* Class: java_net_NetworkInterface
* Method: getByIndex
* Method: getByIndex
0
* Signature: (Ljava/lang/String;)Ljava/net/NetworkInterface;
* Signature: (Ljava/lang/String;)Ljava/net/NetworkInterface;
*/
*/
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
netif
*
ifs
,
*
curr
;
netif
*
ifs
,
*
curr
;
...
...
src/solaris/native/java/net/PlainDatagramSocketImpl.c
浏览文件 @
ac03c625
...
@@ -1741,7 +1741,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
...
@@ -1741,7 +1741,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, jint opt) {
* (for IF).
* (for IF).
*/
*/
if
(
index
>
0
)
{
if
(
index
>
0
)
{
ni
=
Java_java_net_NetworkInterface_getByIndex
(
env
,
ni_class
,
ni
=
Java_java_net_NetworkInterface_getByIndex
0
(
env
,
ni_class
,
index
);
index
);
if
(
ni
==
NULL
)
{
if
(
ni
==
NULL
)
{
char
errmsg
[
255
];
char
errmsg
[
255
];
...
...
src/windows/native/java/net/NetworkInterface.c
浏览文件 @
ac03c625
...
@@ -554,11 +554,11 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
...
@@ -554,11 +554,11 @@ Java_java_net_NetworkInterface_init(JNIEnv *env, jclass cls)
ni_childsID
=
(
*
env
)
->
GetFieldID
(
env
,
ni_class
,
"childs"
,
"[Ljava/net/NetworkInterface;"
);
ni_childsID
=
(
*
env
)
->
GetFieldID
(
env
,
ni_class
,
"childs"
,
"[Ljava/net/NetworkInterface;"
);
ni_ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_class
,
"<init>"
,
"()V"
);
ni_ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_class
,
"<init>"
,
"()V"
);
ni_iacls
=
(
*
env
)
->
FindClass
(
env
,
"
Ljava/net/InetAddress;
"
);
ni_iacls
=
(
*
env
)
->
FindClass
(
env
,
"
java/net/InetAddress
"
);
ni_iacls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_iacls
);
ni_iacls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_iacls
);
ni_iaAddr
=
(
*
env
)
->
GetFieldID
(
env
,
ni_iacls
,
"address"
,
"I"
);
ni_iaAddr
=
(
*
env
)
->
GetFieldID
(
env
,
ni_iacls
,
"address"
,
"I"
);
ni_ia4cls
=
(
*
env
)
->
FindClass
(
env
,
"
Ljava/net/Inet4Address;
"
);
ni_ia4cls
=
(
*
env
)
->
FindClass
(
env
,
"
java/net/Inet4Address
"
);
ni_ia4cls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_ia4cls
);
ni_ia4cls
=
(
*
env
)
->
NewGlobalRef
(
env
,
ni_ia4cls
);
ni_ia4Ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_ia4cls
,
"<init>"
,
"()V"
);
ni_ia4Ctor
=
(
*
env
)
->
GetMethodID
(
env
,
ni_ia4cls
,
"<init>"
,
"()V"
);
...
@@ -762,17 +762,17 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
...
@@ -762,17 +762,17 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0
/*
/*
* Class: NetworkInterface
* Class: NetworkInterface
* Method: getByIndex
* Method: getByIndex
0
* Signature: (I)LNetworkInterface;
* Signature: (I)LNetworkInterface;
*/
*/
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
{
netif
*
ifList
,
*
curr
;
netif
*
ifList
,
*
curr
;
jobject
netifObj
=
NULL
;
jobject
netifObj
=
NULL
;
if
(
os_supports_ipv6
&&
ipv6_available
())
{
if
(
os_supports_ipv6
&&
ipv6_available
())
{
return
Java_java_net_NetworkInterface_getByIndex_XP
(
env
,
cls
,
index
);
return
Java_java_net_NetworkInterface_getByIndex
0
_XP
(
env
,
cls
,
index
);
}
}
/* get the list of interfaces */
/* get the list of interfaces */
...
...
src/windows/native/java/net/NetworkInterface_winXP.c
浏览文件 @
ac03c625
...
@@ -576,10 +576,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
...
@@ -576,10 +576,10 @@ JNIEXPORT jobject JNICALL Java_java_net_NetworkInterface_getByName0_XP
/*
/*
* Class: NetworkInterface
* Class: NetworkInterface
* Method: getByIndex
* Method: getByIndex
0_XP
* Signature: (I)LNetworkInterface;
* Signature: (I)LNetworkInterface;
*/
*/
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
_XP
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
)
{
{
netif
*
ifList
,
*
curr
;
netif
*
ifList
,
*
curr
;
...
...
src/windows/native/java/net/TwoStacksPlainDatagramSocketImpl.c
浏览文件 @
ac03c625
...
@@ -2090,7 +2090,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1, jint o
...
@@ -2090,7 +2090,7 @@ jobject getMulticastInterface(JNIEnv *env, jobject this, int fd, int fd1, jint o
* (for IF).
* (for IF).
*/
*/
if
(
index
>
0
)
{
if
(
index
>
0
)
{
ni
=
Java_java_net_NetworkInterface_getByIndex
(
env
,
ni_class
,
ni
=
Java_java_net_NetworkInterface_getByIndex
0
(
env
,
ni_class
,
index
);
index
);
if
(
ni
==
NULL
)
{
if
(
ni
==
NULL
)
{
char
errmsg
[
255
];
char
errmsg
[
255
];
...
...
src/windows/native/java/net/net_util_md.h
浏览文件 @
ac03c625
...
@@ -329,7 +329,7 @@ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
...
@@ -329,7 +329,7 @@ extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByName0_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByName0_XP
(
JNIEnv
*
env
,
jclass
cls
,
jstring
name
);
(
JNIEnv
*
env
,
jclass
cls
,
jstring
name
);
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByIndex
0
_XP
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
);
(
JNIEnv
*
env
,
jclass
cls
,
jint
index
);
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByInetAddress0_XP
JNIEXPORT
jobject
JNICALL
Java_java_net_NetworkInterface_getByInetAddress0_XP
...
...
test/java/net/NetworkInterface/IndexTest.java
0 → 100644
浏览文件 @
ac03c625
/*
* 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 6717876
* @summary Make java.net.NetworkInterface.getIndex() public
*/
import
java.net.*
;
import
java.util.Enumeration
;
public
class
IndexTest
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Enumeration
<
NetworkInterface
>
netifs
=
NetworkInterface
.
getNetworkInterfaces
();
NetworkInterface
nif
=
null
;
while
(
netifs
.
hasMoreElements
())
{
nif
=
netifs
.
nextElement
();
int
index
=
nif
.
getIndex
();
if
(
index
>=
0
)
{
NetworkInterface
nif2
=
NetworkInterface
.
getByIndex
(
index
);
if
(!
nif
.
equals
(
nif2
))
{
throw
new
RuntimeException
(
"both interfaces should be equal"
);
}
}
}
try
{
nif
=
NetworkInterface
.
getByIndex
(-
1
);
throw
new
RuntimeException
(
"Should have thrown IllegalArgumentException"
);
}
catch
(
IllegalArgumentException
e
)
{
// OK
}
// In all likelyhood, this interface should not exist.
nif
=
NetworkInterface
.
getByIndex
(
Integer
.
MAX_VALUE
-
1
);
if
(
nif
!=
null
)
{
throw
new
RuntimeException
(
"getByIndex() should have returned null"
);
}
}
}
test/sun/security/util/DerValue/Indefinite.java
0 → 100644
浏览文件 @
ac03c625
/*
* 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 6731685
* @summary CertificateFactory.generateCertificates throws IOException on PKCS7 cert chain
*/
import
java.io.*
;
import
sun.security.util.*
;
public
class
Indefinite
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
byte
[]
input
=
{
// An OCTET-STRING in 2 parts
4
,
(
byte
)
0x80
,
4
,
2
,
'a'
,
'b'
,
4
,
2
,
'c'
,
'd'
,
0
,
0
,
// Garbage follows, may be falsely recognized as EOC
0
,
0
,
0
,
0
};
new
DerValue
(
new
ByteArrayInputStream
(
input
));
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录