当前位置: 首页>>代码示例>>Java>>正文


Java UpdateAvailableException类代码示例

本文整理汇总了Java中com.intellij.errorreport.error.UpdateAvailableException的典型用法代码示例。如果您正苦于以下问题:Java UpdateAvailableException类的具体用法?Java UpdateAvailableException怎么用?Java UpdateAvailableException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UpdateAvailableException类属于com.intellij.errorreport.error包,在下文中一共展示了UpdateAvailableException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postNewThread

import com.intellij.errorreport.error.UpdateAvailableException; //导入依赖的package包/类
private static int postNewThread(String login, String password, ErrorBean error) throws Exception {
  if (ourSslContext == null) {
    ourSslContext = initContext();
  }

  Map<String, String> params = createParameters(login, password, error);
  HttpURLConnection connection = post(new URL(NEW_THREAD_POST_URL), join(params));
  int responseCode = connection.getResponseCode();
  if (responseCode != HttpURLConnection.HTTP_OK) {
    throw new InternalEAPException(DiagnosticBundle.message("error.http.result.code", responseCode));
  }

  String response;
  InputStream is = connection.getInputStream();
  try {
    byte[] bytes = FileUtil.loadBytes(is);
    response = new String(bytes, ENCODING);
  }
  finally {
    is.close();
  }

  if ("unauthorized".equals(response)) {
    throw new NoSuchEAPUserException(login);
  }
  if (response.startsWith("update ")) {
    throw new UpdateAvailableException(response.substring(7));
  }
  if (response.startsWith("message ")) {
    throw new InternalEAPException(response.substring(8));
  }

  try {
    return Integer.valueOf(response.trim()).intValue();
  }
  catch (NumberFormatException ex) {
    throw new InternalEAPException(DiagnosticBundle.message("error.itn.returns.wrong.data"));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:ITNProxy.java

示例2: sendAndHandleResult

import com.intellij.errorreport.error.UpdateAvailableException; //导入依赖的package包/类
@Nonnull
public static String sendAndHandleResult(@Nonnull ErrorBean error) throws IOException, AuthorizationFailedException, UpdateAvailableException {
  String reply = doPost(WebServiceApi.ERROR_REPORTER_API.buildUrl("create"), error);

  Map<String, String> map = new Gson().fromJson(reply, new TypeToken<Map<String, String>>() {
  }.getType());

  String type = map.get("type");
  if (type == null) {
    throw new WebServiceException();
  }

  try {
    ResultType resultType = ResultType.valueOf(type);
    switch (resultType) {
      case OK:
        String id = map.get("id");
        if (id == null) {
          throw new WebServiceException();
        }
        return id;
      case BAD_OAUTHK_KEY:
        throw new AuthorizationFailedException();
      case PLATFORM_UPDATE_REQUIRED:
      case PLUGIN_UPDATE_REQUIRED:
        throw new UpdateAvailableException();
      case BAD_REPORT:
      default:
        throw new WebServiceException();
    }
  }
  catch (IllegalArgumentException e) {
    throw new WebServiceException();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:36,代码来源:ErrorReportSender.java

示例3: postNewThread

import com.intellij.errorreport.error.UpdateAvailableException; //导入依赖的package包/类
public static int postNewThread (String login, String password, ErrorBean error, String compilationTimestamp)
  throws IOException, NoSuchEAPUserException, InternalEAPException, UpdateAvailableException {

  @NonNls List<Pair<String, String>> params = createParametersFor(login,
                                                                  password,
                                                                  error,
                                                                  compilationTimestamp,
                                                                  ApplicationManager.getApplication(),
                                                                  (ApplicationInfoEx) ApplicationInfo.getInstance(),
                                                                  ApplicationNamesInfo.getInstance(),
                                                                  UpdateSettings.getInstance());

  HttpURLConnection connection = post(new URL(NEW_THREAD_URL), join(params));
  int responseCode = connection.getResponseCode();

  if (responseCode != HttpURLConnection.HTTP_OK) {
    throw new InternalEAPException(DiagnosticBundle.message("error.http.result.code", responseCode));
  }

  String reply;

  InputStream is = new BufferedInputStream(connection.getInputStream());
  try {
    reply = readFrom(is);
  } finally {
    is.close();
  }

  if ("unauthorized".equals(reply)) {
    throw new NoSuchEAPUserException(login);
  }

  if (reply.startsWith("update ")) {
    throw new UpdateAvailableException(reply.substring(7));
  }

  if (reply.startsWith("message ")) {
    throw new InternalEAPException(reply.substring(8));
  }

  try {
    return Integer.valueOf(reply.trim()).intValue();
  } catch (NumberFormatException ex) {
    // Tibor!!!! :-E
    throw new InternalEAPException(DiagnosticBundle.message("error.itn.returns.wrong.data"));
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:48,代码来源:ITNProxy.java


注:本文中的com.intellij.errorreport.error.UpdateAvailableException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。