Skip to content

Commit

Permalink
spotbugs issues + linting
Browse files Browse the repository at this point in the history
  • Loading branch information
artoonie committed Oct 23, 2023
1 parent 3ed3d38 commit 2fe5650
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions config/spotbugs/exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@
<Method name="~.*Property"/>
<Bug code="EI"/>
</Match>
<Match>
<Class name="~network\.brightspots\.rcv\.CryptographyXmlParsers\$SignedInfo"/>
<Field name="xmlns"/>
<Bug code="UrF"/>
</Match>
</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ public static boolean isIsHartSignatureValidationEnabled() {
return IS_HART_SIGNATURE_VALIDATION_ENABLED;
}

public static RsaKeyValue getRsaPublicKey() {
public static synchronized RsaKeyValue getRsaPublicKey() {
// Synchronized to prevent a race condition. SpotBugs will complain otherwise, even though
// this is not currently called on multiple threads.
if (rsaKeyValue != null) {
return rsaKeyValue;
}

rsaKeyValue = new RsaKeyValue();
rsaKeyValue.modulus = RSA_MODULUS;
rsaKeyValue.exponent = RSA_EXPONENT;

return rsaKeyValue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ static class SignedInfo {
Reference reference;

// Required to match Hart's implementation of canonicalization
@SuppressWarnings("unused")
@JacksonXmlProperty(localName = "xmlns", isAttribute = true)
String xmlns = "http://www.w3.org/2000/09/xmldsig#";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ static void setup() {

@AfterAll
static void teardown() {
assertTrue(TEMP_DIRECTORY.delete());
boolean didDelete = TEMP_DIRECTORY.delete();
if (!didDelete) {
Logger.warning("Failed to clean up directory: %s", TEMP_DIRECTORY.getAbsolutePath());
}
}

static RsaKeyValue getPublicKeyFor(File file) {
Expand Down

0 comments on commit 2fe5650

Please sign in to comment.