From 7a64be94f266edd46c3aa977e35f9313519015d5 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 20 Dec 2005 02:09:18 +0000 Subject: [PATCH] Goodbye, NestableIOException. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3788 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../cast/bundle/BundledComponentRepository.java | 5 ++--- src/java/com/threerings/io/Streamer.java | 13 ++++++------- .../media/tile/bundle/tools/TileSetBundler.java | 16 ++++++++-------- .../threerings/presents/client/Communicator.java | 5 ++--- .../presents/server/net/Connection.java | 6 ++---- .../com/threerings/resource/ResourceBundle.java | 9 ++++----- src/java/com/threerings/util/CompiledConfig.java | 6 ++---- 7 files changed, 26 insertions(+), 34 deletions(-) diff --git a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java index 406bf7d02..cf192771d 100644 --- a/src/java/com/threerings/cast/bundle/BundledComponentRepository.java +++ b/src/java/com/threerings/cast/bundle/BundledComponentRepository.java @@ -31,7 +31,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; -import com.samskivert.io.NestableIOException; import com.samskivert.util.HashIntMap; import com.samskivert.util.IntIntMap; import com.samskivert.util.Tuple; @@ -141,8 +140,8 @@ public class BundledComponentRepository } } catch (ClassNotFoundException cnfe) { - throw new NestableIOException( - "Internal error unserializing metadata", cnfe); + throw (IOException) new IOException( + "Internal error unserializing metadata").initCause(cnfe); } // if we failed to load our classes or actions, create empty diff --git a/src/java/com/threerings/io/Streamer.java b/src/java/com/threerings/io/Streamer.java index 1f6a7690d..3be335f46 100644 --- a/src/java/com/threerings/io/Streamer.java +++ b/src/java/com/threerings/io/Streamer.java @@ -34,7 +34,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import com.samskivert.io.NestableIOException; import com.samskivert.util.ClassUtil; import com.threerings.presents.Log; @@ -149,7 +148,7 @@ public class Streamer } String errmsg = "Failure invoking streamable writer " + "[class=" + _target.getName() + "]"; - throw new NestableIOException(errmsg, t); + throw (IOException) new IOException(errmsg).initCause(t); } return; } @@ -217,7 +216,7 @@ public class Streamer String errmsg = "Failure writing streamable field " + "[class=" + _target.getName() + ", field=" + field.getName() + "]"; - throw new NestableIOException(errmsg, e); + throw (IOException) new IOException(errmsg).initCause(e); } } } @@ -254,12 +253,12 @@ public class Streamer } catch (InstantiationException ie) { String errmsg = "Error instantiating object " + "[type=" + _target.getName() + "]"; - throw new NestableIOException(errmsg, ie); + throw (IOException) new IOException(errmsg).initCause(ie); } catch (IllegalAccessException iae) { String errmsg = "Error instantiating object " + "[type=" + _target.getName() + "]"; - throw new NestableIOException(errmsg, iae); + throw (IOException) new IOException(errmsg).initCause(iae); } } @@ -296,7 +295,7 @@ public class Streamer } String errmsg = "Failure invoking streamable reader " + "[class=" + _target.getName() + "]"; - throw new NestableIOException(errmsg, t); + throw (IOException) new IOException(errmsg).initCause(t); } return; } @@ -378,7 +377,7 @@ public class Streamer String errmsg = "Failure reading streamable field " + "[class=" + _target.getName() + ", field=" + field.getName() + "]"; - throw new NestableIOException(errmsg, e); + throw (IOException) new IOException(errmsg).initCause(e); } } diff --git a/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java b/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java index 751f262bb..70ec79b12 100644 --- a/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java +++ b/src/java/com/threerings/media/tile/bundle/tools/TileSetBundler.java @@ -41,7 +41,6 @@ import org.apache.commons.digester.Digester; import org.apache.commons.io.CopyUtils; import org.xml.sax.SAXException; -import com.samskivert.io.NestableIOException; import com.samskivert.io.PersistenceException; import com.threerings.media.Log; @@ -158,7 +157,7 @@ public class TileSetBundler } catch (SAXException saxe) { String errmsg = "Failure parsing bundler config file " + "[file=" + configFile.getPath() + "]"; - throw new NestableIOException(errmsg, saxe); + throw (IOException) new IOException(errmsg).initCause(saxe); } fin.close(); @@ -185,7 +184,7 @@ public class TileSetBundler } catch (Exception e) { String errmsg = "Unable to create tileset rule set " + "instance [mapping=" + map + "]."; - throw new NestableIOException(errmsg, e); + throw (IOException) new IOException(errmsg).initCause(e); } } } @@ -245,7 +244,7 @@ public class TileSetBundler } catch (SAXException saxe) { String errmsg = "Failure parsing bundle description file " + "[path=" + bundleDesc.getPath() + "]"; - throw new NestableIOException(errmsg, saxe); + throw (IOException) new IOException(errmsg).initCause(saxe); } finally { fin.close(); } @@ -293,7 +292,7 @@ public class TileSetBundler } catch (PersistenceException pe) { String errmsg = "Failure obtaining a tileset id for " + "tileset [set=" + set + "]."; - throw new NestableIOException(errmsg, pe); + throw (IOException) new IOException(errmsg).initCause(pe); } } @@ -421,8 +420,9 @@ public class TileSetBundler CopyUtils.copy(imgin, jar); } } catch (Exception e) { - throw new NestableIOException( - "Failure bundling image " + ifile + ": " + e, e); + String msg = "Failure bundling image " + ifile + + ": " + e; + throw (IOException) new IOException(msg).initCause(e); } } } @@ -447,7 +447,7 @@ public class TileSetBundler Log.warning("Failed to close botched bundle '" + target + "'."); } String errmsg = "Failed to create bundle " + target + ": " + e; - throw new NestableIOException(errmsg, e); + throw (IOException) new IOException(errmsg).initCause(e); } } diff --git a/src/java/com/threerings/presents/client/Communicator.java b/src/java/com/threerings/presents/client/Communicator.java index cecda4ff2..fff7c03f6 100644 --- a/src/java/com/threerings/presents/client/Communicator.java +++ b/src/java/com/threerings/presents/client/Communicator.java @@ -30,7 +30,6 @@ import java.nio.channels.SocketChannel; import java.net.InetAddress; import java.net.InetSocketAddress; -import com.samskivert.io.NestableIOException; import com.samskivert.util.LoopingThread; import com.samskivert.util.Queue; import com.samskivert.util.RuntimeAdjust; @@ -377,8 +376,8 @@ public class Communicator return msg; } catch (ClassNotFoundException cnfe) { - throw new NestableIOException( - "Unable to decode incoming message.", cnfe); + throw (IOException) new IOException( + "Unable to decode incoming message.").initCause(cnfe); } } diff --git a/src/java/com/threerings/presents/server/net/Connection.java b/src/java/com/threerings/presents/server/net/Connection.java index a052fd0ed..f1fd51369 100644 --- a/src/java/com/threerings/presents/server/net/Connection.java +++ b/src/java/com/threerings/presents/server/net/Connection.java @@ -28,8 +28,6 @@ import java.net.InetAddress; import java.nio.channels.SelectionKey; import java.nio.channels.SocketChannel; -import com.samskivert.io.NestableIOException; - import com.threerings.io.FramedInputStream; import com.threerings.io.FramingOutputStream; import com.threerings.io.ObjectInputStream; @@ -288,8 +286,8 @@ public abstract class Connection implements NetEventHandler "and error printing channel [error=" + cnfe + "]."); } // deal with the failure - handleFailure(new NestableIOException( - "Unable to decode incoming message.", cnfe)); + handleFailure((IOException) new IOException( + "Unable to decode incoming message.").initCause(cnfe)); } catch (IOException ioe) { // don't log a warning for the ever-popular "the client diff --git a/src/java/com/threerings/resource/ResourceBundle.java b/src/java/com/threerings/resource/ResourceBundle.java index f75a18df9..c8f0ed5a9 100644 --- a/src/java/com/threerings/resource/ResourceBundle.java +++ b/src/java/com/threerings/resource/ResourceBundle.java @@ -32,7 +32,6 @@ import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile; -import com.samskivert.io.NestableIOException; import com.samskivert.io.StreamUtil; import com.samskivert.util.FileUtil; import com.samskivert.util.StringUtil; @@ -372,11 +371,11 @@ public class ResourceBundle return false; } catch (IOException ioe) { - Log.warning("Failure reading jar file '" + _source + "'."); + String msg = "Failed to resolve resource bundle jar file '" + + _source + "'"; + Log.warning(msg + "."); Log.logStackTrace(ioe); - throw new NestableIOException( - "Failed to resolve resource bundle jar file '" + - _source + "'", ioe); + throw (IOException) new IOException(msg).initCause(ioe); } } diff --git a/src/java/com/threerings/util/CompiledConfig.java b/src/java/com/threerings/util/CompiledConfig.java index b3d98281d..c3db7374f 100644 --- a/src/java/com/threerings/util/CompiledConfig.java +++ b/src/java/com/threerings/util/CompiledConfig.java @@ -1,5 +1,5 @@ // -// $Id: CompiledConfig.java,v 1.4 2004/08/27 02:20:36 mdb Exp $ +// $Id$ // // Narya library - tools for developing networked games // Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved @@ -29,8 +29,6 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; -import com.samskivert.io.NestableIOException; - /** * Used to load and store compiled configuration data (generally XML files * that are parsed into Java object models and then serialized for rapid @@ -49,7 +47,7 @@ public class CompiledConfig return (Serializable)oin.readObject(); } catch (ClassNotFoundException cnfe) { String errmsg = "Unknown config class"; - throw new NestableIOException(errmsg, cnfe); + throw (IOException) new IOException(errmsg).initCause(cnfe); } }