Ignore:
Timestamp:
2019-05-11T20:24:40+02:00 (5 years ago)
Author:
Don-vip
Message:

fix #17701, fix #17702 - add robustness when loading imagery layers from session

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r14741 r15070  
    565565                        throw new IllegalStateException("Importer " + imp + " returned null for " + support);
    566566                    }
    567                 } catch (IllegalDataException | IllegalStateException | IOException ex) {
     567                } catch (IllegalDataException | IllegalArgumentException | IllegalStateException | IOException ex) {
    568568                    exception = ex;
    569569                }
     
    704704    public void loadSession(File sessionFile, boolean zip, ProgressMonitor progressMonitor) throws IllegalDataException, IOException {
    705705        try (InputStream josIS = createInputStream(sessionFile, zip)) {
    706             loadSession(josIS, sessionFile.toURI(), zip, progressMonitor != null ? progressMonitor : NullProgressMonitor.INSTANCE);
     706            loadSession(josIS, sessionFile.toURI(), zip, progressMonitor);
    707707        }
    708708    }
     
    737737    }
    738738
    739     private void loadSession(InputStream josIS, URI sessionFileURI, boolean zip, ProgressMonitor progressMonitor)
     739    /**
     740     * Loads session from the given input stream.
     741     * @param josIS session stream to load
     742     * @param zip {@code true} if it's a zipped session (.joz)
     743     * @param sessionFileURI URI of the underlying session file
     744     * @param progressMonitor progress monitor
     745     * @throws IllegalDataException if invalid data is detected
     746     * @throws IOException if any I/O error occurs
     747     * @since xxx
     748     */
     749    public void loadSession(InputStream josIS, URI sessionFileURI, boolean zip, ProgressMonitor progressMonitor)
    740750            throws IOException, IllegalDataException {
    741751
     
    744754
    745755        try {
    746             parseJos(XmlUtils.parseSafeDOM(josIS), progressMonitor);
     756            parseJos(XmlUtils.parseSafeDOM(josIS), progressMonitor != null ? progressMonitor : NullProgressMonitor.INSTANCE);
    747757        } catch (SAXException e) {
    748758            throw new IllegalDataException(e);
Note: See TracChangeset for help on using the changeset viewer.