Skip to content

Commit

Permalink
Add changes suggested by IntelliJ code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
emlun committed Sep 14, 2022
1 parent 17cf991 commit 531360b
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 22 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ plugins {

import io.franzbecker.gradle.lombok.LombokPlugin
import io.franzbecker.gradle.lombok.task.DelombokTask
import com.yubico.gradle.GitUtils;
import com.yubico.gradle.GitUtils

rootProject.description = "Metadata root for the com.yubico:webauthn-server-* module family"

Expand Down Expand Up @@ -201,7 +201,7 @@ subprojects { project ->
if (project.hasProperty('publishMe') && project.publishMe) {

if (GitUtils.getGitCommit(projectDir) == null) {
throw new RuntimeException("Failed to get git commit ID");
throw new RuntimeException("Failed to get git commit ID")
}

publishing {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/groovy/com/yubico/gradle/GitUtils.groovy
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.yubico.gradle;
package com.yubico.gradle

public class GitUtils {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import org.gradle.api.tasks.TaskAction
class PitestMergeTask extends DefaultTask {

@OutputFile
def File destinationFile = project.file("${project.buildDir}/reports/pitest/mutations.xml")
File destinationFile = project.file("${project.buildDir}/reports/pitest/mutations.xml")

PitestMergeTask() {
project.subprojects.each { subproject ->
Expand All @@ -24,7 +24,7 @@ class PitestMergeTask extends DefaultTask {
}
}

def Set<File> findMutationsXmlFiles(File f, Set<File> found) {
Set<File> findMutationsXmlFiles(File f, Set<File> found) {
if (f.isDirectory()) {
Set<File> result = found
for (File child : f.listFiles()) {
Expand Down
3 changes: 2 additions & 1 deletion webauthn-server-attestation/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.yubico.gradle.GitUtils;
import com.yubico.gradle.GitUtils

plugins {
`java-library`
scala
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.yubico.fido.metadata;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
Expand Down Expand Up @@ -360,7 +359,7 @@ private static class SetFromIntJsonDeserializer
extends JsonDeserializer<Set<UserVerificationMethod>> {
@Override
public Set<UserVerificationMethod> deserialize(JsonParser p, DeserializationContext ctxt)
throws IOException, JacksonException {
throws IOException {
final int bitset = p.getNumberValue().intValue();
return Arrays.stream(UserVerificationMethod.values())
.filter(uvm -> (uvm.getValue() & bitset) != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public enum CtapCertificationId {
*/
FIDO("FIDO");

@JsonValue private String id;
@JsonValue private final String id;

CtapCertificationId(String id) {
this.id = id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public enum CtapPinUvAuthProtocolVersion {
*/
TWO(2);

@JsonValue private int value;
@JsonValue private final int value;

CtapPinUvAuthProtocolVersion(int value) {
this.value = value;
Expand Down
5 changes: 3 additions & 2 deletions webauthn-server-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import com.yubico.gradle.GitUtils;
import com.yubico.gradle.GitUtils

plugins {
`java-library`
scala
Expand Down Expand Up @@ -67,7 +68,7 @@ tasks.jar {
"Implementation-Version" to project.version,
"Implementation-Vendor" to "Yubico",
"Implementation-Source-Url" to "https://github.com/Yubico/java-webauthn-server",
"Git-Commit" to com.yubico.gradle.GitUtils.getGitCommitOrUnknown(projectDir),
"Git-Commit" to GitUtils.getGitCommitOrUnknown(projectDir),
))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static RegisteredCredentialBuilder.MandatoryStages builder() {

public static class RegisteredCredentialBuilder {
public static class MandatoryStages {
private RegisteredCredentialBuilder builder = new RegisteredCredentialBuilder();
private final RegisteredCredentialBuilder builder = new RegisteredCredentialBuilder();

/**
* {@link RegisteredCredentialBuilder#credentialId(ByteArray) credentialId} is a required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static RegistrationResultBuilder.MandatoryStages builder() {

static class RegistrationResultBuilder {
static class MandatoryStages {
private RegistrationResultBuilder builder = new RegistrationResultBuilder();
private final RegistrationResultBuilder builder = new RegistrationResultBuilder();

Step2 keyId(PublicKeyCredentialDescriptor keyId) {
builder.keyId(keyId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public static class PublicKeyCredentialCreationOptionsBuilder {
private AuthenticatorSelectionCriteria authenticatorSelection = null;

public static class MandatoryStages {
private PublicKeyCredentialCreationOptionsBuilder builder =
private final PublicKeyCredentialCreationOptionsBuilder builder =
new PublicKeyCredentialCreationOptionsBuilder();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public static class PublicKeyCredentialDescriptorBuilder {
private Set<AuthenticatorTransport> transports = null;

public static class MandatoryStages {
private PublicKeyCredentialDescriptorBuilder builder =
private final PublicKeyCredentialDescriptorBuilder builder =
new PublicKeyCredentialDescriptorBuilder();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public static PublicKeyCredentialParametersBuilder.MandatoryStages builder() {

public static class PublicKeyCredentialParametersBuilder {
public static class MandatoryStages {
private PublicKeyCredentialParametersBuilder builder =
private final PublicKeyCredentialParametersBuilder builder =
new PublicKeyCredentialParametersBuilder();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public static class PublicKeyCredentialRequestOptionsBuilder {
private List<PublicKeyCredentialDescriptor> allowCredentials = null;

public static class MandatoryStages {
private PublicKeyCredentialRequestOptionsBuilder builder =
private final PublicKeyCredentialRequestOptionsBuilder builder =
new PublicKeyCredentialRequestOptionsBuilder();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static RelyingPartyIdentityBuilder.MandatoryStages builder() {
public static class RelyingPartyIdentityBuilder {

public static class MandatoryStages {
private RelyingPartyIdentityBuilder builder = new RelyingPartyIdentityBuilder();
private final RelyingPartyIdentityBuilder builder = new RelyingPartyIdentityBuilder();

/**
* A unique identifier for the Relying Party, which sets the <a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static UserIdentityBuilder.MandatoryStages builder() {
public static class UserIdentityBuilder {

public static class MandatoryStages {
private UserIdentityBuilder builder = new UserIdentityBuilder();
private final UserIdentityBuilder builder = new UserIdentityBuilder();

/**
* {@link UserIdentityBuilder#name(String) name} is a required parameter.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@
import com.yubico.webauthn.data.exception.HexException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.cert.X509Certificate;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.DEROctetString;

@Slf4j
public final class ExtensionMatcher implements DeviceMatcher {
private static final Charset CHARSET = Charset.forName("UTF-8");
private static final Charset CHARSET = StandardCharsets.UTF_8;

public static final String SELECTOR_TYPE = "x509Extension";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ private Response messagesJson(ResponseBuilder response, List<String> messages) {
}

private String writeJson(Object o) throws JsonProcessingException {
if (uriInfo.getQueryParameters().keySet().contains("pretty")) {
if (uriInfo.getQueryParameters().containsKey("pretty")) {
return jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(o);
} else {
return jsonMapper.writeValueAsString(o);
Expand Down

0 comments on commit 531360b

Please sign in to comment.