Skip to content

[Bug]: REST transport uses %1s/%2s width specifiers, padding single-char push notification config IDs with spaces #1367

Backlog

Description

@chjpooh2002

What happened?

RestTransport and RestTransport_v0_3 construct REST paths using String.format with %1s and %2s instead of %s (or positional %1$s/%2$s). In java.util.Formatter, %2s specifies a minimum width of 2 characters with leading space padding (similar to #1197 where %2d padded single-digit historyLength).

When a push notification config ID is 1 character long (e.g., 5), the formatted URL contains a literal space:

/tasks/task-1/pushNotificationConfigs/ 5

With JdkA2AHttpClient, passing this URL to URI.create(...) immediately throws IllegalArgumentException: Illegal character in path.

Affected locations

  • client/transport/rest/src/main/java/org/a2aproject/sdk/client/transport/rest/RestTransport.java:
    • Line 353 (getTaskPushNotificationConfiguration): String.format(/tasks/%1s/pushNotificationConfigs/%2s, effective.getTaskId(), configId)
    • Line 427 (deleteTaskPushNotificationConfigurations): String.format(/tasks/%1s/pushNotificationConfigs/%2s, effective.getTaskId(), effective.getId())
    • Lines 170, 196, 323, 355, 394, 456 also use %1s instead of %s.
  • compat-0.3/client/transport/rest/src/main/java/org/a2aproject/sdk/compat03/client/transport/rest/RestTransport_v0_3.java:
    • Lines 225, 256, 293 use the same %1s/%2s pattern.

Reproduction

Call getTaskPushNotificationConfiguration(new GetTaskPushNotificationConfigParams(task-1, 5), null) or deleteTaskPushNotificationConfigurations(new DeleteTaskPushNotificationConfigParams(task-1, 5), null) on RestTransport (or the equivalent methods on RestTransport_v0_3).

Expected Behavior

Replace %1s and %2s with %s across both RestTransport and RestTransport_v0_3 so single-character config IDs (e.g., 5) format as /tasks/task-1/pushNotificationConfigs/5 without space padding.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions