@@ -40,8 +40,8 @@ void catchException() {
4040 import java.net.SocketAddress;
4141 import java.nio.channels.DatagramChannel;
4242
43- public class Test {
44- public void sendDataCatch() {
43+ class Test {
44+ void sendDataCatch() {
4545 try {
4646 DatagramChannel channel = DatagramChannel.open();
4747 channel.send(ByteBuffer.allocate(1024), new java.net.InetSocketAddress("localhost", 8080));
@@ -53,11 +53,12 @@ public void sendDataCatch() {
5353 """ ,
5454 """
5555 import java.nio.ByteBuffer;
56+ import java.nio.channels.AlreadyConnectedException;
5657 import java.net.SocketAddress;
5758 import java.nio.channels.DatagramChannel;
5859
59- public class Test {
60- public void sendDataCatch() {
60+ class Test {
61+ void sendDataCatch() {
6162 try {
6263 DatagramChannel channel = DatagramChannel.open();
6364 channel.send(ByteBuffer.allocate(1024), new java.net.InetSocketAddress("localhost", 8080));
@@ -81,8 +82,8 @@ void rethrowException() {
8182 import java.net.SocketAddress;
8283 import java.nio.channels.DatagramChannel;
8384
84- public class Test {
85- public void sendDataRethrow() {
85+ class Test {
86+ void sendDataRethrow() {
8687 try {
8788 DatagramChannel channel = DatagramChannel.open();
8889 channel.send(ByteBuffer.allocate(1024), new java.net.InetSocketAddress("localhost", 8080));
@@ -94,11 +95,12 @@ public void sendDataRethrow() {
9495 """ ,
9596 """
9697 import java.nio.ByteBuffer;
98+ import java.nio.channels.AlreadyConnectedException;
9799 import java.net.SocketAddress;
98100 import java.nio.channels.DatagramChannel;
99101
100- public class Test {
101- public void sendDataRethrow() {
102+ class Test {
103+ void sendDataRethrow() {
102104 try {
103105 DatagramChannel channel = DatagramChannel.open();
104106 channel.send(ByteBuffer.allocate(1024), new java.net.InetSocketAddress("localhost", 8080));
@@ -118,12 +120,13 @@ void retainOtherCaughtExceptions() {
118120 //language=java
119121 java (
120122 """
121- import java.io.IOException;import java.nio.ByteBuffer;
123+ import java.io.IOException;
124+ import java.nio.ByteBuffer;
122125 import java.net.SocketAddress;
123126 import java.nio.channels.DatagramChannel;
124127
125- public class Test {
126- public void sendData() {
128+ class Test {
129+ void sendData() {
127130 try {
128131 DatagramChannel channel = DatagramChannel.open();
129132 channel.send(ByteBuffer.allocate(1024), new java.net.InetSocketAddress("localhost", 8080));
0 commit comments