mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-06 04:23:02 +00:00
Fix serious bug in Dev2.7.137 - Dev2.7.144: if spawn.yml is not present, the server will run into a deadlock.
This commit is contained in:
parent
b9077d91a5
commit
854fc05c5b
1 changed files with 21 additions and 22 deletions
|
@ -6,6 +6,7 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.yaml.snakeyaml.error.YAMLException;
|
import org.yaml.snakeyaml.error.YAMLException;
|
||||||
|
@ -30,39 +31,37 @@ public abstract class AbstractDelayedYamlFileReader<T extends StorageObject> imp
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
FileReader reader = null;
|
onStart();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
onStart();
|
final FileReader reader = new FileReader(file);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
reader = new FileReader(file);
|
final T object = new YamlStorageReader(reader, plugin).load(clazz);
|
||||||
T object = new YamlStorageReader(reader, plugin).load(clazz);
|
|
||||||
onSuccess(object);
|
onSuccess(object);
|
||||||
}
|
}
|
||||||
catch (ObjectLoadException ex)
|
finally
|
||||||
{
|
{
|
||||||
onException();
|
try
|
||||||
Bukkit.getLogger().log(Level.SEVERE, "File broken: " + file.toString(), ex.getCause());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (FileNotFoundException ex)
|
|
||||||
{
|
|
||||||
Bukkit.getLogger().log(Level.SEVERE, file.toString(), ex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (reader != null)
|
|
||||||
{
|
{
|
||||||
reader.close();
|
reader.close();
|
||||||
}
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
Bukkit.getLogger().log(Level.SEVERE, "File can't be closed: " + file.toString(), ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
|
||||||
{
|
}
|
||||||
Bukkit.getLogger().log(Level.SEVERE, ex.getMessage(), ex);
|
catch (FileNotFoundException ex)
|
||||||
}
|
{
|
||||||
|
onException();
|
||||||
|
Bukkit.getLogger().log(Level.WARNING, "File not found: " + file.toString());
|
||||||
|
}
|
||||||
|
catch (ObjectLoadException ex)
|
||||||
|
{
|
||||||
|
onException();
|
||||||
|
Bukkit.getLogger().log(Level.SEVERE, "File broken: " + file.toString(), ex.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue