空指针修正
This commit is contained in:
parent
f9c9727fcf
commit
9016410765
|
|
@ -9,6 +9,7 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -29,11 +30,14 @@ public class LocationHolidayDataManager extends AbstractHolidayDataManager {
|
||||||
@Override
|
@Override
|
||||||
public List<Holiday> flushData() {
|
public List<Holiday> flushData() {
|
||||||
String configPath = config.getConfigPath() != null ? config.getConfigPath().trim() : "classpath:holiday";
|
String configPath = config.getConfigPath() != null ? config.getConfigPath().trim() : "classpath:holiday";
|
||||||
File dir;
|
File dir = new File(configPath);
|
||||||
if (configPath.startsWith("classpath:")) {
|
if (configPath.startsWith("classpath:")) {
|
||||||
String path = configPath.substring("classpath:".length());
|
String path = configPath.substring("classpath:".length());
|
||||||
try {
|
try {
|
||||||
dir = new File(this.getClass().getClassLoader().getResource(path).toURI());
|
URL resource = this.getClass().getClassLoader().getResource(path);
|
||||||
|
if (resource != null) {
|
||||||
|
dir = new File(resource.toURI());
|
||||||
|
}
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue