Explorar o código

* Fix java 8 syntax error in UdpEndpoint

shadowislord %!s(int64=11) %!d(string=hai) anos
pai
achega
f31911f039

+ 9 - 2
jme3-networking/src/main/java/com/jme3/network/kernel/udp/UdpEndpoint.java

@@ -38,6 +38,7 @@ import java.io.IOException;
 import java.net.DatagramPacket;
 import java.net.DatagramSocket;
 import java.net.SocketAddress;
+import java.net.SocketException;
 import java.nio.ByteBuffer;
 
 
@@ -127,8 +128,14 @@ public class UdpEndpoint implements Endpoint
             kernel.enqueueWrite( this, p );
                                                                
             //socket.send(p);
-        } catch( IOException e ) {
-            throw new KernelException( "Error sending datagram to:" + address, e );
+        } catch (Exception e) {
+            if (e instanceof SocketException) {
+                throw new KernelException("Error sending datagram to:" + address, e);
+            } else if (e instanceof RuntimeException) {
+                throw (RuntimeException) e;
+            } else {
+                throw new RuntimeException(e);
+            }
         }
     }