Goodbye, NestableIOException.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3788 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2005-12-20 02:09:18 +00:00
parent c7d36f9705
commit 7a64be94f2
7 changed files with 26 additions and 34 deletions
@@ -31,7 +31,6 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import com.samskivert.io.NestableIOException;
import com.samskivert.util.HashIntMap; import com.samskivert.util.HashIntMap;
import com.samskivert.util.IntIntMap; import com.samskivert.util.IntIntMap;
import com.samskivert.util.Tuple; import com.samskivert.util.Tuple;
@@ -141,8 +140,8 @@ public class BundledComponentRepository
} }
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
throw new NestableIOException( throw (IOException) new IOException(
"Internal error unserializing metadata", cnfe); "Internal error unserializing metadata").initCause(cnfe);
} }
// if we failed to load our classes or actions, create empty // if we failed to load our classes or actions, create empty
+6 -7
View File
@@ -34,7 +34,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import com.samskivert.io.NestableIOException;
import com.samskivert.util.ClassUtil; import com.samskivert.util.ClassUtil;
import com.threerings.presents.Log; import com.threerings.presents.Log;
@@ -149,7 +148,7 @@ public class Streamer
} }
String errmsg = "Failure invoking streamable writer " + String errmsg = "Failure invoking streamable writer " +
"[class=" + _target.getName() + "]"; "[class=" + _target.getName() + "]";
throw new NestableIOException(errmsg, t); throw (IOException) new IOException(errmsg).initCause(t);
} }
return; return;
} }
@@ -217,7 +216,7 @@ public class Streamer
String errmsg = "Failure writing streamable field " + String errmsg = "Failure writing streamable field " +
"[class=" + _target.getName() + "[class=" + _target.getName() +
", field=" + field.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) { } catch (InstantiationException ie) {
String errmsg = "Error instantiating object " + String errmsg = "Error instantiating object " +
"[type=" + _target.getName() + "]"; "[type=" + _target.getName() + "]";
throw new NestableIOException(errmsg, ie); throw (IOException) new IOException(errmsg).initCause(ie);
} catch (IllegalAccessException iae) { } catch (IllegalAccessException iae) {
String errmsg = "Error instantiating object " + String errmsg = "Error instantiating object " +
"[type=" + _target.getName() + "]"; "[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 " + String errmsg = "Failure invoking streamable reader " +
"[class=" + _target.getName() + "]"; "[class=" + _target.getName() + "]";
throw new NestableIOException(errmsg, t); throw (IOException) new IOException(errmsg).initCause(t);
} }
return; return;
} }
@@ -378,7 +377,7 @@ public class Streamer
String errmsg = "Failure reading streamable field " + String errmsg = "Failure reading streamable field " +
"[class=" + _target.getName() + "[class=" + _target.getName() +
", field=" + field.getName() + "]"; ", field=" + field.getName() + "]";
throw new NestableIOException(errmsg, e); throw (IOException) new IOException(errmsg).initCause(e);
} }
} }
@@ -41,7 +41,6 @@ import org.apache.commons.digester.Digester;
import org.apache.commons.io.CopyUtils; import org.apache.commons.io.CopyUtils;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import com.samskivert.io.NestableIOException;
import com.samskivert.io.PersistenceException; import com.samskivert.io.PersistenceException;
import com.threerings.media.Log; import com.threerings.media.Log;
@@ -158,7 +157,7 @@ public class TileSetBundler
} catch (SAXException saxe) { } catch (SAXException saxe) {
String errmsg = "Failure parsing bundler config file " + String errmsg = "Failure parsing bundler config file " +
"[file=" + configFile.getPath() + "]"; "[file=" + configFile.getPath() + "]";
throw new NestableIOException(errmsg, saxe); throw (IOException) new IOException(errmsg).initCause(saxe);
} }
fin.close(); fin.close();
@@ -185,7 +184,7 @@ public class TileSetBundler
} catch (Exception e) { } catch (Exception e) {
String errmsg = "Unable to create tileset rule set " + String errmsg = "Unable to create tileset rule set " +
"instance [mapping=" + map + "]."; "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) { } catch (SAXException saxe) {
String errmsg = "Failure parsing bundle description file " + String errmsg = "Failure parsing bundle description file " +
"[path=" + bundleDesc.getPath() + "]"; "[path=" + bundleDesc.getPath() + "]";
throw new NestableIOException(errmsg, saxe); throw (IOException) new IOException(errmsg).initCause(saxe);
} finally { } finally {
fin.close(); fin.close();
} }
@@ -293,7 +292,7 @@ public class TileSetBundler
} catch (PersistenceException pe) { } catch (PersistenceException pe) {
String errmsg = "Failure obtaining a tileset id for " + String errmsg = "Failure obtaining a tileset id for " +
"tileset [set=" + set + "]."; "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); CopyUtils.copy(imgin, jar);
} }
} catch (Exception e) { } catch (Exception e) {
throw new NestableIOException( String msg = "Failure bundling image " + ifile +
"Failure bundling image " + ifile + ": " + e, e); ": " + e;
throw (IOException) new IOException(msg).initCause(e);
} }
} }
} }
@@ -447,7 +447,7 @@ public class TileSetBundler
Log.warning("Failed to close botched bundle '" + target + "'."); Log.warning("Failed to close botched bundle '" + target + "'.");
} }
String errmsg = "Failed to create bundle " + target + ": " + e; String errmsg = "Failed to create bundle " + target + ": " + e;
throw new NestableIOException(errmsg, e); throw (IOException) new IOException(errmsg).initCause(e);
} }
} }
@@ -30,7 +30,6 @@ import java.nio.channels.SocketChannel;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import com.samskivert.io.NestableIOException;
import com.samskivert.util.LoopingThread; import com.samskivert.util.LoopingThread;
import com.samskivert.util.Queue; import com.samskivert.util.Queue;
import com.samskivert.util.RuntimeAdjust; import com.samskivert.util.RuntimeAdjust;
@@ -377,8 +376,8 @@ public class Communicator
return msg; return msg;
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
throw new NestableIOException( throw (IOException) new IOException(
"Unable to decode incoming message.", cnfe); "Unable to decode incoming message.").initCause(cnfe);
} }
} }
@@ -28,8 +28,6 @@ import java.net.InetAddress;
import java.nio.channels.SelectionKey; import java.nio.channels.SelectionKey;
import java.nio.channels.SocketChannel; import java.nio.channels.SocketChannel;
import com.samskivert.io.NestableIOException;
import com.threerings.io.FramedInputStream; import com.threerings.io.FramedInputStream;
import com.threerings.io.FramingOutputStream; import com.threerings.io.FramingOutputStream;
import com.threerings.io.ObjectInputStream; import com.threerings.io.ObjectInputStream;
@@ -288,8 +286,8 @@ public abstract class Connection implements NetEventHandler
"and error printing channel [error=" + cnfe + "]."); "and error printing channel [error=" + cnfe + "].");
} }
// deal with the failure // deal with the failure
handleFailure(new NestableIOException( handleFailure((IOException) new IOException(
"Unable to decode incoming message.", cnfe)); "Unable to decode incoming message.").initCause(cnfe));
} catch (IOException ioe) { } catch (IOException ioe) {
// don't log a warning for the ever-popular "the client // don't log a warning for the ever-popular "the client
@@ -32,7 +32,6 @@ import java.util.Enumeration;
import java.util.jar.JarEntry; import java.util.jar.JarEntry;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import com.samskivert.io.NestableIOException;
import com.samskivert.io.StreamUtil; import com.samskivert.io.StreamUtil;
import com.samskivert.util.FileUtil; import com.samskivert.util.FileUtil;
import com.samskivert.util.StringUtil; import com.samskivert.util.StringUtil;
@@ -372,11 +371,11 @@ public class ResourceBundle
return false; return false;
} catch (IOException ioe) { } 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); Log.logStackTrace(ioe);
throw new NestableIOException( throw (IOException) new IOException(msg).initCause(ioe);
"Failed to resolve resource bundle jar file '" +
_source + "'", ioe);
} }
} }
@@ -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 // Narya library - tools for developing networked games
// Copyright (C) 2002-2004 Three Rings Design, Inc., All Rights Reserved // 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.ObjectOutputStream;
import java.io.Serializable; import java.io.Serializable;
import com.samskivert.io.NestableIOException;
/** /**
* Used to load and store compiled configuration data (generally XML files * Used to load and store compiled configuration data (generally XML files
* that are parsed into Java object models and then serialized for rapid * that are parsed into Java object models and then serialized for rapid
@@ -49,7 +47,7 @@ public class CompiledConfig
return (Serializable)oin.readObject(); return (Serializable)oin.readObject();
} catch (ClassNotFoundException cnfe) { } catch (ClassNotFoundException cnfe) {
String errmsg = "Unknown config class"; String errmsg = "Unknown config class";
throw new NestableIOException(errmsg, cnfe); throw (IOException) new IOException(errmsg).initCause(cnfe);
} }
} }