[Japi-cvs] SF.net SVN: japi:[1343] libs/net/trunk/src/prj/net/sf/japi/net/Forwarder. java
Status: Beta
Brought to you by:
christianhujer
From: <chr...@us...> - 2009-06-14 09:27:07
|
Revision: 1343 http://japi.svn.sourceforge.net/japi/?rev=1343&view=rev Author: christianhujer Date: 2009-06-14 09:27:05 +0000 (Sun, 14 Jun 2009) Log Message: ----------- Improve exception handling. Modified Paths: -------------- libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java Modified: libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java =================================================================== --- libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java 2009-06-14 09:26:56 UTC (rev 1342) +++ libs/net/trunk/src/prj/net/sf/japi/net/Forwarder.java 2009-06-14 09:27:05 UTC (rev 1343) @@ -76,17 +76,22 @@ /** {@inheritDoc} */ public void run() { try { - final Thread c1 = new Copier(s1.getInputStream(), s2.getOutputStream()).start(); - final Thread c2 = new Copier(s2.getInputStream(), s1.getOutputStream()).start(); - c1.join(); - c2.join(); + try { + try { + final Thread c1 = new Copier(s1.getInputStream(), s2.getOutputStream()).start(); + final Thread c2 = new Copier(s2.getInputStream(), s1.getOutputStream()).start(); + c1.join(); + c2.join(); + } finally { + s1.close(); + } + } finally { + s2.close(); + } } catch (final InterruptedException ignore) { /* ignore */ } catch (final IOException e) { e.printStackTrace(); // TODO:2009-02-23:christianhujer:Better handling of the exception. - } finally { - try { s1.close(); } catch (final IOException ignore) { /* ignore */ } - try { s2.close(); } catch (final IOException ignore) { /* ignore */ } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |