mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

jvergara
30.39.2007 767097d8baff57920038ea1f6e2e772d6612ea0c
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -722,12 +722,21 @@
      msg = i18n.getMsg(key);
    }
    String tag;
    if (isOutOfMemory(t))
    {
      tag = "exception-out-of-memory-details";
    }
    else
    {
      tag = "exception-details";
    }
    String detail = t.toString();
    if (detail != null)
    {
      String[] arg =
        { detail };
      msg = msg + "  " + i18n.getMsg("exception-details", arg);
      { detail };
      msg = msg + "  " + i18n.getMsg(tag, arg);
    }
    return msg;
  }
@@ -1438,4 +1447,33 @@
    System.setProperty("com.apple.mrj.application.apple.menu.about.name",
                       appName);
  }
  /**
    * Tells whether this throwable has been generated for an out of memory
    * error or not.
    * @param t the throwable to analyze.
    * @return <CODE>true</CODE> if the throwable was generated by an out of
    * memory error and false otherwise.
    */
  private static boolean isOutOfMemory(Throwable t)
  {
    boolean isOutOfMemory = false;
    while (!isOutOfMemory && (t != null))
    {
      if (t instanceof OutOfMemoryError)
      {
        isOutOfMemory = true;
      }
      else if (t instanceof IOException)
      {
        String msg = t.toString();
        if (msg != null)
        {
          isOutOfMemory = msg.indexOf("Not enough space") != -1;
        }
      }
      t = t.getCause();
    }
    return isOutOfMemory;
  }
}