Stream is now properly recieved

This commit is contained in:
Sekwah 2018-06-06 15:19:03 +01:00 committed by Sekwah
parent 2f9a9622db
commit e12438e10e

View File

@ -83,7 +83,7 @@ public class DataStorage {
} }
if (!outFile.exists() || overwrite) { if (!outFile.exists() || overwrite) {
try { try {
InputStream inputStream = DataStorage.class.getResourceAsStream(fileLoc); InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileLoc);
if(inputStream == null) { if(inputStream == null) {
return false; return false;
} }
@ -125,8 +125,10 @@ public class DataStorage {
File inFile = new File(dataFolder, location); File inFile = new File(dataFolder, location);
if (inFile.exists() && !inFile.isDirectory()) { if (inFile.exists() && !inFile.isDirectory()) {
try { try {
System.out.println("OUTPUT 1");
return new FileInputStream(inFile); return new FileInputStream(inFile);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
System.out.println("OUTPUT 2");
e.printStackTrace(); e.printStackTrace();
return null; return null;
} }
@ -135,6 +137,7 @@ public class DataStorage {
copyDefaultFile(location, false); copyDefaultFile(location, false);
return this.getClass().getClassLoader().getResourceAsStream(location); return this.getClass().getClassLoader().getResourceAsStream(location);
} catch (NullPointerException e) { } catch (NullPointerException e) {
System.out.println("OUTPUT 4");
e.printStackTrace(); e.printStackTrace();
AdvancedPortalsCore.getInfoLogger().logWarning("Could not load " + location + ". The file does" + AdvancedPortalsCore.getInfoLogger().logWarning("Could not load " + location + ". The file does" +
"not exist or there has been an error reading the file."); "not exist or there has been an error reading the file.");