Skip to content
Merged
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
28 changes: 21 additions & 7 deletions src/io/flutter/run/daemon/FlutterApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
import io.flutter.run.FlutterLaunchMode;
import io.flutter.run.common.RunMode;
import io.flutter.settings.FlutterSettings;
import io.flutter.utils.*;
import io.flutter.utils.MostlySilentColoredProcessHandler;
import io.flutter.utils.ProgressHelper;
import io.flutter.utils.StreamSubscription;
import io.flutter.utils.UrlUtils;
import io.flutter.utils.VmServiceListenerAdapter;
import io.flutter.vmService.ServiceExtensions;
import io.flutter.vmService.VMServiceManager;
import org.dartlang.vm.service.VmService;
Expand All @@ -55,9 +59,18 @@

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.EventListener;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;

Expand Down Expand Up @@ -765,12 +778,12 @@ public void onAppDebugPort(@NotNull DaemonEvent.AppDebugPort debugInfo) {
if (uri.startsWith("file:")) {
// Convert the file: url to a path.
try {
uri = new URL(uri).getPath();
uri = new URI(uri).toURL().getPath();
if (uri.endsWith(File.separator)) {
uri = uri.substring(0, uri.length() - 1);
}
}
catch (MalformedURLException e) {
catch (IllegalArgumentException | MalformedURLException | URISyntaxException e) {
// ignore
}
}
Expand Down Expand Up @@ -844,7 +857,8 @@ private void sendDtdRequest(@NotNull DtdRequest dtdRequest, @NotNull JsonObject
final JsonPrimitive type = result != null ? result.getAsJsonPrimitive("type") : null;
if (type != null && "Success".equals(type.getAsString())) {
LOG.info("Successful request " + dtdRequest.type + " to DTD with params: " + initialParams);
} else {
}
else {
LOG.warn("Failed request " + dtdRequest.type + "to DTD with params: " + initialParams);
LOG.warn("Result: " + result);
}
Expand Down
31 changes: 17 additions & 14 deletions src/io/flutter/utils/UrlUtils.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
package io.flutter.utils;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public class UrlUtils {
public static String generateHtmlFragmentWithHrefTags(String input) {
StringBuilder builder = new StringBuilder();
for (String token : input.split(" ")) {
if (!builder.isEmpty()) {
builder.append(" ");
}
try {
URL url = new URL(token);
builder.append("<a href=\"").append(url).append("\">").append(url).append("</a>");
} catch(MalformedURLException e) {
builder.append(token);
}
}
return builder.toString();
public static String generateHtmlFragmentWithHrefTags(String input) {
StringBuilder builder = new StringBuilder();
for (String token : input.split(" ")) {
if (!builder.isEmpty()) {
builder.append(" ");
}
try {
URL url = new URI(token).toURL();
builder.append("<a href=\"").append(url).append("\">").append(url).append("</a>");
}
catch (IllegalArgumentException | MalformedURLException | URISyntaxException e) {
builder.append(token);
}
}
return builder.toString();
}
}