Skip to content

Commit 04fe25a

Browse files
Fix NPE getting a non existent memo from a schedule. (#2497)
1 parent 3c9e819 commit 04fe25a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

temporal-sdk/src/main/java/io/temporal/client/schedules/ScheduleDescription.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ public <T> Object getMemo(String key, Class<T> valueClass) {
112112

113113
@Nullable
114114
public <T> T getMemo(String key, Class<T> valueClass, Type genericType) {
115-
Payload memoPayload = this.memo.get(key);
116-
if (memo == null) {
115+
Payload memoPayload = memo.get(key);
116+
if (memoPayload == null) {
117117
return null;
118118
}
119119
return dataConverter.fromPayload(memoPayload, valueClass, genericType);

temporal-sdk/src/test/java/io/temporal/client/schedules/ScheduleTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ public void createSchedule() {
110110
ScheduleHandle handle = client.createSchedule(scheduleId, schedule, options);
111111
ScheduleDescription description = handle.describe();
112112
Assert.assertEquals(scheduleId, description.getId());
113+
// Verify the schedule description has the correct (i.e. no) memo
114+
Assert.assertNull(description.getMemo("memokey1", String.class));
113115
// Try to create a schedule that already exists
114116
Assert.assertThrows(
115117
ScheduleAlreadyRunningException.class,

0 commit comments

Comments
 (0)