2121import static ee .cyber .cdoc2 .crypto .KeyLabelTools .keyLabelParamsForDisplaying ;
2222
2323
24-
2524//S106 Standard outputs should not be used directly to log anything
2625//CLI needs to interact with standard outputs
2726@ SuppressWarnings ("java:S106" )
@@ -44,18 +43,15 @@ private void setProperty(Map<String, String> props) {
4443
4544 @ Override
4645 public Void call () throws Exception {
47-
48-
4946 List <Recipient > recipients = Envelope .parseHeader (Files .newInputStream (cdocFile .toPath ()));
5047 for (Recipient recipient : recipients ) {
51-
5248 String type = getHumanReadableType (recipient );
5349
5450 Map <String , String > keyLabelParams
5551 = extractKeyLabelParams (recipient .getRecipientKeyLabel ());
5652
57- String server = (recipient instanceof ServerRecipient )
58- ? "(server: " + (( ServerRecipient ) recipient ) .getKeyServerId () + ")"
53+ String server = (recipient instanceof ServerRecipient serverRecipient )
54+ ? "(server: " + serverRecipient .getKeyServerId () + ")"
5955 : "" ;
6056
6157 System .out .println (
@@ -69,8 +65,8 @@ public Void call() throws Exception {
6965 String getHumanReadableType (Recipient recipient ) {
7066 Objects .requireNonNull (recipient ); //can't have null recipient, fail with exception
7167
72- if (recipient instanceof PublicKeyRecipient ) {
73- return (( PublicKeyRecipient ) recipient ) .getRecipientPubKey ().getAlgorithm () + " PublicKey" ;
68+ if (recipient instanceof PublicKeyRecipient publicKeyRecipient ) {
69+ return publicKeyRecipient .getRecipientPubKey ().getAlgorithm () + " PublicKey" ;
7470 } else if (recipient instanceof SymmetricKeyRecipient ) {
7571 return "SymmetricKey" ;
7672 } else if (recipient instanceof PBKDF2Recipient ) {
@@ -81,4 +77,5 @@ String getHumanReadableType(Recipient recipient) {
8177 return recipient .getClass ().toString ();
8278 }
8379 }
80+
8481}
0 commit comments