コード例 #1
0
    @Override
    public void run() {
      try {
        presence.publishPresenceStatus(status, "");
      } catch (IllegalArgumentException e1) {

        logger.error("Error - changing status", e1);
      } catch (IllegalStateException e1) {

        logger.error("Error - changing status", e1);
      } catch (OperationFailedException e1) {
        if (e1.getErrorCode() == OperationFailedException.GENERAL_ERROR) {
          String msgText =
              GuiActivator.getResources()
                  .getI18NString(
                      "service.gui.STATUS_CHANGE_GENERAL_ERROR",
                      new String[] {
                        protocolProvider.getAccountID().getUserID(),
                        protocolProvider.getAccountID().getService()
                      });

          new ErrorDialog(
                  null,
                  GuiActivator.getResources().getI18NString("service.gui.GENERAL_ERROR"),
                  msgText,
                  e1)
              .showDialog();
        } else if (e1.getErrorCode() == OperationFailedException.NETWORK_FAILURE) {
          String msgText =
              GuiActivator.getResources()
                  .getI18NString(
                      "service.gui.STATUS_CHANGE_NETWORK_FAILURE",
                      new String[] {
                        protocolProvider.getAccountID().getUserID(),
                        protocolProvider.getAccountID().getService()
                      });

          new ErrorDialog(
                  null,
                  msgText,
                  GuiActivator.getResources().getI18NString("service.gui.NETWORK_FAILURE"),
                  e1)
              .showDialog();
        } else if (e1.getErrorCode() == OperationFailedException.PROVIDER_NOT_REGISTERED) {
          String msgText =
              GuiActivator.getResources()
                  .getI18NString(
                      "service.gui.STATUS_CHANGE_NETWORK_FAILURE",
                      new String[] {
                        protocolProvider.getAccountID().getUserID(),
                        protocolProvider.getAccountID().getService()
                      });

          new ErrorDialog(
                  null,
                  GuiActivator.getResources().getI18NString("service.gui.NETWORK_FAILURE"),
                  msgText,
                  e1)
              .showDialog();
        }
        logger.error("Error - changing status", e1);
      }
    }