String result = login.getResponseBodyAsString();
login.releaseConnection();
if (result.indexOf("Site Unavailable") != -1) {
String pattern = RESOURCES.getString("login.siteUnavailable");
throw new LoginException(MessageFormat.format(pattern, getName()));
}
if (result.indexOf("password combination is invalid") != -1) {
throw new LoginException(RESOURCES.getString("login.invalidUserPass"));
}
if (result.indexOf("We could not find your login information") != -1) {
throw new LoginException(RESOURCES.getString("login.invalidUserPass"));
}
if (result.indexOf("Sign In") != -1) {
throw new LoginException(RESOURCES.getString("login.invalidUserPass"));
}
if (code >= 400 && result.indexOf("Movies in Queue") == -1) {
String pattern = RESOURCES.getString("login.internalError");
throw new LoginException(MessageFormat.format(pattern, getName()));
}
} catch (IOException e) {
LoginException io = new LoginException("A server error occurred when logging in user.");
io.initCause(e);
throw io;
}
//now force the queue to be synced up so that we will know what is in the queue
//and what isn't