Revision: 6089 http://sourceforge.net/p/jump-pilot/code/6089 Author: edso Date: 2019-01-17 14:09:58 +0000 (Thu, 17 Jan 2019) Log Message: ----------- only try to read from url if the Shapefile was not created from a stream initially already
Modified Paths: -------------- core/trunk/src/org/geotools/shapefile/Shapefile.java Modified: core/trunk/src/org/geotools/shapefile/Shapefile.java =================================================================== --- core/trunk/src/org/geotools/shapefile/Shapefile.java 2019-01-17 14:08:36 UTC (rev 6088) +++ core/trunk/src/org/geotools/shapefile/Shapefile.java 2019-01-17 14:09:58 UTC (rev 6089) @@ -78,23 +78,24 @@ public void close() { try { if (shpInputStream != null) shpInputStream.close(); - } - catch (IOException ex){ + } + catch (IOException ex){ Logger.error(ex); } } private EndianDataInputStream getInputStream() throws IOException { - try { + if (shpInputStream == null && baseURL != null) { + try { URLConnection uc = baseURL.openConnection(); // a 16 kb buffer may be up to 20% faster than the default 2 kb buffer - shpInputStream = new BufferedInputStream(uc.getInputStream(), 16*1024); - } - catch (Exception e){ + shpInputStream = new BufferedInputStream(uc.getInputStream(), 16 * 1024); + } catch (Exception e) { Logger.error(e); - } - if (shpInputStream == null) { + } + if (shpInputStream == null) { throw new IOException("Couldn't make a connection to the URL: " + baseURL); + } } return new EndianDataInputStream(shpInputStream); } _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel