Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-06-29 06:33:59 -0400
committerLars Vogel2018-07-02 06:45:56 -0400
commitb43bdd20e2065dd2c9a1989e4dc442d9627181ab (patch)
tree0a33c22c9181406a52f65e15d0f877025d4aedfa
parentbf9ca91ae4d8e096566a9058fb724ec22a87f27a (diff)
downloadeclipse.platform.team-b43bdd20e2065dd2c9a1989e4dc442d9627181ab.tar.gz
eclipse.platform.team-b43bdd20e2065dd2c9a1989e4dc442d9627181ab.tar.xz
eclipse.platform.team-b43bdd20e2065dd2c9a1989e4dc442d9627181ab.zip
Minor cleanup of org.eclipse.compare.examples
Removes unless see comments and uses try with resources Change-Id: I30d26d8eeaaa3c4c51f7e1cf43c5b2d45ee3f4ca Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/KeyValuePairStructureCreator.java6
-rw-r--r--examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java15
2 files changed, 3 insertions, 18 deletions
diff --git a/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/KeyValuePairStructureCreator.java b/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/KeyValuePairStructureCreator.java
index 2f6a26077..40bd7c073 100644
--- a/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/KeyValuePairStructureCreator.java
+++ b/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/KeyValuePairStructureCreator.java
@@ -49,9 +49,6 @@ public class KeyValuePairStructureCreator implements IStructureCreator {
return fValue;
}
- /*
- * @see ITypedElement#getName
- */
@Override
public String getName() {
return this.getId();
@@ -66,9 +63,6 @@ public class KeyValuePairStructureCreator implements IStructureCreator {
return "kvtxt"; //$NON-NLS-1$
}
- /*
- * @see ITypedElement#getImage
- */
@Override
public Image getImage() {
return CompareUI.getImage(getType());
diff --git a/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java b/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java
index 6347dbea3..3b262d53c 100644
--- a/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java
+++ b/examples/org.eclipse.compare.examples/src/org/eclipse/compare/examples/structurecreator/Util.java
@@ -42,12 +42,11 @@ public class Util {
private static String readString(InputStream is, String encoding) {
if (is == null)
return null;
- BufferedReader reader= null;
- try {
+ try (BufferedReader reader=new BufferedReader(new InputStreamReader(is, encoding)))
+ {
StringBuilder buffer= new StringBuilder();
char[] part= new char[2048];
int read= 0;
- reader= new BufferedReader(new InputStreamReader(is, encoding));
while ((read= reader.read(part)) != -1)
buffer.append(part, 0, read);
@@ -56,15 +55,7 @@ public class Util {
} catch (IOException ex) {
// silently ignored
- } finally {
- if (reader != null) {
- try {
- reader.close();
- } catch (IOException ex) {
- // we don't log IOException when closing a file
- }
- }
- }
+ }
return null;
}

Back to the top