[platform] deprecates incorrect method (IDEA-181378)

This commit is contained in:
Roman Shevchenko
2017-11-16 15:09:47 +01:00
parent cde2b7be07
commit f35c64b84f
@@ -214,30 +214,6 @@ public class VfsUtil extends VfsUtilCore {
return virtualFile;
}
/**
* @return correct URL, must be used only for external communication
*/
@NotNull
public static URI toUri(@NotNull VirtualFile file) {
String path = file.getPath();
try {
String protocol = file.getFileSystem().getProtocol();
if (file.isInLocalFileSystem()) {
if (SystemInfo.isWindows && path.charAt(0) != '/') {
path = '/' + path;
}
return new URI(protocol, "", path, null, null);
}
if (URLUtil.HTTP_PROTOCOL.equals(protocol)) {
return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path);
}
return new URI(protocol, path, null);
}
catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
/**
* @return correct URL, must be used only for external communication
*/
@@ -627,5 +603,27 @@ public class VfsUtil extends VfsUtilCore {
return null;
}
/** @deprecated incorrect, use {@link #toUri(String)} if needed (to be removed in IDEA 2019 */
@NotNull
public static URI toUri(@NotNull VirtualFile file) {
String path = file.getPath();
try {
String protocol = file.getFileSystem().getProtocol();
if (file.isInLocalFileSystem()) {
if (SystemInfo.isWindows && path.charAt(0) != '/') {
path = '/' + path;
}
return new URI(protocol, "", path, null, null);
}
if (URLUtil.HTTP_PROTOCOL.equals(protocol)) {
return new URI(URLUtil.HTTP_PROTOCOL + URLUtil.SCHEME_SEPARATOR + path);
}
return new URI(protocol, path, null);
}
catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}
//</editor-fold>
}