People don't care if updater sites are down

This commit is contained in:
Dan Mulloy 2017-02-04 12:12:31 -05:00
parent 98413c917e
commit 3ab2026d62
3 changed files with 10 additions and 9 deletions

View File

@ -354,11 +354,12 @@ public class BukkitUpdater extends Updater {
this.plugin.getLogger().warning("Please double-check your configuration to ensure it is correct."); this.plugin.getLogger().warning("Please double-check your configuration to ensure it is correct.");
this.result = UpdateResult.FAIL_APIKEY; this.result = UpdateResult.FAIL_APIKEY;
} else { } else {
this.plugin.getLogger().warning("The updater could not contact dev.bukkit.org for updating."); // People don't care
this.plugin.getLogger().warning("If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime."); // this.plugin.getLogger().warning("The updater could not contact dev.bukkit.org for updating.");
// this.plugin.getLogger().warning("If you have not recently modified your configuration and this is the first time you are seeing this message, the site may be experiencing temporary downtime.");
this.result = UpdateResult.FAIL_DBO; this.result = UpdateResult.FAIL_DBO;
} }
e.printStackTrace(); // e.printStackTrace();
return false; return false;
} }
} }

View File

@ -21,7 +21,6 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.logging.Level;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
@ -75,7 +74,8 @@ public final class SpigotUpdater extends Updater {
ProtocolLibrary.getErrorReporter().reportDetailed( ProtocolLibrary.getErrorReporter().reportDetailed(
SpigotUpdater.this, Report.newBuilder(REPORT_CANNOT_UPDATE_PLUGIN).error(ex).callerParam(this)); SpigotUpdater.this, Report.newBuilder(REPORT_CANNOT_UPDATE_PLUGIN).error(ex).callerParam(this));
} else { } else {
plugin.getLogger().log(Level.WARNING, "Failed to check for updates: " + ex); // People don't care
// plugin.getLogger().log(Level.WARNING, "Failed to check for updates: " + ex);
} }
ProtocolLibrary.disableUpdates(); ProtocolLibrary.disableUpdates();

View File

@ -23,21 +23,21 @@ public class UpdaterTest {
private static final int BUKKIT_DEV_ID = 45564; private static final int BUKKIT_DEV_ID = 45564;
private static Plugin plugin; private static Plugin plugin;
//@BeforeClass // @BeforeClass
public static void preparePlugin() { public static void preparePlugin() {
Server server = mock(Server.class); Server server = mock(Server.class);
when(server.getUpdateFolder()).thenReturn(null); when(server.getUpdateFolder()).thenReturn(null);
plugin = mock(Plugin.class); plugin = mock(Plugin.class);
String version = System.getProperty("projectVersion"); String version = System.getProperty("projectVersion");
if (version == null) version = "4.0.1-SNAPSHOT-b281"; if (version == null) version = "4.2.1";
when(plugin.getDescription()).thenReturn(new PluginDescriptionFile("ProtocolLib", version, null)); when(plugin.getDescription()).thenReturn(new PluginDescriptionFile("ProtocolLib", version, null));
when(plugin.getLogger()).thenReturn(Logger.getLogger("ProtocolLib")); when(plugin.getLogger()).thenReturn(Logger.getLogger("ProtocolLib"));
when(plugin.getDataFolder()).thenReturn(null); when(plugin.getDataFolder()).thenReturn(null);
when(plugin.getServer()).thenReturn(server); when(plugin.getServer()).thenReturn(server);
} }
//@Test // @Test
public void testSpigotUpdater() { public void testSpigotUpdater() {
SpigotUpdater updater = new SpigotUpdater(plugin, UpdateType.NO_DOWNLOAD, true); SpigotUpdater updater = new SpigotUpdater(plugin, UpdateType.NO_DOWNLOAD, true);
@ -54,7 +54,7 @@ public class UpdaterTest {
System.out.println("Update available: " + updater.versionCheck(remote)); System.out.println("Update available: " + updater.versionCheck(remote));
} }
//@Test // @Test
public void testBukkitUpdater() { public void testBukkitUpdater() {
BukkitUpdater updater = new BukkitUpdater(plugin, BUKKIT_DEV_ID, null, UpdateType.NO_DOWNLOAD, true); BukkitUpdater updater = new BukkitUpdater(plugin, BUKKIT_DEV_ID, null, UpdateType.NO_DOWNLOAD, true);
if (! updater.read()) { if (! updater.read()) {