@@ -37,17 +37,15 @@ public class OperationTokenUtil {
37
37
/**
38
38
* Load a workflow run operation token from an operation token.
39
39
*
40
- * @throws FallbackToWorkflowIdException if the operation token is not a workflow run token
41
40
* @throws IllegalArgumentException if the operation token is invalid
42
41
*/
43
- public static WorkflowRunOperationToken loadWorkflowRunOperationToken (String operationToken )
44
- throws FallbackToWorkflowIdException {
42
+ public static WorkflowRunOperationToken loadWorkflowRunOperationToken (String operationToken ) {
45
43
WorkflowRunOperationToken token ;
46
44
try {
47
45
JavaType reference = mapper .getTypeFactory ().constructType (WorkflowRunOperationToken .class );
48
46
token = mapper .readValue (decoder .decode (operationToken ), reference );
49
47
} 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 ());
51
49
}
52
50
if (!token .getType ().equals (OperationTokenType .WORKFLOW_RUN )) {
53
51
throw new IllegalArgumentException (
@@ -68,16 +66,7 @@ public static WorkflowRunOperationToken loadWorkflowRunOperationToken(String ope
68
66
* @throws IllegalArgumentException if the operation token is invalid
69
67
*/
70
68
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 ();
81
70
}
82
71
83
72
/** Generate a workflow run operation token from a workflow ID and namespace. */
@@ -87,11 +76,5 @@ public static String generateWorkflowRunOperationToken(String workflowId, String
87
76
return encoder .encodeToString (json .getBytes ());
88
77
}
89
78
90
- public static class FallbackToWorkflowIdException extends RuntimeException {
91
- public FallbackToWorkflowIdException (String message ) {
92
- super (message );
93
- }
94
- }
95
-
96
79
private OperationTokenUtil () {}
97
80
}
0 commit comments