Catch UnknownHostException and write a friendlier warning.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han 2015-06-12 14:52:31 -05:00
parent 44da08d7a1
commit 101425a562
2 changed files with 9 additions and 2 deletions

View File

@ -479,7 +479,7 @@ public class BeatmapDB {
beatmap.epilepsyWarning = rs.getBoolean(35); beatmap.epilepsyWarning = rs.getBoolean(35);
String bg = rs.getString(36); String bg = rs.getString(36);
if (bg != null) if (bg != null)
beatmap.bg = new File(dir, BeatmapParser.getDBString(rs.getString(36))); beatmap.bg = new File(dir, BeatmapParser.getDBString(bg));
beatmap.sliderBorderFromString(rs.getString(37)); beatmap.sliderBorderFromString(rs.getString(37));
} catch (SQLException e) { } catch (SQLException e) {
throw e; throw e;

View File

@ -28,6 +28,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.net.URL; import java.net.URL;
import java.net.UnknownHostException;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
@ -35,6 +36,7 @@ import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion; import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.newdawn.slick.util.Log;
import org.newdawn.slick.util.ResourceLoader; import org.newdawn.slick.util.ResourceLoader;
/** /**
@ -206,7 +208,12 @@ public class Updater {
return; return;
// get latest version // get latest version
String s = Utils.readDataFromUrl(new URL(Options.VERSION_REMOTE)); String s = null;
try {
s = Utils.readDataFromUrl(new URL(Options.VERSION_REMOTE));
} catch (UnknownHostException e) {
Log.warn(String.format("Check for updates failed. Please check your internet connection, or your connection to %s.", Options.VERSION_REMOTE));
}
if (s == null) { if (s == null) {
status = Status.CONNECTION_ERROR; status = Status.CONNECTION_ERROR;
return; return;