Avoid to change network with 421

This commit is contained in:
tom79 2019-10-29 15:08:39 +01:00
parent 485cf33af2
commit 9d37f34835
1 changed files with 22 additions and 19 deletions

View File

@ -782,10 +782,16 @@ public class API {
} catch (NoSuchAlgorithmException | KeyManagementException | JSONException e1) {
e1.printStackTrace();
} catch (HttpsConnection.HttpsConnectionException e1) {
instanceNodeInfo.setName("GNU");
instanceNodeInfo.setVersion("unknown");
instanceNodeInfo.setOpenRegistrations(true);
e1.printStackTrace();
if( e1.getStatusCode() == 404) {
instanceNodeInfo.setName("GNU");
instanceNodeInfo.setVersion("unknown");
instanceNodeInfo.setOpenRegistrations(true);
e1.printStackTrace();
}else{
instanceNodeInfo.setName("MASTODON");
instanceNodeInfo.setVersion("3.0");
instanceNodeInfo.setOpenRegistrations(false);
}
}
e.printStackTrace();
}
@ -826,11 +832,7 @@ public class API {
} catch (JSONException e) {
setDefaultError(e);
}
} catch (IOException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (KeyManagementException e) {
} catch (IOException | JSONException | NoSuchAlgorithmException | KeyManagementException e) {
e.printStackTrace();
} catch (HttpsConnection.HttpsConnectionException e) {
try {
@ -842,20 +844,21 @@ public class API {
} catch (IOException e1) {
instanceNodeInfo.setConnectionError(true);
e1.printStackTrace();
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
} catch (KeyManagementException e1) {
} catch (NoSuchAlgorithmException | JSONException | KeyManagementException e1) {
e1.printStackTrace();
} catch (HttpsConnection.HttpsConnectionException e1) {
instanceNodeInfo.setName("GNU");
instanceNodeInfo.setVersion("unknown");
instanceNodeInfo.setOpenRegistrations(true);
} catch (JSONException e1) {
e1.printStackTrace();
if( e1.getStatusCode() == 404) {
instanceNodeInfo.setName("GNU");
instanceNodeInfo.setVersion("unknown");
instanceNodeInfo.setOpenRegistrations(true);
e1.printStackTrace();
}else{
instanceNodeInfo.setName("MASTODON");
instanceNodeInfo.setVersion("3.0");
instanceNodeInfo.setOpenRegistrations(false);
}
}
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
return instanceNodeInfo;
}