Ignore:
Timestamp:
2011-02-07T09:35:27+01:00 (13 years ago)
Author:
bastiK
Message:

extended mappaint style dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/xml/XmlStyleSource.java

    r3858 r3863  
    5151
    5252    protected void init() {
    53         hasError = false;
     53        clearErrors();
    5454        icons.clear();
    5555        lines.clear();
     
    6666        init();
    6767        try {
    68             MirroredInputStream in = new MirroredInputStream(url);
    69             InputStream zip = in.getZipEntry("xml", "style");
    70             InputStreamReader reader = null;
    71             if (zip != null) {
    72                 reader = new InputStreamReader(zip);
    73                 zipIcons = in.getFile();
    74             } else {
    75                 reader = new InputStreamReader(in);
    76                 zipIcons = null;
    77             }
    78 
     68            InputStreamReader reader = new InputStreamReader(getSourceInputStream());
    7969            XmlObjectParser parser = new XmlObjectParser(new XmlStyleSourceHandler(this));
    8070            parser.startWithValidation(reader,
     
    8777            System.err.println(tr("Warning: failed to load Mappaint styles from ''{0}''. Exception was: {1}", url, e.toString()));
    8878            e.printStackTrace();
    89             hasError = true;
     79            logError(e);
    9080        } catch(SAXParseException e) {
    9181            System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: [{1}:{2}] {3}", url, e.getLineNumber(), e.getColumnNumber(), e.getMessage()));
    9282            e.printStackTrace();
    93             hasError = true;
     83            logError(e);
    9484        } catch(SAXException e) {
    9585            System.err.println(tr("Warning: failed to parse Mappaint styles from ''{0}''. Error was: {1}", url, e.getMessage()));
    9686            e.printStackTrace();
    97             hasError = true;
     87            logError(e);
     88        }
     89    }
     90
     91    public InputStream getSourceInputStream() throws IOException {
     92        MirroredInputStream in = new MirroredInputStream(url);
     93        InputStream zip = in.getZipEntry("xml", "style");
     94        if (zip != null) {
     95            zipIcons = in.getFile();
     96            return zip;
     97        } else {
     98            zipIcons = null;
     99            return in;
    98100        }
    99101    }
Note: See TracChangeset for help on using the changeset viewer.