コード例 #1
0
  public String getReleaseNotes() {

    if (siteAvailable()) {

      Log.info("Downloading latest release notes from http://executequery.org");

      try {

        RemoteHttpClient httpClient = remoteHttpClient();
        RemoteHttpResponse response =
            httpClient.httpGetRequest(ADDRESS, releaseNotesUrl().getPath());

        return response.getResponse();

      } catch (MalformedURLException e) {

        handleException(e);

      } catch (RemoteHttpClientException e) {

        logError(e);
      }
    }

    throw new ApplicationException(ioErrorMessage());
  }
コード例 #2
0
  public ApplicationVersion getLatestVersion() {

    if (siteAvailable()) {

      try {

        String version = null;
        String build = null;

        RemoteHttpClient httpClient = remoteHttpClient();
        RemoteHttpResponse response = httpClient.httpGetRequest(ADDRESS, versionUrl().getPath());

        String[] responseTextLines = response.getResponse().split("\n");
        for (String line : responseTextLines) {

          if (line.startsWith("version")) {

            version = line.substring(8).trim();

          } else if (line.startsWith("build")) {

            build = line.substring(6).trim();
          }
        }

        return new ApplicationVersion(version, build);

      } catch (MalformedURLException e) {

        handleException(e);

      } catch (RemoteHttpClientException e) {

        logError(e);
      }
    }

    throw new ApplicationException(ioErrorMessage());
  }