Changeset 14504 in josm


Ignore:
Timestamp:
2018-12-03T20:08:05+01:00 (4 months ago)
Author:
Don-vip
Message:

fix #17065 - spurious UnsupportedFlavorException displayed in console

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java

    r14500 r14504  
    10641064    protected static void removeClipboardDataFor(OsmDataLayer osm) {
    10651065        Transferable clipboardContents = ClipboardUtils.getClipboardContent();
    1066         if (clipboardContents != null) {
     1066        if (clipboardContents != null && clipboardContents.isDataFlavorSupported(OsmLayerTransferData.OSM_FLAVOR)) {
    10671067            try {
    10681068                Object o = clipboardContents.getTransferData(OsmLayerTransferData.OSM_FLAVOR);
  • trunk/test/unit/org/openstreetmap/josm/gui/layer/OsmDataLayerTest.java

    r14446 r14504  
    3232import org.openstreetmap.josm.data.osm.Way;
    3333import org.openstreetmap.josm.gui.MainApplication;
     34import org.openstreetmap.josm.gui.datatransfer.ClipboardUtils;
    3435import org.openstreetmap.josm.io.IllegalDataException;
    3536import org.openstreetmap.josm.io.OsmReader;
    3637import org.openstreetmap.josm.testutils.JOSMTestRules;
    3738import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker;
     39import org.openstreetmap.josm.tools.Logging;
    3840import org.openstreetmap.josm.tools.date.DateUtils;
    3941
     
    310312     */
    311313    @Test
    312     public void testLayerNameIncreases() throws Exception {
     314    public void testLayerNameIncreases() {
    313315        final OsmDataLayer layer1 = new OsmDataLayer(new DataSet(), OsmDataLayer.createLayerName(147), null);
    314316        final OsmDataLayer layer2 = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null);
     
    334336        assertEquals("Data Layer from GeoJSON: foo.geojson", layer.getName());
    335337    }
     338
     339    /**
     340     * Non-regression test for ticket <a href="https://josm.openstreetmap.de/ticket/17065">#17065</a>.
     341     */
     342    @Test
     343    public void testTicket17065() {
     344        ClipboardUtils.clear();
     345        Logging.clearLastErrorAndWarnings();
     346        new OsmDataLayer(new DataSet(), null, null).destroy();
     347        assertTrue(Logging.getLastErrorAndWarnings().stream().noneMatch(s -> s.contains("UnsupportedFlavorException")));
     348    }
    336349}
Note: See TracChangeset for help on using the changeset viewer.