From 233d2592a499a09986353cf3ebb98d387c389706 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 21 Sep 2016 21:51:26 +0200 Subject: [PATCH] UGHUtils: Fix resource leak CID 44587 (#1 of 1): Resource leak on an exceptional path (RESOURCE_LEAK) Signed-off-by: Stefan Weil --- .../plugin/CataloguePlugin/PicaPlugin/UGHUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Goobi/plugins/opac/PicaPlugin/org/goobi/production/plugin/CataloguePlugin/PicaPlugin/UGHUtils.java b/Goobi/plugins/opac/PicaPlugin/org/goobi/production/plugin/CataloguePlugin/PicaPlugin/UGHUtils.java index b15ad0c8a4f..a8dd563eadd 100644 --- a/Goobi/plugins/opac/PicaPlugin/org/goobi/production/plugin/CataloguePlugin/PicaPlugin/UGHUtils.java +++ b/Goobi/plugins/opac/PicaPlugin/org/goobi/production/plugin/CataloguePlugin/PicaPlugin/UGHUtils.java @@ -198,8 +198,7 @@ static void replaceMetadatum(DocStruct inStruct, Prefs inPrefs, String inMetadat // TODO: Create a own class for iso 639 (?) Mappings or move this to UGH static String convertLanguage(String inLanguage) { /* Datei zeilenweise durchlaufen und die Sprache vergleichen */ - try { - BufferedReader in = open(PicaPlugin.LANGUAGES_MAPPING_FILE); + try (BufferedReader in = open(PicaPlugin.LANGUAGES_MAPPING_FILE)) { String str; while ((str = in.readLine()) != null) { if (str.length() > 0 && str.split(" ")[1].equals(inLanguage)) { @@ -207,7 +206,6 @@ static String convertLanguage(String inLanguage) { return str.split(" ")[0]; } } - in.close(); } catch (IOException e) { } return inLanguage;