X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.tmf.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Ftmf%2Fui%2Fviews%2Fcallstack%2FFunctionNameMapper.java;h=9c56c8c817b942920a4e818dde04bc1b520cc757;hb=507b1336fb237092ac81b047139e42677e5b61ac;hp=cf8823952b3116f893e8eb3923cc505d1bdf7a51;hpb=5489624ba48d148fd13938e056fa50a3eb4fb93f;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java index cf8823952b..9c56c8c817 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/views/callstack/FunctionNameMapper.java @@ -31,17 +31,10 @@ import org.eclipse.jdt.annotation.Nullable; class FunctionNameMapper { public static @Nullable Map mapFromNmTextFile(File mappingFile) { - Map map = new HashMap(); + Map map = new HashMap<>(); - FileReader fr; - try { - fr = new FileReader(mappingFile); - } catch (FileNotFoundException e) { - return null; - } - BufferedReader reader = new BufferedReader(fr); - - try { + try (FileReader fr = new FileReader(mappingFile); + BufferedReader reader = new BufferedReader(fr);) { for (String line = reader.readLine(); line != null; line = reader.readLine()) { String[] elems = line.split(" "); //$NON-NLS-1$ /* Only lines with 3 elements contain addresses */ @@ -52,13 +45,10 @@ class FunctionNameMapper { map.put(address, name); } } - + } catch (FileNotFoundException e) { + return null; } catch (IOException e) { /* Stop reading the file at this point */ - } finally { - try { - reader.close(); - } catch (IOException e) {} } if (map.isEmpty()) {