Forbids interrupted exception shown

This commit is contained in:
huangyuhui 2018-02-02 14:25:21 +08:00
parent 2efb5d7f8f
commit 55e7b8901a
3 changed files with 9 additions and 5 deletions

View File

@ -142,9 +142,12 @@ public final class LauncherHelper {
@Override @Override
public void onTerminate() { public void onTerminate() {
Platform.runLater(() -> { Platform.runLater(() -> {
Controllers.dialog(I18nException.getStackTrace(executor.getLastException()), if (executor.getLastException() != null)
scriptFile == null ? Main.i18n("launch.failed") : Main.i18n("version.launch_script.failed"), Controllers.dialog(I18nException.getStackTrace(executor.getLastException()),
MessageBox.ERROR_MESSAGE, Controllers::closeDialog); scriptFile == null ? Main.i18n("launch.failed") : Main.i18n("version.launch_script.failed"),
MessageBox.ERROR_MESSAGE, Controllers::closeDialog);
else
Controllers.closeDialog();
}); });
} }
}); });

View File

@ -95,7 +95,9 @@ public final class GetTask extends TaskResult<String> {
while ((len = input.read(buf)) != -1) { while ((len = input.read(buf)) != -1) {
baos.write(buf, 0, len); baos.write(buf, 0, len);
read += len; read += len;
updateProgress(read, size);
if (size >= 0)
updateProgress(read, size);
if (Thread.currentThread().isInterrupted()) if (Thread.currentThread().isInterrupted())
return; return;

View File

@ -184,7 +184,6 @@ public final class TaskExecutor {
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
if (task.getSignificance().shouldLog()) { if (task.getSignificance().shouldLog()) {
lastException = e;
Logging.LOG.log(Level.FINE, "Task aborted: " + task.getName()); Logging.LOG.log(Level.FINE, "Task aborted: " + task.getName());
task.onDone().fireEvent(new TaskEvent(this, task, true)); task.onDone().fireEvent(new TaskEvent(this, task, true));
taskListeners.forEach(it -> it.onFailed(task, e)); taskListeners.forEach(it -> it.onFailed(task, e));