@@ -37,17 +37,15 @@ public class OperationTokenUtil {
3737 /**
3838 * Load a workflow run operation token from an operation token.
3939 *
40- * @throws FallbackToWorkflowIdException if the operation token is not a workflow run token
4140 * @throws IllegalArgumentException if the operation token is invalid
4241 */
43- public static WorkflowRunOperationToken loadWorkflowRunOperationToken (String operationToken )
44- throws FallbackToWorkflowIdException {
42+ public static WorkflowRunOperationToken loadWorkflowRunOperationToken (String operationToken ) {
4543 WorkflowRunOperationToken token ;
4644 try {
4745 JavaType reference = mapper .getTypeFactory ().constructType (WorkflowRunOperationToken .class );
4846 token = mapper .readValue (decoder .decode (operationToken ), reference );
4947 } catch (Exception e ) {
50- throw new FallbackToWorkflowIdException ("Failed to parse operation token: " + e .getMessage ());
48+ throw new IllegalArgumentException ("Failed to parse operation token: " + e .getMessage ());
5149 }
5250 if (!token .getType ().equals (OperationTokenType .WORKFLOW_RUN )) {
5351 throw new IllegalArgumentException (
@@ -68,16 +66,7 @@ public static WorkflowRunOperationToken loadWorkflowRunOperationToken(String ope
6866 * @throws IllegalArgumentException if the operation token is invalid
6967 */
7068 public static String loadWorkflowIdFromOperationToken (String operationToken ) {
71- try {
72- WorkflowRunOperationToken token = loadWorkflowRunOperationToken (operationToken );
73- return token .getWorkflowId ();
74- } catch (OperationTokenUtil .FallbackToWorkflowIdException e ) {
75- // Previous versions of the SDK simply used the workflow ID as the operation token
76- // This fallback is provided for backwards compatibility for those cases.
77- // This fallback will be removed in a future release.
78- // See: https://github.com/temporalio/sdk-java/issues/2423
79- return operationToken ;
80- }
69+ return loadWorkflowRunOperationToken (operationToken ).getWorkflowId ();
8170 }
8271
8372 /** Generate a workflow run operation token from a workflow ID and namespace. */
@@ -87,11 +76,5 @@ public static String generateWorkflowRunOperationToken(String workflowId, String
8776 return encoder .encodeToString (json .getBytes ());
8877 }
8978
90- public static class FallbackToWorkflowIdException extends RuntimeException {
91- public FallbackToWorkflowIdException (String message ) {
92- super (message );
93- }
94- }
95-
9679 private OperationTokenUtil () {}
9780}
0 commit comments