Skip to content

Commit 3a16f65

Browse files
committed
Fix warnings reported by javac
1 parent c2c182e commit 3a16f65

File tree

10 files changed

+5
-26
lines changed
  • gprof/org.eclipse.linuxtools.gprof.test/src/org/eclipse/linuxtools/internal/gprof/test
  • libhover
    • org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover
    • org.eclipse.linuxtools.cdt.libhover.texinfoparsers/src/org/eclipse/linuxtools/cdt/libhover/texinfoparsers
  • profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy
  • systemtap
    • org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core
    • org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch
    • org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/table
    • org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp
    • org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp

10 files changed

+5
-26
lines changed

gprof/org.eclipse.linuxtools.gprof.test/src/org/eclipse/linuxtools/internal/gprof/test/STJunitUtils.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ public static boolean compareIgnoreEOL(String dumpFile, String refFile, boolean
8888
fail(message + ": not correspond ");
8989
}
9090

91-
is1.close();
92-
is2.close();
9391
// delete dump only for successful tests
9492
if (equals && deleteDumpFileIfOk) {
9593
new File(dumpFile).delete();
@@ -143,8 +141,6 @@ public static boolean compareCSVIgnoreEOL(String dumpFile, String refFile, boole
143141
}
144142
} while (true);
145143

