Skip to content

Conversation

@copybara-service
Copy link

Fix iOS crash by handling ENOENT file not found exception in Posix

The fix modifies the access native method in Posix.java to return false (NO) instead of throwing an ErrnoException when the system error code is ENOENT (file not found). This prevents the application from crashing when LogManager (triggered implicitly by Guava's Platform initialization) checks for the existence of configuration files that are not present on iOS. By treating a missing file as a simple boolean failure rather than a fatal exception, File.exists() behaves correctly, allowing the logging system to fall back to its default configuration gracefully.

The fix modifies the access native method in Posix.java to return false (NO) instead of throwing an ErrnoException when the system error code is ENOENT (file not found). This prevents the application from crashing when LogManager (triggered implicitly by Guava's Platform initialization) checks for the existence of configuration files that are not present on iOS. By treating a missing file as a simple boolean failure rather than a fatal exception, File.exists() behaves correctly, allowing the logging system to fall back to its default configuration gracefully.

PiperOrigin-RevId: 859227465
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant