Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Resolve Java warnings and improve error handling #7977

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public void startCommandInBazelContext(@NotNull Project project, @NotNull Worksp
}
else {
FlutterUtils.warn(LOG, "No \"doctorScript\" script in the flutter.json file.");
// TODO: Update the Bazel workspace's flutter.json file to include the correct path to the doctorScript.
}
}

Expand Down
2 changes: 1 addition & 1 deletion flutter-idea/src/io/flutter/android/AndroidSdk.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType
return emulators;
}
catch (ExecutionException | RuntimeException e) {
FlutterUtils.warn(LOG, "Error listing android emulators", e);
FlutterUtils.warn(LOG, "Error listing android emulators. Please check your Android SDK configuration.", e);
return Collections.emptyList();
}
}
Expand Down
2 changes: 1 addition & 1 deletion flutter-idea/src/io/flutter/run/daemon/DeviceDaemon.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class DeviceDaemon {
/**
* Attempt to start the daemon this many times before showing the user a warning that the daemon is having trouble starting up.
*/
private static final int RESTART_ATTEMPTS_BEFORE_WARNING = 1;
private static final int RESTART_ATTEMPTS_BEFORE_WARNING = 3;

/**
* A unique id used to log device daemon actions.
Expand Down
20 changes: 6 additions & 14 deletions flutter-idea/src/io/flutter/run/daemon/FlutterApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -595,19 +595,11 @@ public Future shutdownAsync() {
else {
stopDone = myDaemonApi.stopApp(appId);
}
final Stopwatch watch = Stopwatch.createStarted();
while (watch.elapsed(TimeUnit.SECONDS) < 10 && getState() == State.TERMINATING) {
try {
stopDone.get(100, TimeUnit.MILLISECONDS);
break;
}
catch (TimeoutException e) {
// continue
}
catch (Exception e) {
// Ignore errors from app.stop.
break;
}
try {
// We wait for a maximum of 10 seconds to allow the process to shut down gracefully
stopDone.get(10, TimeUnit.SECONDS);
} catch (Exception e) {
// Ignore errors from app.stop.
}

// If it didn't work, shut down abruptly.
Expand Down Expand Up @@ -839,7 +831,7 @@ public void onAppStarting(DaemonEvent.AppStarting event) {
public void onAppDebugPort(@NotNull DaemonEvent.AppDebugPort debugInfo) {
app.setWsUrl(debugInfo.wsUri);

// Print the conneciton info to the console.
// Print the connection info to the console.
final ConsoleView console = app.getConsole();
if (console != null) {
console.print("Debug service listening on " + debugInfo.wsUri + "\n", ConsoleViewContentType.NORMAL_OUTPUT);
Expand Down
9 changes: 4 additions & 5 deletions flutter-idea/src/io/flutter/utils/Refreshable.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,10 @@ private void runInBackground() {
// This is normal.
}
catch (Exception e) {
if (!Objects.equal(e.getMessage(), "expected failure in test")) {
FlutterUtils.warn(LOG, "Callback threw an exception while updating a Refreshable", e);
if (!Objects.equals(e.getMessage(), "expected failure in test")) {
FlutterUtils.warn(LOG, "Callback threw an exception while updating a Refreshable: " + e.getClass().getSimpleName() + " - " + e.getMessage(), e);
}
}
finally {
schedule.done(request);
}

try {
// Wait for an opportunity to publish.
Expand Down Expand Up @@ -582,3 +579,5 @@ synchronized boolean isClosing() {
}
}
}

[end of flutter-idea/src/io/flutter/utils/Refreshable.java]
Loading