File tree 2 files changed +8
-4
lines changed
codegen/src/main/java/software/amazon/awssdk/codegen
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 26
26
import software .amazon .awssdk .codegen .internal .Jackson ;
27
27
import software .amazon .awssdk .codegen .internal .Utils ;
28
28
import software .amazon .awssdk .codegen .model .intermediate .IntermediateModel ;
29
+ import software .amazon .awssdk .utils .Logger ;
29
30
30
31
public class CodeGenerator {
31
-
32
+ private static final Logger log = Logger . loggerFor ( CodeGenerator . class );
32
33
private static final String MODEL_DIR_NAME = "models" ;
33
34
34
35
private final C2jModels models ;
@@ -85,6 +86,7 @@ public void execute() {
85
86
emitCode (intermediateModel );
86
87
87
88
} catch (Exception e ) {
89
+ log .error (() -> "Failed to generate code. " , e );
88
90
throw new RuntimeException (
89
91
"Failed to generate code. Exception message : " + e .getMessage (), e );
90
92
Original file line number Diff line number Diff line change 22
22
import java .util .Locale ;
23
23
import java .util .Map ;
24
24
import java .util .function .Predicate ;
25
+ import java .util .stream .Collectors ;
25
26
import software .amazon .awssdk .checksums .DefaultChecksumAlgorithm ;
26
27
import software .amazon .awssdk .codegen .model .intermediate .IntermediateModel ;
27
28
import software .amazon .awssdk .codegen .model .intermediate .MemberModel ;
@@ -141,11 +142,12 @@ private static void configureRequestChecksumCalculation(OperationModel operation
141
142
* with the fastest-to-calculate algorithms first.
142
143
*/
143
144
private static void addResponseAlgorithmsCodeBlock (List <String > responseAlgorithms , CodeBlock .Builder codeBuilder ) {
144
- responseAlgorithms .sort (Comparator .comparingInt (o -> CHECKSUM_ALGORITHM_PRIORITY .getOrDefault (
145
- o .toUpperCase (Locale .US ), Integer .MAX_VALUE )));
145
+ List <String > sortedResponseAlgorithms =
146
+ responseAlgorithms .stream ().sorted (Comparator .comparingInt (o -> CHECKSUM_ALGORITHM_PRIORITY .getOrDefault (
147
+ o .toUpperCase (Locale .US ), Integer .MAX_VALUE ))).collect (Collectors .toList ());
146
148
147
149
codeBuilder .add (CodeBlock .of (".responseAlgorithmsV2(" ));
148
- List <CodeBlock > responseAlgorithmsCodeBlocks = responseAlgorithmsCodeBlocks (responseAlgorithms );
150
+ List <CodeBlock > responseAlgorithmsCodeBlocks = responseAlgorithmsCodeBlocks (sortedResponseAlgorithms );
149
151
for (int i = 0 ; i < responseAlgorithmsCodeBlocks .size (); i ++) {
150
152
CodeBlock code = responseAlgorithmsCodeBlocks .get (i );
151
153
codeBuilder .add (code );
You can’t perform that action at this time.
0 commit comments