mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
continue WEB-9968 Dart: ClassCastException when debugging web application in Dartium
This commit is contained in:
@@ -387,7 +387,7 @@ public class VfsUtilCore {
|
||||
String suffix = url.substring(index + 2);
|
||||
|
||||
if (SystemInfoRt.isWindows) {
|
||||
return prefix + "://" + suffix;
|
||||
return prefix + URLUtil.SCHEME_SEPARATOR + suffix;
|
||||
}
|
||||
else if (removeLocalhostPrefix && prefix.equals(StandardFileSystems.FILE_PROTOCOL) && suffix.startsWith(LOCALHOST_URI_PATH_PREFIX)) {
|
||||
// sometimes (e.g. in Google Chrome for Mac) local file url is prefixed with 'localhost' so we need to remove it
|
||||
|
||||
@@ -84,10 +84,17 @@ public final class UrlImpl implements Url {
|
||||
public String toDecodedForm() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (scheme != null) {
|
||||
builder.append(scheme).append(URLUtil.SCHEME_SEPARATOR);
|
||||
}
|
||||
if (authority != null) {
|
||||
builder.append(authority);
|
||||
builder.append(scheme);
|
||||
if (authority != null || isInLocalFileSystem()) {
|
||||
builder.append(URLUtil.SCHEME_SEPARATOR);
|
||||
}
|
||||
else {
|
||||
builder.append(':');
|
||||
}
|
||||
|
||||
if (authority != null) {
|
||||
builder.append(authority);
|
||||
}
|
||||
}
|
||||
builder.append(getPath());
|
||||
if (parameters != null) {
|
||||
@@ -104,7 +111,8 @@ public final class UrlImpl implements Url {
|
||||
}
|
||||
|
||||
// relative path - special url, encoding is not required
|
||||
if (path.charAt(0) != '/' && !isInLocalFileSystem()) {
|
||||
// authority is null in case of URI or file URL
|
||||
if ((path.charAt(0) != '/' || authority == null) && !isInLocalFileSystem()) {
|
||||
return toDecodedForm();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public final class Urls {
|
||||
private static final Logger LOG = Logger.getInstance(Urls.class);
|
||||
|
||||
// about ";" see WEB-100359
|
||||
private static final Pattern URI_PATTERN = Pattern.compile("^([^:/?#]+)://([^/?#]*)([^?#;]*)(.*)");
|
||||
private static final Pattern URI_PATTERN = Pattern.compile("^([^:/?#]+):(//)?([^/?#]*)([^?#;]*)(.*)");
|
||||
|
||||
@NotNull
|
||||
public static Url newUri(@NotNull String scheme, @NotNull String path) {
|
||||
@@ -44,7 +44,7 @@ public final class Urls {
|
||||
|
||||
@NotNull
|
||||
public static Url newFromEncoded(@NotNull String url) {
|
||||
Url result = parse(url, true);
|
||||
Url result = parse(url, false);
|
||||
LOG.assertTrue(result != null, url);
|
||||
return result;
|
||||
}
|
||||
@@ -112,19 +112,18 @@ public final class Urls {
|
||||
scheme = "jar:" + scheme;
|
||||
}
|
||||
|
||||
String authority = StringUtil.nullize(matcher.group(2));
|
||||
String authority = StringUtil.nullize(matcher.group(3));
|
||||
|
||||
String path = StringUtil.nullize(matcher.group(3));
|
||||
String path = StringUtil.nullize(matcher.group(4));
|
||||
if (path != null) {
|
||||
path = FileUtil.toCanonicalUriPath(path);
|
||||
}
|
||||
|
||||
String parameters = matcher.group(4);
|
||||
if (authority != null && StandardFileSystems.FILE_PROTOCOL.equals(scheme)) {
|
||||
if (authority != null && (StandardFileSystems.FILE_PROTOCOL.equals(scheme) || StringUtil.isEmpty(matcher.group(2)))) {
|
||||
path = path == null ? authority : (authority + path);
|
||||
authority = null;
|
||||
}
|
||||
return new UrlImpl(scheme, authority, path, parameters);
|
||||
return new UrlImpl(scheme, authority, path, matcher.group(5));
|
||||
}
|
||||
|
||||
// must not be used in NodeJS
|
||||
|
||||
Reference in New Issue
Block a user