Package org.openmim.mn

Examples of org.openmim.mn.MessagingNetworkException


 
  public static byte[] createByteArray(Session ses, int size)
  throws MessagingNetworkException
  {
    if (size < 0 || size > BYTE_ARRAY_SIZE_MAX)
      throw new MessagingNetworkException(
        "invalid length for byte array: " + size + ", must be [0..." + BYTE_ARRAY_SIZE_MAX + "].",
        MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_SERVER_OR_PROTOCOL_ERROR,
        MessagingNetworkException.ENDUSER_LOGGED_OFF_DUE_TO_PROTOCOL_ERROR);
    return new byte[size];
  }
View Full Code Here


    If this operation is failed previously, clones last exception & throws it.
    Otherwise, does nothing.
  */
  public synchronized void rethrowExceptionIfFailed() throws MessagingNetworkException
  {
    MessagingNetworkException ex = failException;
    if (ex != null) ex.throwCloned();
  }
View Full Code Here

    //if (ex.getEndUserReasonCode() != ex.ENDUSER_LOGGED_OFF_DUE_TO_NETWORK_ERROR)
    //  Lang.ASSERT_EQUAL( ex.getEndUserReasonCode(), ex.ENDUSER_LOGGED_OFF_DUE_TO_NETWORK_ERROR,
    //                    "ex.getEndUserReasonCode()", "ex.ENDUSER_LOGGED_OFF_DUE_TO_NETWORK_ERROR");
   
    MessagingNetworkException e = new MessagingNetworkException(
      "[please wait for the mim server to reconnect] "+ex.getMessage(),
      ex.CATEGORY_STILL_CONNECTED,
      c);
    if (Defines.DEBUG && CAT.isDebugEnabled()) CAT.debug(getLoginId()+": ex converted to "+e);
    return e;
View Full Code Here

    }
  }

  protected void throwStillReconnecting() throws MessagingNetworkException
  {
    throw new MessagingNetworkException(
      "network error occured, please wait for the mim server to reconnect",
      MessagingNetworkException.CATEGORY_STILL_CONNECTED,
      MessagingNetworkException.ENDUSER_NETWORK_ERROR_RECONNECTING);
  }
View Full Code Here

      //Integer.MAX_VALUE==2147483647
      //2147483646
      //11111111111
      int dstUin = IcqUinUtil.parseUin(dstLoginId, "dstLoginId", MessagingNetworkException.CATEGORY_STILL_CONNECTED);
      if (this.uin == dstUin)
        throw new MessagingNetworkException(
          "cannot add yourself to a contact list",
          MessagingNetworkException.CATEGORY_STILL_CONNECTED,
          MessagingNetworkException.ENDUSER_CANNOT_ADD_YOURSELF_TO_CONTACT_LIST);
      Integer dstUin_ = new Integer(dstUin);
      if (getContactListItem(dstUin_) != null)
View Full Code Here

  public final void handleException(Throwable tr, String processName, PluginContext ctx)
  throws MessagingNetworkException
  {
    if (Defines.DEBUG && CAT.isEnabledFor(org.apache.log4j.Level.ERROR)) CAT.error("error while "+processName, tr);
    MessagingNetworkException ex;

    if (tr instanceof MessagingNetworkException)
    {
      ex = (MessagingNetworkException) tr;
    }
    else
    if (tr instanceof UnknownHostException)
      ex = new MessagingNetworkException(
        "DNS error resolving "+tr.getMessage(),
        MessagingNetworkException.CATEGORY_LOGGED_OFF_DUE_TO_NETWORK_ERROR,
        MessagingNetworkException.ENDUSER_LOGGED_OFF_DUE_TO_NETWORK_ERROR);
    else
    if (tr instanceof InterruptedIOException)
      ex = new MessagingNetworkException(
        "mim admin restarts the mim server.",
        MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN,
        MessagingNetworkException.ENDUSER_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN);
    else
    if (tr instanceof InterruptedException)
      ex = new MessagingNetworkException(
        "mim admin restarts the mim server.",
        MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN,
        MessagingNetworkException.ENDUSER_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_PLUGIN_ADMIN);
    else
    if (tr instanceof IOException)
      ex = new MessagingNetworkException(
        "I/O error: "+tr.getMessage(),
        MessagingNetworkException.CATEGORY_LOGGED_OFF_DUE_TO_NETWORK_ERROR,
        MessagingNetworkException.ENDUSER_LOGGED_OFF_DUE_TO_NETWORK_ERROR);
    else
    if (tr instanceof AssertException)
      ex = new MessagingNetworkException(
        "bug found: "+tr.getMessage(),
        MessagingNetworkException.CATEGORY_NOT_CATEGORIZED,
        MessagingNetworkException.ENDUSER_MIM_BUG);
    else
      ex = new MessagingNetworkException(
        "unknown error: "+tr.getMessage(),
        MessagingNetworkException.CATEGORY_NOT_CATEGORIZED,
        MessagingNetworkException.ENDUSER_MIM_BUG_UNKNOWN_ERROR);

    if (ex.getLogger() != MessagingNetworkException.CATEGORY_STILL_CONNECTED)
    {
      setLastError(ex);
      shutdown(ctx, lastError.getLogger(), lastError.getMessage(), lastError.getEndUserReasonCode());
    }

    throw new MessagingNetworkException(
      "Error while " + processName + ": " + ex.getMessage(),
      ex.getLogger(),
      ex.getEndUserReasonCode());
  }
View Full Code Here

  void setLastError(String exceptionMessage, int reasonLogger, int endUserReasonCode)
  {
    synchronized (lastErrorLock)
    {
      if (lastError == null)
        lastError = new MessagingNetworkException(exceptionMessage, reasonLogger, endUserReasonCode);
    }
  }
View Full Code Here

  throws MessagingNetworkException
  {
    synchronized (lastErrorLock)
    {
      if (lastError == null)
        lastError = new MessagingNetworkException(exceptionMessage, reasonLogger, endUserReasonCode);
      throw new MessagingNetworkException(lastError.getMessage(), lastError.getLogger(), lastError.getEndUserReasonCode());
    }
  }
View Full Code Here

  throws MessagingNetworkException
  {
    synchronized (lastErrorLock)
    {
      if ((lastError) == null) Lang.ASSERT_NOT_NULL(lastError, "lastError");
      throw new MessagingNetworkException(lastError.getMessage(), lastError.getLogger(), lastError.getEndUserReasonCode());
    }
  }
View Full Code Here

          {
            if (Defines.DEBUG && CAT.isEnabledFor(org.apache.log4j.Level.ERROR)) CAT.error("invalid contact list entry uin ignored, exception ignored", ex11);
            continue;
          }
          if (this.uin == dstUin)
            throw new MessagingNetworkException(
              "cannot login with your own uin in a contact list",
              MessagingNetworkException.CATEGORY_LOGGED_OFF_ON_BEHALF_OF_MESSAGING_SERVER_OR_PROTOCOL_ERROR,
              MessagingNetworkException.ENDUSER_CANNOT_LOGIN_WITH_YOURSELF_ON_CONTACT_LIST);
          Integer dstUin_ = new Integer(dstUin);
          if (contactListUinInt2cli.put(dstUin_, makeContactListItem(dstLoginId)) != null)
View Full Code Here

TOP

Related Classes of org.openmim.mn.MessagingNetworkException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.