summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Dombroski <cdombroski@google.com>2023-04-04 17:22:43 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-04 17:22:43 +0000
commit0dcb8cfa9e84bcfa2691ab0a7f07fb2ff9b16567 (patch)
tree29fb05d6ee2c5e022ee09ae0c75202c969436142
parentbf125c5febe1f2135539b752efa3801e4d8d4761 (diff)
parentd949138f01d8de927a21b6043b235cacdd67c3e8 (diff)
downloadplatform_testing-0dcb8cfa9e84bcfa2691ab0a7f07fb2ff9b16567.tar.gz
Fix NPE on STS BL am: 83236b4f91 am: d949138f01
Original change: https://googleplex-android-review.googlesource.com/c/platform/platform_testing/+/22438599 Change-Id: I17513b40a4042ecddb87ad81c6443f772c4fdeee 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);
}