profcollet: Fix possible NPE

If an exception contains no message, Log.e will throw NPE.

Test: presubmit
Bug: 223235958
Change-Id: Ie754776d3ef830dddbbb90dcc88e081706e96e6a
This commit is contained in:
Yi Kong
2022-03-08 15:08:08 +08:00
parent 0f839e536d
commit 522c74f532

View File

@@ -112,7 +112,7 @@ public final class ProfcollectForwardingService extends SystemService {
try {
mIProfcollect.registerProviderStatusCallback(mProviderStatusCallback);
} catch (RemoteException e) {
Log.e(LOG_TAG, e.getMessage());
Log.e(LOG_TAG, "Failed to register provider status callback: " + e.getMessage());
}
}
@@ -123,7 +123,7 @@ public final class ProfcollectForwardingService extends SystemService {
try {
return !mIProfcollect.get_supported_provider().isEmpty();
} catch (RemoteException e) {
Log.e(LOG_TAG, e.getMessage());
Log.e(LOG_TAG, "Failed to get supported provider: " + e.getMessage());
return false;
}
}
@@ -219,7 +219,8 @@ public final class ProfcollectForwardingService extends SystemService {
try {
sSelfService.mIProfcollect.process();
} catch (RemoteException e) {
Log.e(LOG_TAG, e.getMessage());
Log.e(LOG_TAG, "Failed to process profiles in background: "
+ e.getMessage());
}
});
return true;
@@ -264,7 +265,7 @@ public final class ProfcollectForwardingService extends SystemService {
try {
mIProfcollect.trace_once("applaunch");
} catch (RemoteException e) {
Log.e(LOG_TAG, e.getMessage());
Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
}
});
}
@@ -348,7 +349,7 @@ public final class ProfcollectForwardingService extends SystemService {
.putExtra("filename", reportName);
context.sendBroadcast(intent);
} catch (RemoteException e) {
Log.e(LOG_TAG, e.getMessage());
Log.e(LOG_TAG, "Failed to upload report: " + e.getMessage());
}
});
}