Stack errors = new Stack(); mw.setErrorStack(errors);
PluginLogger logger = new PluginLogger(); mw.setLogger(logger);
    public static void saveTileset(TileSet set, String filename)        throws Exception    {        MapWriter mw;        if (filename.endsWith(".tsx")) {            // Override, so people can't overtake our format            mw = new XMLMapWriter();        } else {            mw = (MapWriter)pluginLoader.getWriterFor(filename);        }        if (mw != null) {            Stack errors = new Stack();            mw.setErrorStack(errors);            mw.writeTileset(set, filename);            set.setSource(filename);            reportPluginMessages(errors);        } else {            throw new Exception("Unsupported tileset format");        }    }