Changeset 31486 in osm


Ignore:
Timestamp:
2015-08-12T12:39:05+02:00 (9 years ago)
Author:
nokutu
Message:

Added unit test for OAuthPortListener class and del key know deletes images.

Location:
applications/editors/josm/plugins/mapillary
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthPortListener.java

    r31445 r31486  
    1919 */
    2020public class OAuthPortListener extends Thread {
     21
     22  protected static String RESPONSE = "<html><head><title>Mapillary login</title></head><body>Login successful, return to JOSM.</body></html>";
    2123
    2224  @Override
     
    5860          + accessToken);
    5961      // Saves the access token in preferences.
    60       Main.pref.put("mapillary.access-token", accessToken);
    61 
    62       Main.info("The username is: " + MapillaryUser.getUsername());
     62      if (Main.main != null) {
     63        Main.pref.put("mapillary.access-token", accessToken);
     64        Main.info("The username is: " + MapillaryUser.getUsername());
     65      }
    6366
    6467    } catch (BindException e) {
     
    7073
    7174  private static void writeContent(PrintWriter out) {
    72     String response = "<html><head><title>Mapillary login</title></head><body>Login successful, return to JOSM.</body></html>";
    7375    out.println("HTTP/1.1 200 OK");
    74     out.println("Content-Length: " + response.length());
     76    out.println("Content-Length: " + RESPONSE.length());
    7577    out.println("Content-Type: text/html" + "\r\n\r\n");
    76     out.println(response);
     78    out.println(RESPONSE);
    7779  }
    7880}
Note: See TracChangeset for help on using the changeset viewer.