Check for file existence.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2784 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-08-20 03:52:36 +00:00
parent a34e6a7fd8
commit 026be0505a
2 changed files with 16 additions and 9 deletions
@@ -1,5 +1,5 @@
// //
// $Id: JNLPDownloader.java,v 1.6 2003/08/09 05:27:07 mdb Exp $ // $Id: JNLPDownloader.java,v 1.7 2003/08/20 03:52:36 mdb Exp $
package com.threerings.resource; package com.threerings.resource;
@@ -41,12 +41,14 @@ public class JNLPDownloader extends Downloader
// determine which version we already have, if any // determine which version we already have, if any
_vfile = new File(FileUtil.resuffix(_desc.destFile, ".jar", ".vers")); _vfile = new File(FileUtil.resuffix(_desc.destFile, ".jar", ".vers"));
try { if (_vfile.exists()) {
BufferedReader vin = new BufferedReader(new FileReader(_vfile)); try {
_cvers = vin.readLine(); BufferedReader vin = new BufferedReader(new FileReader(_vfile));
} catch (IOException ioe) { _cvers = vin.readLine();
Log.warning("Error reading version file [path=" + _vfile + } catch (IOException ioe) {
", error=" + ioe + "]."); Log.warning("Error reading version file [path=" + _vfile +
", error=" + ioe + "].");
}
} }
} }
@@ -1,5 +1,5 @@
// //
// $Id: ResourceBundle.java,v 1.22 2003/08/15 23:58:02 mdb Exp $ // $Id: ResourceBundle.java,v 1.23 2003/08/20 03:52:36 mdb Exp $
package com.threerings.resource; package com.threerings.resource;
@@ -353,6 +353,11 @@ public class ResourceBundle
return true; return true;
} }
if (!_source.exists()) {
throw new IOException("Missing jar file for resource bundle: " +
_source + ".");
}
try { try {
if (_jarSource == null) { if (_jarSource == null) {
_jarSource = new JarFile(_source); _jarSource = new JarFile(_source);
@@ -360,7 +365,7 @@ public class ResourceBundle
return false; return false;
} catch (IOException ioe) { } catch (IOException ioe) {
Log.warning("Failure creating jar file '" + _source + "'."); Log.warning("Failure reading jar file '" + _source + "'.");
Log.logStackTrace(ioe); Log.logStackTrace(ioe);
throw new NestableIOException( throw new NestableIOException(
"Failed to resolve resource bundle jar file '" + "Failed to resolve resource bundle jar file '" +