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

[#1045] replace removed FileUtil.transferStreams #1046

Merged
merged 5 commits into from
Aug 7, 2024
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
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests for language server bundle (Incubation)
Bundle-SymbolicName: org.eclipse.lsp4e.test;singleton:=true
Bundle-Version: 0.15.14.qualifier
Bundle-Version: 0.15.15.qualifier
Fragment-Host: org.eclipse.lsp4e
Bundle-Vendor: Eclipse.org
Bundle-RequiredExecutionEnvironment: JavaSE-17
Expand Down
2 changes: 1 addition & 1 deletion org.eclipse.lsp4e.test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</parent>
<artifactId>org.eclipse.lsp4e.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<version>0.15.14-SNAPSHOT</version>
<version>0.15.15-SNAPSHOT</version>

<properties>
<os-jvm-flags /> <!-- for the default case -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
*******************************************************************************/
package org.eclipse.lsp4e.test.edit;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand All @@ -30,7 +33,6 @@
import java.util.Random;

import org.eclipse.core.filesystem.EFS;
import org.eclipse.core.internal.utils.FileUtil;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
Expand Down Expand Up @@ -374,9 +376,7 @@ private String readContent(IFile targetFile) throws IOException, CoreException {
try (ByteArrayOutputStream stream = new ByteArrayOutputStream(
(int) targetFile.getLocation().toFile().length());
InputStream contentStream = targetFile.getContents();) {
FileUtil.transferStreams(contentStream, stream, targetFile.getFullPath().toString(),
new NullProgressMonitor());
// targetFile.getContents().transferTo(stream);
contentStream.transferTo(stream);
return new String(stream.toByteArray());
}
}
Expand Down
3 changes: 1 addition & 2 deletions org.eclipse.lsp4e/src/org/eclipse/lsp4e/LSPEclipseUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import org.eclipse.core.filesystem.IFileInfo;
import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.IFileSystem;
import org.eclipse.core.internal.utils.FileUtil;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
Expand Down Expand Up @@ -1164,7 +1163,7 @@ private static CompositeChange toCompositeChange(WorkspaceEdit wsEdit, String na
if (oldFile != null && oldFile.exists()) {
try (var stream = new ByteArrayOutputStream((int) oldFile.getLocation().toFile().length());
InputStream inputStream = oldFile.getContents();) {
FileUtil.transferStreams(inputStream, stream, newURI.toString(), null);
inputStream.transferTo(stream);
content = new String(stream.toByteArray());
encoding = oldFile.getCharset();
} catch (IOException | CoreException e) {
Expand Down
Loading