Handle ArrayIndexOutOfBoundsException for install_sessions.xml

When install_sessions.xml is corrupted, ArrayIndexOutOfBoundsException
was thrown. It causes booting failure so catch it.

Bug: 269072872
Test: Corrupt install_sessions.xml and reboot
Change-Id: I99324e91a2da13bc86d62086aead40cc16cac60b
This commit is contained in:
Jeongeun Song
2023-05-31 17:03:06 +09:00
committed by Alex Buynytskyy
parent 7502484675
commit c23e36b827

View File

@@ -511,7 +511,7 @@ public class PackageInstallerService extends IPackageInstaller.Stub implements
} }
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// Missing sessions are okay, probably first boot // Missing sessions are okay, probably first boot
} catch (IOException | XmlPullParserException e) { } catch (IOException | XmlPullParserException | ArrayIndexOutOfBoundsException e) {
Slog.wtf(TAG, "Failed reading install sessions", e); Slog.wtf(TAG, "Failed reading install sessions", e);
} finally { } finally {
IoUtils.closeQuietly(fis); IoUtils.closeQuietly(fis);