Use path API

pull/307/head
Mikhail Mazurskiy 10 years ago
parent a0e954f858
commit 9479273470

@ -16,12 +16,13 @@
package com.zaxxer.hikari; package com.zaxxer.hikari;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
@ -800,8 +801,8 @@ public class HikariConfig implements HikariConfigMBean
protected void loadProperties(String propertyFileName) protected void loadProperties(String propertyFileName)
{ {
final File propFile = new File(propertyFileName); final Path propFile = Paths.get(propertyFileName);
try (final InputStream is = propFile.isFile() ? new FileInputStream(propFile) : this.getClass().getResourceAsStream(propertyFileName)) { try (final InputStream is = Files.isRegularFile(propFile) ? Files.newInputStream(propFile) : this.getClass().getResourceAsStream(propertyFileName)) {
if (is != null) { if (is != null) {
Properties props = new Properties(); Properties props = new Properties();
props.load(is); props.load(is);

Loading…
Cancel
Save