MCPcopy Create free account
hub / github.com/facebook/SoLoader / recover

Method recover

java/com/facebook/soloader/SoLoader.java:950–986  ·  view source on GitHub ↗
(
      String soName, UnsatisfiedLinkError e, @Nullable RecoveryStrategy recovery)

Source from the content-addressed store, hash-verified

948 }
949
950 @SuppressLint("CatchGeneralException")
951 private static RecoveryStrategy recover(
952 String soName, UnsatisfiedLinkError e, @Nullable RecoveryStrategy recovery) {
953 LogUtil.w(TAG, "Running a recovery step for " + soName + " due to " + e.toString());
954 sSoSourcesLock.writeLock().lock();
955 try {
956 if (recovery == null) {
957 recovery = getRecoveryStrategy();
958 if (recovery == null) {
959 LogUtil.w(TAG, "No recovery strategy");
960 throw e;
961 }
962 }
963 if (recoverLocked(e, recovery)) {
964 sSoSourcesVersion.getAndIncrement();
965 return recovery;
966 }
967 } catch (NoBaseApkException noBaseApkException) {
968 // If we failed during recovery, we only want to throw the recovery exception for the case
969 // when the base APK path does not exist, everything else should preserve the initial
970 // error.
971 LogUtil.e(TAG, "Base APK not found during recovery", noBaseApkException);
972 throw noBaseApkException;
973 } catch (Exception recoveryException) {
974 LogUtil.e(
975 TAG,
976 "Got an exception during recovery, will throw the initial error instead",
977 recoveryException);
978 throw e;
979 } finally {
980 sSoSourcesLock.writeLock().unlock();
981 }
982
983 // No recovery mechanism worked, throwing initial error
984 LogUtil.w(TAG, "Failed to recover");
985 throw e;
986 }
987
988 @SuppressLint({"CatchGeneralException", "EmptyCatchBlock"})
989 private static boolean recoverLocked(UnsatisfiedLinkError e, RecoveryStrategy recovery) {

Callers 1

loadLibraryBySoNameMethod · 0.95

Calls 6

wMethod · 0.95
getRecoveryStrategyMethod · 0.95
recoverLockedMethod · 0.95
eMethod · 0.95
lockMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected