Skip to content

Commit b8f2a7d

Browse files
committed
style: cleanup code as per @dwalluck's feedback
1 parent 5c3df00 commit b8f2a7d

5 files changed

Lines changed: 17 additions & 15 deletions

File tree

rpm/src/main/java/org/eclipse/packager/rpm/app/Dumper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public static String dumpFlag ( final int value, final IntFunction<Optional<?>>
6565

6666
public static void dumpAll ( final RpmInputStream in ) throws IOException
6767
{
68-
final RpmLead lead = in.getLead();
68+
final RpmLead lead = in.getLead ();
6969

7070
if ( !SKIP_META )
7171
{

rpm/src/main/java/org/eclipse/packager/rpm/build/BuilderOptions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ public List<PayloadProcessor> getPayloadProcessors ()
159159

160160
public void setPayloadProcessors ( final List<PayloadProcessor> payloadProcessors )
161161
{
162-
this.payloadProcessors = new ArrayList<>(payloadProcessors);
162+
// we create a copy of the list to prevent external changes to our state.
163+
this.payloadProcessors = new ArrayList<> ( payloadProcessors );
163164
}
164165

165166
public void addPayloadProcessor ( final PayloadProcessor processor )

rpm/src/main/java/org/eclipse/packager/rpm/build/PayloadProcessors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void finish ( final Header<RpmTag> header )
6161
final String compressed = Hex.toHexString ( digestCompressed.digest () );
6262
header.putStringArray ( RpmTag.PAYLOAD_DIGEST, compressed );
6363
header.putStringArray ( RpmTag.PAYLOAD_DIGEST_ALT, raw );
64-
header.putInt ( RpmTag.PAYLOAD_DIGEST_ALGO, algorithm.getTag() );
64+
header.putInt ( RpmTag.PAYLOAD_DIGEST_ALGO, algorithm.getTag () );
6565
}
6666
};
6767
}

rpm/src/main/java/org/eclipse/packager/rpm/build/RpmBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ private void fillHeader ( final PayloadRecorder.Finished finished )
960960

961961
// add additional headers
962962

963-
this.header.putAll ( finished.getAdditionalHeader() );
963+
this.header.putAll ( finished.getAdditionalHeader () );
964964
}
965965

966966
private static void putNumber ( final LongMode longMode, final Header<RpmTag> header, final Collection<FileEntry> files, final RpmTag tag, final ToLongFunction<FileEntry> func )
@@ -1103,12 +1103,12 @@ public void build () throws IOException
11031103

11041104
leadBuilder.fillFlagsFromHeader ( this.header, createLeadArchitectureMapper (), createLeadOperatingSystemMapper () );
11051105

1106-
if ( this.headerCustomizer != null)
1106+
if ( this.headerCustomizer != null )
11071107
{
1108-
this.headerCustomizer.accept(this.header);
1108+
this.headerCustomizer.accept ( this.header );
11091109
}
11101110

1111-
try ( final RpmWriter writer = new RpmWriter ( this.targetFile, leadBuilder, this.header, this.options.getHeaderCharset (), this.options.getOpenOptions() ) ) {
1111+
try ( final RpmWriter writer = new RpmWriter ( this.targetFile, leadBuilder, this.header, this.options.getHeaderCharset (), this.options.getOpenOptions () ) ) {
11121112
writer.addAllSignatureProcessors ( this.signatureProcessors );
11131113
writer.setPayload ( finished );
11141114
}

rpm/src/main/java/org/eclipse/packager/rpm/signature/RsaSignatureProcessor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/*
22
* Copyright (c) 2016, 2022 Contributors to the Eclipse Foundation
33
*
44
* See the NOTICE file(s) distributed with this work for additional
@@ -36,18 +36,20 @@ public class RsaSignatureProcessor implements SignatureProcessor
3636

3737
private final PGPSignatureGenerator signatureGenerator;
3838

39-
protected RsaSignatureProcessor(final PGPPrivateKey privateKey, final int hashAlgorithm )
39+
protected RsaSignatureProcessor ( final PGPPrivateKey privateKey, final int hashAlgorithm )
4040
{
4141
Objects.requireNonNull ( privateKey );
4242

43-
final BcPGPContentSignerBuilder contentSignerBuilder = new BcPGPContentSignerBuilder ( privateKey.getPublicKeyPacket ().getAlgorithm (), hashAlgorithm);
43+
final BcPGPContentSignerBuilder contentSignerBuilder = new BcPGPContentSignerBuilder ( privateKey.getPublicKeyPacket ().getAlgorithm (), hashAlgorithm );
4444
this.signatureGenerator = new PGPSignatureGenerator ( contentSignerBuilder );
4545

46-
try {
47-
this.signatureGenerator.init ( PGPSignature.BINARY_DOCUMENT, privateKey);
46+
try
47+
{
48+
this.signatureGenerator.init ( PGPSignature.BINARY_DOCUMENT, privateKey );
4849
}
49-
catch ( Exception e ) {
50-
throw new RuntimeException(e);
50+
catch ( Exception e )
51+
{
52+
throw new RuntimeException ( e );
5153
}
5254
}
5355

@@ -100,6 +102,5 @@ public void finish ( final Header<RpmSignatureTag> signature )
100102
{
101103
throw new RuntimeException(e);
102104
}
103-
104105
}
105106
}

0 commit comments

Comments
 (0)