summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Dombroski <cdombroski@google.com>2023-04-04 18:22:37 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-04 18:22:37 +0000
commit5586fb1022f97f00191f3fe3e6d7b72277c27e4c (patch)
tree7982ce21871ad0040c2e35ff30b87c4a1e2ed071
parent6727a7415bfbee8be7b141e0c183dd887ca32b3f (diff)
parentdd1b8f2a3f94aa216ecd198dfa9973af51510b62 (diff)
downloadplatform_testing-5586fb1022f97f00191f3fe3e6d7b72277c27e4c.tar.gz
Fix NPE on STS BL am: 83236b4f91 am: d949138f01 am: 0dcb8cfa9e am: dd1b8f2a3f
Original change: https://googleplex-android-review.googlesource.com/c/platform/platform_testing/+/22438599 Change-Id: I8f44e0a18a8ad6d47a8fc2ba05acb77a6c45c36a Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java6
-rw-r--r--libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java6
2 files changed, 12 insertions, 0 deletions
diff --git a/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java b/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java
index 83ca09662..af1327125 100644
--- a/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java
+++ b/libraries/sts-common-util/device-side/src/com/android/sts/common/util/StsExtraBusinessLogicTestCase.java
@@ -34,6 +34,8 @@ import java.util.Optional;
/** The device-side implementation of StsLogic. */
public class StsExtraBusinessLogicTestCase extends ExtraBusinessLogicTestCase implements StsLogic {
+ private static final String LOG_TAG = StsExtraBusinessLogicTestCase.class.getSimpleName();
+
private LocalDate deviceSpl = null;
@Rule public DescriptionProvider descriptionProvider = new DescriptionProvider();
@@ -46,6 +48,10 @@ public class StsExtraBusinessLogicTestCase extends ExtraBusinessLogicTestCase im
// set in test/sts/tools/sts-tradefed/res/config/sts-base-dynamic-*.xml
String stsDynamicPlan =
InstrumentationRegistry.getArguments().getString("sts-dynamic-plan");
+ if (stsDynamicPlan == null) {
+ Log.w(LOG_TAG, "cannot get STS dynamic plan; this likely isn't run in STS");
+ return List.of();
+ }
return StsLogic.getExtraBusinessLogicForPlan(stsDynamicPlan);
}
diff --git a/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java b/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java
index 80c5cc95b..e93166dd4 100644
--- a/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java
+++ b/libraries/sts-common-util/host-side/src/com/android/sts/common/tradefed/testtype/StsExtraBusinessLogicHostTestBase.java
@@ -35,6 +35,8 @@ import java.util.Optional;
public class StsExtraBusinessLogicHostTestBase extends ExtraBusinessLogicHostTestBase
implements StsLogic {
+ private static final String LOG_TAG = StsExtraBusinessLogicHostTestBase.class.getSimpleName();
+
private LocalDate deviceSpl = null;
@Rule public DescriptionProvider descriptionProvider = new DescriptionProvider();
@@ -47,6 +49,10 @@ public class StsExtraBusinessLogicHostTestBase extends ExtraBusinessLogicHostTes
public List<String> getExtraBusinessLogics() {
// set in test/sts/tools/sts-tradefed/res/config/sts-base-dynamic-*.xml
String stsDynamicPlan = getBuild().getBuildAttributes().get("sts-dynamic-plan");
+ if (stsDynamicPlan == null) {
+ Log.w(LOG_TAG, "cannot get STS dynamic plan; this likely isn't run in STS");
+ return List.of();
+ }
return StsLogic.getExtraBusinessLogicForPlan(stsDynamicPlan);
}