Changeset 14217 in josm


Ignore:
Timestamp:
2018-09-02T18:59:44+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16705 - RemoteControlHttpsServer: end mainloop if server.isClosed() (patch by ris)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java

    r14138 r14217  
    417417                if (!server.isClosed()) {
    418418                    Logging.error(e);
     419                } else {
     420                    // stop the thread automatically if server is stopped
     421                    return;
    419422                }
    420423            } catch (IOException ioe) {
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/RemoteControlTest.java

    r14201 r14217  
    2626import org.junit.After;
    2727import org.junit.Before;
     28import org.junit.Rule;
    2829import org.junit.Test;
    29 import org.openstreetmap.josm.JOSMFixture;
    3030import org.openstreetmap.josm.TestUtils;
    3131import org.openstreetmap.josm.spi.preferences.Config;
     32import org.openstreetmap.josm.testutils.JOSMTestRules;
    3233import org.openstreetmap.josm.tools.Logging;
    3334import org.openstreetmap.josm.tools.PlatformHookWindows;
     
    5455
    5556    /**
     57     * Setup test.
     58     */
     59    @Rule
     60    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     61    public JOSMTestRules test = new JOSMTestRules().preferences().https().assertionsInEDT();
     62
     63    /**
    5664     * Starts Remote control before testing requests.
    5765     * @throws GeneralSecurityException if a security error occurs
     
    5967    @Before
    6068    public void setUp() throws GeneralSecurityException {
    61         JOSMFixture.createUnitTestFixture().init();
    6269        RemoteControl.PROP_REMOTECONTROL_HTTPS_ENABLED.put(true);
    6370        deleteKeystore();
  • trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java

    r12636 r14217  
    2929    @Rule
    3030    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    31     public JOSMTestRules test = new JOSMTestRules();
     31    public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection();
    3232
    3333    private static AddNodeHandler newHandler(String url) throws RequestHandlerBadRequestException {
     
    5858        thrown.expectMessage("NumberFormatException (empty String)");
    5959        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    60         try {
    61             MainApplication.getLayerManager().addLayer(layer);
    62             newHandler(null).handle();
    63         } finally {
    64             MainApplication.getLayerManager().removeLayer(layer);
    65         }
     60        MainApplication.getLayerManager().addLayer(layer);
     61        newHandler(null).handle();
    6662    }
    6763
     
    9591    public void testNominalRequest() throws Exception {
    9692        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
    97         try {
    98             MainApplication.getLayerManager().addLayer(layer);
    99             newHandler("https://localhost?lat=0&lon=0").handle();
    100         } finally {
    101             MainApplication.getLayerManager().removeLayer(layer);
    102         }
     93        MainApplication.getLayerManager().addLayer(layer);
     94        newHandler("https://localhost?lat=0&lon=0").handle();
    10395    }
    10496}
Note: See TracChangeset for help on using the changeset viewer.