當前位置: 首頁>>代碼示例>>Java>>正文


Java CoreException.getStatus方法代碼示例

本文整理匯總了Java中org.eclipse.core.runtime.CoreException.getStatus方法的典型用法代碼示例。如果您正苦於以下問題:Java CoreException.getStatus方法的具體用法?Java CoreException.getStatus怎麽用?Java CoreException.getStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.runtime.CoreException的用法示例。


在下文中一共展示了CoreException.getStatus方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getNotFoundError

import org.eclipse.core.runtime.CoreException; //導入方法依賴的package包/類
private static String getNotFoundError(CoreException ce) {
    IStatus status = ce.getStatus();
    Throwable t = status.getException();
    if(t instanceof UnknownHostException ||
       // XXX maybe a different msg ?     
       t instanceof SocketTimeoutException || 
       t instanceof NoRouteToHostException ||
       t instanceof ConnectException) 
    {
        Bugzilla.LOG.log(Level.FINER, null, t);
        return NbBundle.getMessage(BugzillaExecutor.class, "MSG_HOST_NOT_FOUND");                   // NOI18N
    }
    String msg = getMessage(ce);
    if(msg != null) {
        msg = msg.trim().toLowerCase();
        if(HTTP_ERROR_NOT_FOUND.equals(msg)) {
            Bugzilla.LOG.log(Level.FINER, "returned error message [{0}]", msg);                     // NOI18N
            return NbBundle.getMessage(BugzillaExecutor.class, "MSG_HOST_NOT_FOUND");               // NOI18N
        }
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:BugzillaExecutor.java

示例2: handleCoreException

import org.eclipse.core.runtime.CoreException; //導入方法依賴的package包/類
/**
 * Handles a core exception thrown during a testing environment operation
 */
private void handleCoreException(CoreException e) {
  e.printStackTrace();
  IStatus status = e.getStatus();
  String message = e.getMessage();
  if (status.isMultiStatus()) {
    MultiStatus multiStatus = (MultiStatus) status;
    IStatus[] children = multiStatus.getChildren();
    StringBuffer buffer = new StringBuffer();
    for (int i = 0, max = children.length; i < max; i++) {
      IStatus child = children[i];
      if (child != null) {
        buffer.append(child.getMessage());
        buffer.append(System.getProperty("line.separator"));//$NON-NLS-1$
        Throwable childException = child.getException();
        if (childException != null) {
          childException.printStackTrace();
        }
      }
    }
    message = buffer.toString();
  }
  Assert.isTrue(false, "Core exception in testing environment: " + message); //$NON-NLS-1$
}
 
開發者ID:RuiChen08,項目名稱:dacapobench,代碼行數:27,代碼來源:TestingEnvironment.java

示例3: getKenaiRedirectError

import org.eclipse.core.runtime.CoreException; //導入方法依賴的package包/類
private static String getKenaiRedirectError(CoreException ce) {
    IStatus status = ce.getStatus();
    if(status == null) {
        return null;
    }
    Throwable cause = status.getException();
    if(cause != null && cause instanceof RedirectException) {
        String msg = cause.getMessage();
        if(msg.contains(KENAI_LOGIN_REDIRECT)) {
            Bugzilla.LOG.log(Level.FINER, "returned error message [{0}]", msg);                     // NOI18N
            return NbBundle.getMessage(BugzillaExecutor.class, "MSG_INVALID_USERNAME_OR_PASSWORD"); // NOI18N
        }
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:BugzillaExecutor.java

示例4: getMessage

import org.eclipse.core.runtime.CoreException; //導入方法依賴的package包/類
static String getMessage(CoreException ce) {
    String msg = ce.getMessage();
    if(msg != null && !msg.trim().equals("")) {                             // NOI18N
        return msg;
    }
    IStatus status = ce.getStatus();
    msg = status != null ? status.getMessage() : null;
    return msg != null ? msg.trim() : null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:BugzillaExecutor.java

示例5: notifyError

import org.eclipse.core.runtime.CoreException; //導入方法依賴的package包/類
private static void notifyError(CoreException ce, BugzillaRepository repository) {
    String msg = getMessage(ce);
    IStatus status = ce.getStatus();
    if (status instanceof BugzillaStatus) {
        BugzillaStatus bs = (BugzillaStatus) status;
        BugzillaUserMatchResponse res = bs.getUserMatchResponse();
        
        if(res != null) {
            String assignedMsg = res.getAssignedToMsg();
            String newCCMsg = res.getNewCCMsg();
            String qaContactMsg = res.getQaContactMsg();

            StringBuilder sb = new StringBuilder();
            if(msg != null) {
                sb.append(msg);
            }
            if(assignedMsg != null) {
                sb.append('\n');
                sb.append(assignedMsg);
            }
            if (newCCMsg != null) {
                sb.append('\n');
                sb.append(newCCMsg);
            }
            if (qaContactMsg != null) {
                sb.append('\n');
                sb.append(qaContactMsg);
            }
            msg = sb.toString();
        }
    }
    
    if (msg == null && status instanceof RepositoryStatus) {
        RepositoryStatus rs = (RepositoryStatus) status;
        String html = rs.getHtmlMessage();
        if(notifyHtmlMessage(html, repository, msg == null)) return;
    }
    notifyErrorMessage(msg);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:40,代碼來源:BugzillaExecutor.java

示例6: handleException

import org.eclipse.core.runtime.CoreException; //導入方法依賴的package包/類
public static void handleException(Exception exception) throws Throwable {
        if (exception instanceof CoreException) {
            CoreException e = (CoreException) exception;
            IStatus status = e.getStatus();
            if (status instanceof RepositoryStatus) {
                RepositoryStatus rs = (RepositoryStatus) status;
                String html = rs.getHtmlMessage();
                if(html != null && !html.trim().equals("")) {
//                    HtmlBrowser.URLDisplayer displayer = HtmlBrowser.URLDisplayer.getDefault ();
//                    if (displayer != null) {
//                        displayer.showURL (url);
//                    } else {
//                        //LOG.info("No URLDisplayer found.");
//                    }

                    final HtmlPanel p = new HtmlPanel();
                    p.setHtml(html);
                    BugzillaUtil.show(p, "html", "ok");
                }
                throw new Exception(rs.getHtmlMessage());
            }
            if (e.getStatus().getException() != null) {
                throw e.getStatus().getException();
            }
            if (e.getCause() != null) {
                throw e.getCause();
            }
            throw e;
        }
        exception.printStackTrace();
        throw exception;
    }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:TestUtil.java


注:本文中的org.eclipse.core.runtime.CoreException.getStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。