Upstream merge

This commit is contained in:
Zach Brown
2014-07-08 16:10:12 -05:00
parent f50d1233d4
commit 18df89d601
10 changed files with 61 additions and 116 deletions

View File

@@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Sat, 5 Jul 2014 16:56:44 +0100
Subject: [PATCH] Add more information to some world crashes
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
}
} catch (IOException ioexception) {
ioexception.printStackTrace();
- throw new RuntimeException("Failed to check session lock, aborting");
+ throw new RuntimeException("Failed to check session lock for world located at " + this.baseDir + ", aborting. Stop the server and delete the session.lock in this world to prevent further issues."); // PaperSpigot
}
}
@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
try {
if (datainputstream.readLong() != this.sessionId) {
- throw new ExceptionWorldConflict("The save is being accessed from another location, aborting");
+ throw new ExceptionWorldConflict("The save for world located at " + this.baseDir + " is being accessed from another location, aborting"); // PaperSpigot
}
} finally {
datainputstream.close();
}
} catch (IOException ioexception) {
- throw new ExceptionWorldConflict("Failed to check session lock, aborting");
+ throw new ExceptionWorldConflict("Failed to check session lock for world located at " + this.baseDir + ", aborting. Stop the server and delete the session.lock in this world to prevent further issues."); // PaperSpigot
}
}
--

View File

@@ -1,65 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Suddenly <suddenly@suddenly.coffee>
Date: Mon, 16 Jun 2014 14:44:21 +0100
Subject: [PATCH] Make JSON errors more friendly and less crashy
diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/JsonList.java
+++ b/src/main/java/net/minecraft/server/JsonList.java
@@ -0,0 +0,0 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
+import java.io.FileNotFoundException; // PaperSpigot
+import java.util.logging.Level; // PaperSpigot
import net.minecraft.util.com.google.common.base.Charsets;
import net.minecraft.util.com.google.common.collect.Lists;
@@ -0,0 +0,0 @@ import net.minecraft.util.com.google.gson.JsonObject;
import net.minecraft.util.org.apache.commons.io.IOUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import net.minecraft.util.com.google.gson.JsonSyntaxException; // PaperSpigot
public class JsonList {
@@ -0,0 +0,0 @@ public class JsonList {
try {
bufferedreader = Files.newReader(this.c, Charsets.UTF_8);
collection = (Collection) this.b.fromJson(bufferedreader, f);
+ } catch (FileNotFoundException e) { // PaperSpigot Start
+ org.bukkit.Bukkit.getLogger().log(Level.WARNING, "Unable to find file {0}, creating new {0}.", this.c);
+ } catch (JsonSyntaxException jsonSyntaxEception) {
+ org.bukkit.Bukkit.getLogger().log(Level.WARNING, "Unable to read file {0}, backing up {0} at {0}.backup and creating new {0}.", this.c);
+ File backup = new File(this.c + ".backup");
+ this.c.renameTo(backup);
+ this.c.delete(); // PaperSpigot End
} finally {
IOUtils.closeQuietly(bufferedreader);
}
diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/UserCache.java
+++ b/src/main/java/net/minecraft/server/UserCache.java
@@ -0,0 +0,0 @@ import net.minecraft.util.com.google.gson.GsonBuilder;
import net.minecraft.util.com.mojang.authlib.Agent;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.org.apache.commons.io.IOUtils;
+import net.minecraft.util.com.google.gson.JsonSyntaxException; // PaperSpigot
public class UserCache {
@@ -0,0 +0,0 @@ public class UserCache {
break label81;
} catch (FileNotFoundException filenotfoundexception) {
;
+ } catch (JsonSyntaxException jsonSyntaxEception) { // PaperSpigot Start
+ System.err.printf("Usercache.json is corrupted or has bad formatting.");
+ System.err.printf("Deleting usercache.json to prevent further issues.");
+ this.g.delete(); // PaperSpigot End
} finally {
IOUtils.closeQuietly(bufferedreader);
}
--