Handle exceptions better in supportsPusherCalc

This commit is contained in:
Olof Larsson 2016-01-21 13:07:22 +01:00
parent 0c2e624f10
commit 54c2b6f003

View File

@ -222,17 +222,32 @@ public class DriverFlatfile extends DriverAbstract
private boolean supportsPusher = this.supportsPusherCalc(); private boolean supportsPusher = this.supportsPusherCalc();
private boolean supportsPusherCalc() private boolean supportsPusherCalc()
{ {
boolean ret = false;
WatchService watchService = null;
try try
{ {
WatchService watchService = FileSystems.getDefault().newWatchService(); watchService = FileSystems.getDefault().newWatchService();
boolean ret = ! watchService.getClass().getName().equals("sun.nio.fs.PollingWatchService"); ret = ! watchService.getClass().getName().equals("sun.nio.fs.PollingWatchService");
watchService.close();
return ret;
} }
catch (IOException e) catch (Exception e)
{ {
throw new RuntimeException(e); e.printStackTrace();
} }
finally
{
try
{
if (watchService != null)
{
watchService.close();
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
return ret;
} }
@Override @Override