Mercurial > hg > icedtea7-forest-aarch64 > jdk
changeset 8205:ac3e9cfecb0f
8046588: test for SO_FLOW_SLA availability does not check for EACCESS
8047187: Test jdk/net/Sockets/Test.java fails to compile after fix JDK-8046588
Reviewed-by: chegar
author | coffeys |
---|---|
date | Fri, 03 Oct 2014 16:52:05 +0100 |
parents | bc74fab441be |
children | b8bcafe8f811 |
files | src/solaris/native/java/net/ExtendedOptionsImpl.c test/jdk/net/Sockets/Test.java |
diffstat | 2 files changed, 82 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/solaris/native/java/net/ExtendedOptionsImpl.c Tue Jan 14 06:41:10 2014 -0800 +++ b/src/solaris/native/java/net/ExtendedOptionsImpl.c Fri Oct 03 16:52:05 2014 +0100 @@ -215,6 +215,9 @@ if (errno == ENOPROTOOPT) { JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "unsupported socket option"); + } else if (errno == EACCES || errno == EPERM) { + NET_ERROR(env, JNU_JAVANETPKG "SocketException", + "Permission denied"); } else { NET_ERROR(env, JNU_JAVANETPKG "SocketException", "set option SO_FLOW_SLA failed"); @@ -247,6 +250,9 @@ if (errno == ENOPROTOOPT) { JNU_ThrowByName(env, "java/lang/UnsupportedOperationException", "unsupported socket option"); + } else if (errno == EACCES || errno == EPERM) { + NET_ERROR(env, JNU_JAVANETPKG "SocketException", + "Permission denied"); } else { NET_ERROR(env, JNU_JAVANETPKG "SocketException", "set option SO_FLOW_SLA failed");
--- a/test/jdk/net/Sockets/Test.java Tue Jan 14 06:41:10 2014 -0800 +++ b/test/jdk/net/Sockets/Test.java Fri Oct 03 16:52:05 2014 +0100 @@ -30,8 +30,10 @@ */ import java.net.*; +import java.io.IOException; import java.nio.channels.*; import java.util.concurrent.*; +import java.util.Set; import jdk.net.*; public class Test { @@ -77,6 +79,16 @@ DatagramSocket dg = new DatagramSocket(0); udp_port = dg.getLocalPort(); + // If option not available, end test + Set<SocketOption<?>> options = Sockets.supportedOptions( + DatagramSocket.class + ); + + if (!options.contains(ExtendedSocketOptions.SO_FLOW_SLA)) { + System.out.println("SO_FLOW_SLA not supported"); + return; + } + s = new Socket("127.0.0.1", tcp_port); sc = SocketChannel.open(); sc.connect (new InetSocketAddress("127.0.0.1", tcp_port)); @@ -125,7 +137,14 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } static void doTest2() throws Exception { @@ -138,7 +157,14 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } static void doTest3() throws Exception { @@ -151,7 +177,14 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } static void doTest4() throws Exception { @@ -164,7 +197,14 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } static void doTest5() throws Exception { @@ -179,7 +219,14 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } static void doTest6() throws Exception { @@ -195,7 +242,14 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } static void doTest7() throws Exception { @@ -210,7 +264,14 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } static void doTest8() throws Exception { @@ -226,6 +287,13 @@ if (success) { throw new RuntimeException("Test failed"); } - } catch (UnsupportedOperationException e) {} + } catch (UnsupportedOperationException e) { + System.out.println (e); + } catch (IOException e) { + // Probably a permission error, but we're not + // going to check unless a specific permission exception + // is defined. + System.out.println (e); + } } }