1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-28 09:24:14 +01:00

Use PreferencesData.getInteger when applicable

This commit is contained in:
Cristian Maglie 2021-12-20 12:55:10 +01:00
parent 66a973af18
commit c16b9f5f26

View File

@ -65,9 +65,7 @@ public class HttpConnectionManager {
userAgent = PreferencesData.get("http.user_agent", defaultUserAgent);
int connectTimeoutFromConfig = 5000;
try {
connectTimeoutFromConfig =
Integer.parseInt(
PreferencesData.get("http.connection_timeout_ms", "5000"));
connectTimeoutFromConfig = PreferencesData.getInteger("http.connection_timeout_ms", 5000);
} catch (NumberFormatException e) {
System.err.println("Error parsing http.connection_timeout_ms config: " + e.getMessage());
}
@ -75,9 +73,7 @@ public class HttpConnectionManager {
// Set by default 20 max redirect to follow
int maxRedirectNumberConfig = 20;
try {
maxRedirectNumberConfig =
Integer.parseInt(
PreferencesData.get("http.max_redirect_number", "20"));
maxRedirectNumberConfig = PreferencesData.getInteger("http.max_redirect_number", 20);
} catch (NumberFormatException e) {
System.err.println("Error parsing http.max_redirect_number config: " + e.getMessage());
}