mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Throw exception after 5 attempts
This commit is contained in:
parent
c7b90f61f7
commit
c6617324af
1 changed files with 8 additions and 4 deletions
|
@ -118,7 +118,7 @@ public class EssentialsConf extends YamlConfiguration
|
||||||
{
|
{
|
||||||
final FileChannel channel = inputStream.getChannel();
|
final FileChannel channel = inputStream.getChannel();
|
||||||
final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length());
|
final ByteBuffer buffer = ByteBuffer.allocate((int)configFile.length());
|
||||||
boolean retry;
|
int retry = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -133,15 +133,19 @@ public class EssentialsConf extends YamlConfiguration
|
||||||
{
|
{
|
||||||
channel.read(buffer, left);
|
channel.read(buffer, left);
|
||||||
}
|
}
|
||||||
retry = false;
|
retry = 0;
|
||||||
}
|
}
|
||||||
catch (ClosedByInterruptException ex)
|
catch (ClosedByInterruptException ex)
|
||||||
{
|
{
|
||||||
buffer.rewind();
|
buffer.rewind();
|
||||||
retry = true;
|
retry++;
|
||||||
|
if (retry >= 5)
|
||||||
|
{
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (retry);
|
while (retry > 0);
|
||||||
buffer.rewind();
|
buffer.rewind();
|
||||||
final CharBuffer data = CharBuffer.allocate((int)configFile.length());
|
final CharBuffer data = CharBuffer.allocate((int)configFile.length());
|
||||||
CharsetDecoder decoder = UTF8.newDecoder();
|
CharsetDecoder decoder = UTF8.newDecoder();
|
||||||
|
|
Loading…
Reference in a new issue