Fix: Crash on HTML response in EventRepository and others
- Fixed: Value <! DOCTYPE cannot be converted to JSONArray in EventRepository - Fixed: Added HTML validation in UpdateManager and DeviceRegistry - Fixed: Improved HTTP error handling in StreamUrlResolver - Improved: Error messages in PlayerActivity - Bumped version to 9.4.3
This commit is contained in:
@@ -81,6 +81,15 @@ public class DeviceRegistry {
|
||||
throw new IOException("HTTP " + response.code());
|
||||
}
|
||||
String responseText = response.body().string();
|
||||
|
||||
// Validar que no sea HTML antes de parsear
|
||||
if (responseText != null) {
|
||||
String trimmed = responseText.trim();
|
||||
if (trimmed.startsWith("<!") || trimmed.startsWith("<html")) {
|
||||
throw new IOException("El servidor devolvió HTML en lugar de JSON");
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject(responseText);
|
||||
JSONObject deviceJson = json.optJSONObject("device");
|
||||
JSONObject verificationJson = json.optJSONObject("verification");
|
||||
|
||||
Reference in New Issue
Block a user