If something goes wrong adding our tileset to the bundle, throw an exception so that

things fail & attract attentino, rather than trying to work around it and printing 
a stack trace that will likely go unnoticed amidst a slew of other build messages.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@273 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Dave Hoover
2007-07-13 18:07:29 +00:00
parent 7fdd8fee17
commit f57c408d7f
@@ -331,15 +331,13 @@ public class TileSetBundler
* Finish the creation of a tileset bundle jar file. * Finish the creation of a tileset bundle jar file.
* *
* @param target the tileset bundle file that will be created. * @param target the tileset bundle file that will be created.
* @param bundle contains the tilesets we'd like to save out to the * @param bundle contains the tilesets we'd like to save out to the bundle.
* bundle.
* @param improv the image provider. * @param improv the image provider.
* @param imageBase the base directory for getting images for non * @param imageBase the base directory for getting images for non
* ObjectTileSet tilesets. * ObjectTileSet tilesets.
*/ */
public static boolean createBundle ( public static boolean createBundle (
File target, TileSetBundle bundle, ImageProvider improv, File target, TileSetBundle bundle, ImageProvider improv, String imageBase)
String imageBase)
throws IOException throws IOException
{ {
// now we have to create the actual bundle file // now we have to create the actual bundle file
@@ -387,20 +385,11 @@ public class TileSetBundler
bundle.addTileSet(tileSetId, tset); bundle.addTileSet(tileSetId, tset);
} catch (Exception e) { } catch (Exception e) {
System.err.println("Error adding tileset to bundle " +
"[set=" + set.getName() +
", ipath=" + imagePath + "].");
e.printStackTrace(System.err); e.printStackTrace(System.err);
// replace the tileset with an error tileset
UniformTileSet ets = new UniformTileSet(); String msg = "Error adding tileset to bundle " + imagePath +
ets.setName(set.getName()); ", " + set.getName() + ": " + e;
ets.setWidth(50); throw (IOException) new IOException(msg).initCause(e);
ets.setHeight(50);
ets.setImagePath(imagePath);
bundle.addTileSet(tileSetId, ets);
// and write an error image to the jar file
ImageIO.write(ImageUtil.createErrorImage(50, 50),
"PNG", jar);
} }
} else { } else {