146-
is1.close();
147-
is2.close();
148144
if (!equals) {
149145
StringBuilder msg = new StringBuilder(message + ": not correspond ");
150146
msg.append("\n========= begin dump file =========\n");

libhover/org.eclipse.linuxtools.cdt.libhover.texinfoparsers/src/org/eclipse/linuxtools/cdt/libhover/texinfoparsers/ParseNewlibTexinfo.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,7 @@ public static void BuildXMLFromTexinfo(String srcdir, String builddir, String ds
557557
BuildXMLFromTexinfo2(srcdir, builddir, os, "libm");
558558

559559
CreateTrailer(os);
560-
561-
os.close();
562-
}
563-
catch (IOException e) {
560+
} catch (IOException e) {
564561
System.out.println("Output File IOException: " + e);
565562
return;
566563
}

libhover/org.eclipse.linuxtools.cdt.libhover/src/org/eclipse/linuxtools/internal/cdt/libhover/LibHover.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ public static void saveLibraries(IPath locationBase, IPreferenceStore ps) {
128128
try (FileOutputStream f = new FileOutputStream(locationDir.append("tmpFile").toOSString()); //$NON-NLS-1$
129129
ObjectOutputStream out = new ObjectOutputStream(f)) {
130130
out.writeObject(l.getHoverInfo());
131-
out.close();
132131
File tmp = new File(locationDir.append("tmpFile").toOSString()); //$NON-NLS-1$
133132
tmp.renameTo(target);
134133
}

profiling/org.eclipse.linuxtools.ssh.proxy/src/org/eclipse/linuxtools/internal/ssh/proxy/SSHProxyManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public Map<String, String> getEnv(URI uri) throws CoreException {
9595
if((errorLine = error.readLine()) != null){
9696
throw new IOException(errorLine);
9797
}
98-
error.close();
9998
} catch (IOException e) {
10099
Activator.getDefault().getLog().log(Status.error(e.getMessage(), e));
101100
return Collections.emptyMap();

systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/Helper.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*******************************************************************************
22
* Copyright (c) 2009, 2018 Red Hat, Inc.
3-
*
3+
*
44
* This program and the accompanying materials are made
55
* available under the terms of the Eclipse Public License 2.0
66
* which is available at https://www.eclipse.org/legal/epl-2.0/
@@ -15,7 +15,6 @@
1515
import java.io.BufferedReader;
1616
import java.io.BufferedWriter;
1717
import java.io.File;
18-
import java.io.FileNotFoundException;
1918
import java.io.FileReader;
2019
import java.io.FileWriter;
2120
import java.io.IOException;
@@ -53,11 +52,7 @@ public static String readFile(String absoluteFilePath) {
5352
while ((tmp = bw.readLine()) != null) {
5453
output+=tmp + "\n"; //$NON-NLS-1$
5554
}
56-
bw.close();
57-
5855
return output;
59-
} catch (FileNotFoundException e) {
60-
e.printStackTrace();
6156
} catch (IOException e) {
6257
e.printStackTrace();
6358
}
@@ -69,8 +64,7 @@ public static BufferedWriter setBufferedWriter(String absoluteFilePath) {
6964
File f = new File(absoluteFilePath);
7065
f.delete();
7166
f.createNewFile();
72-
FileWriter fstream;
73-
fstream = new FileWriter(absoluteFilePath, true);
67+
FileWriter fstream = new FileWriter(absoluteFilePath, true);
7468
return new BufferedWriter(fstream);
7569
} catch (IOException e) {
7670
SystemTapUIErrorMessages err = new SystemTapUIErrorMessages

systemtap/org.eclipse.linuxtools.callgraph.core/src/org/eclipse/linuxtools/internal/callgraph/core/SystemTapErrorHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public void handle(IProgressMonitor m, String errors) {
5454

5555
// READ FROM THE PROP FILE AND DETERMINE TYPE OF ERROR
5656
File file = new File(PluginConstants.getPluginLocation() + FILE_PROP);
57-
try (BufferedReader buff1 = new BufferedReader(new FileReader(file))) {
57+
try {
5858
String line;
5959
for (String message : errorsList) {
6060
try (BufferedReader innerBuff = new BufferedReader(

systemtap/org.eclipse.linuxtools.callgraph.launch/src/org/eclipse/linuxtools/internal/callgraph/launch/LaunchStapGraph.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ private String writeFromPartialScript(String projectName) throws IOException {
164164
while ((temp = scriptReader.readLine()) != null) {
165165
toWrite += temp + "\n"; //$NON-NLS-1$
166166
}
167-
scriptReader.close();
168167
}
169168

170169
return toWrite;

systemtap/org.eclipse.linuxtools.systemtap.graphing.core/src/org/eclipse/linuxtools/systemtap/graphing/core/datasets/table/TableDataSet.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ public boolean readFromFile(File file) {
6767
entry.add(line.split(", ")); //$NON-NLS-1$
6868
}
6969
}
70-
br.close();
7170
return true;
7271
} catch(IOException|ArrayIndexOutOfBoundsException e) {}
7372
return false;

systemtap/org.eclipse.linuxtools.systemtap.ui.ide.tests/src/org/eclipse/linuxtools/systemtap/ui/ide/test/editors/stp/STPCompletionProcessorTest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@
1818
import static org.junit.Assert.assertTrue;
1919
import static org.junit.Assert.fail;
2020

21-
import java.io.FileOutputStream;
2221
import java.io.IOException;
2322
import java.io.InputStream;
24-
import java.io.OutputStream;
2523
import java.nio.file.Files;
2624
import java.nio.file.StandardCopyOption;
2725

@@ -82,8 +80,7 @@ public static void prepareTrees() {
8280
path = path.append("TreeSettings").addFileExtension("xml"); //$NON-NLS-1$ //$NON-NLS-2$
8381

8482
try (InputStream is = FileLocator.openStream(FrameworkUtil.getBundle(STPCompletionProcessorTest.class),
85-
new Path("helpers/TreeSettings.xml"), false);
86-
OutputStream outStream = new FileOutputStream(path.toFile())) {
83+
new Path("helpers/TreeSettings.xml"), false)) {
8784
Files.copy(is, path.toFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
8885
TapsetLibrary.readTreeFile();
8986
} catch (IOException e) {

systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/editors/stp/STPEditor.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ public void doSaveAs() {
185185
try (FileOutputStream fos = new FileOutputStream(file);
186186
PrintStream ps = new PrintStream(fos)){
187187
ps.print(s);
188-
ps.close();
189188
} catch (IOException fnfe) {
190189
// Pass
191190
}

0 commit comments

Comments
 (0)