summaryrefslogtreecommitdiff
path: root/emulator
diff options
context:
space:
mode:
authorSergey Prigogin <sprigogin@google.com>2022-02-17 11:39:25 -0800
committerSergey Prigogin <sprigogin@google.com>2022-02-17 23:10:45 +0000
commit443328d1c3e0e236900b805f52a380d0d501d7f3 (patch)
treedd9fff8492a322901ef217f737960de2811aaa53 /emulator
parent33a53ec39f477d2caa86b991e3a05c6cbb935cc5 (diff)
downloadidea-443328d1c3e0e236900b805f52a380d0d501d7f3.tar.gz
Log ImageConverter initialization problems as errors rather than warnings
Test: existing Bug: 220022493 Change-Id: I2501c5c227f1ebc528d99e52c0c0a66db8163d27
Diffstat (limited to 'emulator')
-rw-r--r--emulator/src/com/android/emulator/ImageConverter.java16
1 files changed, 3 insertions, 13 deletions
diff --git a/emulator/src/com/android/emulator/ImageConverter.java b/emulator/src/com/android/emulator/ImageConverter.java
index da76517a860..53a45d2fe5e 100644
--- a/emulator/src/com/android/emulator/ImageConverter.java
+++ b/emulator/src/com/android/emulator/ImageConverter.java
@@ -20,7 +20,6 @@ import static com.android.tools.idea.util.StudioPathManager.isRunningFromSources
import com.android.tools.idea.protobuf.ByteString;
import com.android.tools.idea.protobuf.UnsafeByteOperations;
import com.android.tools.idea.util.StudioPathManager;
-import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.SystemInfo;
@@ -43,7 +42,7 @@ public class ImageConverter {
initByteStringFields();
}
catch (Throwable e) {
- logError("Native image converter library is not available", e);
+ logger().error("Native image converter library is not available", e);
}
}
@@ -150,19 +149,10 @@ public class ImageConverter {
offsetField = byteStringClass.getDeclaredField("bytesOffset");
offsetField.setAccessible(true);
}
- catch (NoSuchFieldException e) {
- logError("Unable to access fields of " + byteStringClass.getName(), e);
+ catch (ReflectiveOperationException | RuntimeException e) {
bytesField = null;
offsetField = null;
- }
- }
-
- private static void logError(@NotNull String message, @NotNull Throwable e) {
- if (ApplicationManager.getApplication() == null || ApplicationManager.getApplication().isUnitTestMode()) {
- logger().error(message, e); // Test mode.
- }
- else {
- logger().warn(message, e);
+ throw new RuntimeException("Unable to access fields of " + byteStringClass.getName(), e);
}
}