X-Git-Url: https://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Ffunction%2Fsrtm%2FTileFinder.java;h=afcc28f274a2634b3bb74de613fa4cb653630a92;hp=209db7f58d439208caa363097236f40805957640;hb=7f5ed2be62905bd37717376dc22d09e5ea7edb4d;hpb=b361869e590bbca32664c16ac24d6296926594a5 diff --git a/tim/prune/function/srtm/TileFinder.java b/tim/prune/function/srtm/TileFinder.java index 209db7f..afcc28f 100644 --- a/tim/prune/function/srtm/TileFinder.java +++ b/tim/prune/function/srtm/TileFinder.java @@ -54,10 +54,11 @@ public abstract class TileFinder */ private static byte[] readDatFile() { + InputStream in = null; try { // Need absolute path to dat file - InputStream in = TileFinder.class.getResourceAsStream("/tim/prune/function/srtm/srtmtiles.dat"); + in = TileFinder.class.getResourceAsStream("/tim/prune/function/srtm/srtmtiles.dat"); if (in != null) { byte[] buffer = new byte[in.available()]; @@ -69,6 +70,13 @@ public abstract class TileFinder catch (java.io.IOException e) { System.err.println("Exception trying to read srtmtiles.dat : " + e.getMessage()); } + finally + { + try { + in.close(); + } + catch (Exception e) {} // ignore + } return null; } }