Stack errors = new Stack(); mr.setErrorStack(errors);
PluginLogger logger = new PluginLogger(); mr.setLogger(logger);
    public static Map loadMap(String file) throws Exception {        Map ret = null;        try {            MapReader mr;            if (file.endsWith(".tmx") || file.endsWith(".tmx.gz")) {                // Override, so people can't overtake our format                mr = new XMLMapTransformer();            } else {                mr = (MapReader)pluginLoader.getReaderFor(file);            }            if (mr != null) {                Stack errors = new Stack();                mr.setErrorStack(errors);                ret = mr.readMap(file);                ret.setFilename(file);                reportPluginMessages(errors);            } else {                throw new Exception("Unsupported map format");            }        } catch (IOException e) {            JOptionPane.showMessageDialog(null,                    e.getMessage() + (e.getCause() != null ? "\nCause: " +                        e.getCause().getMessage() : ""),                    "Error while loading map",                    JOptionPane.ERROR_MESSAGE);            e.printStackTrace();        } catch (Exception e) {            JOptionPane.showMessageDialog(null,                    "Error while loading " + file + ": " +                    e.getMessage() + (e.getCause() != null ? "\nCause: " +                        e.getCause().getMessage() : ""),                    "Error while loading map",                    JOptionPane.ERROR_MESSAGE);            e.printStackTrace();        }        return ret;    }