summaryrefslogtreecommitdiffstats
path: root/java/com/tigervnc/network
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2012-12-16 20:35:39 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2012-12-16 20:35:39 +0000
commit504d98fcaa0c9571e3fb011947fa1a1e1d263237 (patch)
treec1297c2f593f6871e2f9e9e77c12994b98e9ac0d /java/com/tigervnc/network
parentd93a26d665b18b0e779c524f54c7acdc18898b94 (diff)
downloadtigervnc-504d98fcaa0c9571e3fb011947fa1a1e1d263237.tar.gz
tigervnc-504d98fcaa0c9571e3fb011947fa1a1e1d263237.zip
Make exception handling more user friendly. Not all exceptions are 'errors' (for example, exiting the server intentionally via the window manager's logoff button).
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5021 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/com/tigervnc/network')
-rw-r--r--java/com/tigervnc/network/SocketDescriptor.java24
-rw-r--r--java/com/tigervnc/network/TcpListener.java6
-rw-r--r--java/com/tigervnc/network/TcpSocket.java6
3 files changed, 18 insertions, 18 deletions
diff --git a/java/com/tigervnc/network/SocketDescriptor.java b/java/com/tigervnc/network/SocketDescriptor.java
index 4c5a23af..22f0a3d8 100644
--- a/java/com/tigervnc/network/SocketDescriptor.java
+++ b/java/com/tigervnc/network/SocketDescriptor.java
@@ -39,13 +39,13 @@ public class SocketDescriptor implements FileDescriptor {
writeSelector = Selector.open();
readSelector = Selector.open();
} catch (IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
try {
channel.register(writeSelector, SelectionKey.OP_WRITE);
channel.register(readSelector, SelectionKey.OP_READ);
} catch (java.nio.channels.ClosedChannelException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
}
@@ -54,7 +54,7 @@ public class SocketDescriptor implements FileDescriptor {
channel.socket().shutdownInput();
channel.socket().shutdownOutput();
} catch(IOException e) {
- throw new IOException(e.toString());
+ throw new IOException(e.getMessage());
}
}
@@ -62,7 +62,7 @@ public class SocketDescriptor implements FileDescriptor {
try {
channel.close();
} catch(IOException e) {
- throw new IOException(e.toString());
+ throw new IOException(e.getMessage());
}
}
@@ -80,7 +80,7 @@ public class SocketDescriptor implements FileDescriptor {
try {
n = channel.read(b);
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
if (n <= 0)
return (n == 0) ? -1 : 0;
@@ -99,7 +99,7 @@ public class SocketDescriptor implements FileDescriptor {
try {
n = channel.write(b);
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
b.clear();
return n;
@@ -129,7 +129,7 @@ public class SocketDescriptor implements FileDescriptor {
}
}
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
return n;
}
@@ -139,7 +139,7 @@ public class SocketDescriptor implements FileDescriptor {
try {
n = channel.write(buf);
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
return n;
}
@@ -151,7 +151,7 @@ public class SocketDescriptor implements FileDescriptor {
try {
n = channel.write(buf, offset, length);
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
return n;
}
@@ -161,7 +161,7 @@ public class SocketDescriptor implements FileDescriptor {
try {
n = channel.read(buf);
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
return n;
}
@@ -173,7 +173,7 @@ public class SocketDescriptor implements FileDescriptor {
try {
n = channel.read(buf, offset, length);
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
return n;
}
@@ -232,7 +232,7 @@ public class SocketDescriptor implements FileDescriptor {
writeSelector = Selector.open();
readSelector = Selector.open();
} catch (java.io.IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
try {
channel.register(writeSelector, SelectionKey.OP_WRITE);
diff --git a/java/com/tigervnc/network/TcpListener.java b/java/com/tigervnc/network/TcpListener.java
index d56cd065..e6588699 100644
--- a/java/com/tigervnc/network/TcpListener.java
+++ b/java/com/tigervnc/network/TcpListener.java
@@ -62,7 +62,7 @@ public class TcpListener extends SocketListener {
addr = InetAddress.getByName("0.0.0.0");
}
} catch (UnknownHostException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
try {
@@ -120,7 +120,7 @@ public class TcpListener extends SocketListener {
try {
new_sock.socket().setTcpNoDelay(true);
} catch (java.net.SocketException e) {
- throw new SocketException(e.toString());
+ throw new SocketException(e.getMessage());
}
// Create the socket object & check connection is allowed
@@ -128,7 +128,7 @@ public class TcpListener extends SocketListener {
try {
fd = new SocketDescriptor();
} catch (java.lang.Exception e) {
- throw new SocketException(e.toString());
+ throw new SocketException(e.getMessage());
}
fd.setChannel(new_sock);
TcpSocket s = new TcpSocket(fd);
diff --git a/java/com/tigervnc/network/TcpSocket.java b/java/com/tigervnc/network/TcpSocket.java
index cdc05016..bd5fe2b2 100644
--- a/java/com/tigervnc/network/TcpSocket.java
+++ b/java/com/tigervnc/network/TcpSocket.java
@@ -108,7 +108,7 @@ public class TcpSocket extends Socket {
try {
((SocketDescriptor)getFd()).close();
} catch (IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
}
@@ -148,7 +148,7 @@ public class TcpSocket extends Socket {
SocketAddress myaddr = ((SocketDescriptor)getFd()).getLocalAddress();
return myaddr.equals(peeraddr);
} catch (IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
}
@@ -157,7 +157,7 @@ public class TcpSocket extends Socket {
try {
((SocketDescriptor)getFd()).shutdown();
} catch (IOException e) {
- throw new Exception(e.toString());
+ throw new Exception(e.getMessage());
}
}