Skip to content

Commit 8159930

Browse files
committed
addressed copilot pr comments
1 parent 6d4ad92 commit 8159930

4 files changed

Lines changed: 14 additions & 9 deletions

File tree

samples-azure-functions/src/main/java/com/functions/entities/BankAccountFunctions.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ public HttpResponseMessage transfer(
166166
authLevel = AuthorizationLevel.ANONYMOUS) HttpRequestMessage<Optional<String>> request,
167167
@DurableClientInput(name = "durableContext") DurableClientContext durableContext,
168168
final ExecutionContext context) {
169-
String from = request.getQueryParameters().get("from");
170-
String to = request.getQueryParameters().get("to");
171-
String amountStr = request.getQueryParameters().get("amount");
169+
String from = trimOrNull(request.getQueryParameters().get("from"));
170+
String to = trimOrNull(request.getQueryParameters().get("to"));
171+
String amountStr = trimOrNull(request.getQueryParameters().get("amount"));
172172

173173
if (from == null || to == null || amountStr == null) {
174174
return request.createResponseBuilder(HttpStatus.BAD_REQUEST)
@@ -192,6 +192,14 @@ public HttpResponseMessage transfer(
192192
return durableContext.createCheckStatusResponse(request, instanceId);
193193
}
194194

195+
// ─── Helpers ───
196+
197+
private static String trimOrNull(String value) {
198+
if (value == null) return null;
199+
String trimmed = value.trim();
200+
return trimmed.isEmpty() ? null : trimmed;
201+
}
202+
195203
// ─── Payload classes ───
196204

197205
/**

samples-azure-functions/src/main/java/com/functions/entities/SensorState.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
// Licensed under the MIT License.
33
package com.functions.entities;
44

5-
import com.microsoft.durabletask.AbstractTaskEntity;
6-
import com.microsoft.durabletask.TaskEntityContext;
7-
import com.microsoft.durabletask.TaskEntityOperation;
8-
95
/**
106
* State for the {@link SensorEntity} — tracks the last recorded temperature and total readings.
117
*/

samples/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ task runWorkItemFilterSample(type: JavaExec) {
2828
}
2929

3030
// --- Entity samples (require a Durable Task sidecar / DTS emulator on localhost:4001) ---
31-
// When DTS_ENDPOINT is set (or the default applies), these tasks connect to a Durable Task
31+
// When ENDPOINT is set (or the default applies), these tasks connect to a Durable Task
3232
// Scheduler such as the DTS emulator. Override by setting ENDPOINT/TASKHUB env vars.
3333
def dtsEnv = [
3434
ENDPOINT: System.getenv('ENDPOINT') ?: 'http://localhost:4001',

samples/src/main/java/io/durabletask/samples/SampleUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ private static String connectionString() {
4949
if (taskHub == null || taskHub.isEmpty()) {
5050
taskHub = "default";
5151
}
52-
String authType = endpoint.startsWith("http://localhost") || endpoint.startsWith("http://127.")
52+
String host = endpoint.replaceFirst("^https?://", "");
53+
String authType = host.startsWith("localhost") || host.startsWith("127.")
5354
? "None" : "DefaultAzure";
5455
return String.format("Endpoint=%s;TaskHub=%s;Authentication=%s", endpoint, taskHub, authType);
5556
}

0 commit comments

Comments
 (0)