summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Dombroski <cdombroski@google.com>2023-04-04 20:12:20 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-04-04 20:12:20 +0000
commitc356139bb561403bf8574553a7dbc35e8aee4452 (patch)
tree63b13ec134e6eae0242515bad7bbd0fd44f2457a
parent2e9af48b71bb501c674eab6f8248cf336a121904 (diff)
parent39e888082c487ac3d1d17b6f778b502bb9b8f428 (diff)
downloadplatform_testing-c356139bb561403bf8574553a7dbc35e8aee4452.tar.gz
Fix NPE on STS BL am: 83236b4f91 am: d949138f01 am: 0dcb8cfa9e am: dd1b8f2a3f am: 5586fb1022 am: 5c7573c0bf am: 39e888082c
Original change: https://googleplex-android-review.googlesource.com/c/platform/platform_testing/+/22438599 Change-Id: Idef7636091f673c1690b24c179d027cd79c01fcf 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);
}