本文整理匯總了Java中org.eclipse.core.runtime.IStatus.getException方法的典型用法代碼示例。如果您正苦於以下問題:Java IStatus.getException方法的具體用法?Java IStatus.getException怎麽用?Java IStatus.getException使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.core.runtime.IStatus
的用法示例。
在下文中一共展示了IStatus.getException方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: validateBinaries
import org.eclipse.core.runtime.IStatus; //導入方法依賴的package包/類
private void validateBinaries() throws ExitCodeException {
IStatus status = nodeJsBinaryProvider.get().validate();
if (!status.isOK()) {
System.out.println(status.getMessage());
if (null != status.getException()) {
dumpThrowable(status.getException());
}
throw new ExitCodeException(EXITCODE_CONFIGURATION_ERROR, status.getMessage(), status.getException());
}
if (null != targetPlatformFile) {
status = npmBinaryProvider.get().validate();
if (!status.isOK()) {
System.out.println(status.getMessage());
if (null != status.getException()) {
dumpThrowable(status.getException());
}
throw new ExitCodeException(EXITCODE_CONFIGURATION_ERROR, status.getMessage(), status.getException());
}
}
}
示例2: getNotFoundError
import org.eclipse.core.runtime.IStatus; //導入方法依賴的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;
}
示例3: handleCoreException
import org.eclipse.core.runtime.IStatus; //導入方法依賴的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$
}
示例4: execute
import org.eclipse.core.runtime.IStatus; //導入方法依賴的package包/類
@Override
public void execute() throws CoreException, IOException, MalformedURLException {
LogUtils.logBugtrackingUsage(repositoryConnector.getConnectorKind(), "ISSUE_EDIT");
MylynSubmitTaskJob job = new MylynSubmitTaskJob(taskDataManager, repositoryConnector, taskRepository,
task, taskData, changedOldAttributes);
if (submitJobListener != null) {
job.addSubmitJobListener(submitJobListener);
}
Logger log = Logger.getLogger(this.getClass().getName());
if(log.isLoggable(Level.FINE)) {
log.log(
Level.FINE,
"executing SubmitJobCommand for task with id {0}:{1} ", //NOI18N
new Object[] { task.getTaskId(), taskRepository.getUrl() });
}
job.startJob(monitor);
IStatus status = job.getStatus();
rr = job.getResponse();
submittedTask = Accessor.getInstance().toNbTask(job.getTask());
if (status != null && status != Status.OK_STATUS) {
log.log(Level.INFO, "Command failed with status: {0}", status); //NOI18N
if (status.getException() instanceof CoreException) {
throw (CoreException) status.getException();
} else {
throw new CoreException(status);
}
}
}
示例5: getKenaiRedirectError
import org.eclipse.core.runtime.IStatus; //導入方法依賴的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;
}
示例6: handleStatus
import org.eclipse.core.runtime.IStatus; //導入方法依賴的package包/類
/**
* Returnes true if the given commands status != ok
* @param cmd
* @param handleExceptions
* @return
* @throws CoreException
*/
private boolean handleStatus(SynchronizeQueryCommand cmd, boolean handleExceptions) throws CoreException {
IStatus status = cmd.getStatus();
if(status == null || status.isOK()) {
return false;
}
Bugzilla.LOG.log(Level.FINE, "command {0} returned status : {1}", new Object[] {cmd, status.getMessage()}); // NOI18N
if (status.getException() instanceof CoreException) {
throw (CoreException) status.getException();
}
boolean isHtml = false;
String errMsg = null;
if(status instanceof RepositoryStatus) {
RepositoryStatus rstatus = (RepositoryStatus) status;
errMsg = rstatus.getHtmlMessage();
isHtml = errMsg != null;
}
if(errMsg == null) {
errMsg = status.getMessage();
}
cmd.setErrorMessage(errMsg);
cmd.setFailed(true);
if(!handleExceptions) {
return true;
}
BugzillaConfiguration conf = repository.getConfiguration();
if(conf.isValid()) {
BugzillaVersion version = conf.getInstalledVersion();
if(version.compareMajorMinorOnly(BugzillaAutoupdate.SUPPORTED_BUGZILLA_VERSION) > 0) {
notifyErrorMessage(
NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_ERROR_WARNING", status.getMessage()) + "\n\n" +
NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_VERSION_WARNING1", version) + "\n" + // NOI18N
(true ? NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_VERSION_WARNING2") : "")); // NOI18N
return true;
}
}
if(isHtml) {
notifyHtmlMessage(errMsg, repository, true);
} else {
notifyErrorMessage(NbBundle.getMessage(BugzillaExecutor.class, "MSG_BUGZILLA_ERROR_WARNING", errMsg)); // NOI18N
}
return true;
}