Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: changes to close ELY-2595,2596,2597,2603,2605,2606,2607 #1996

Merged
merged 7 commits into from
Oct 12, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,10 @@ private static void parseCertificateRevocationLists(ConfigurationXMLStreamReader
while (reader.hasNext()) {
final int tag = reader.nextTag();
if (tag == START_ELEMENT) {
switch (reader.getLocalName()) {
case "certificate-revocation-list": {
parseCertificateRevocationList(reader, builder, xmlVersion, true);
break;
}
default:
throw reader.unexpectedElement();
if (reader.getLocalName().equals("certificate-revocation-list")) {
parseCertificateRevocationList(reader, builder, xmlVersion, true);
} else {
throw reader.unexpectedElement();
}
} else if (tag != END_ELEMENT) {
throw reader.unexpectedContent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ private Void replaceIdentityPrivileged(final LoadedIdentity newIdentity) throws
}
}

private Version requiredVersion(final LoadedIdentity identityToWrite) {
private Version requiredVersion() {
// As new functionality is added we will identify if we need to use a later version
// if new functionality is used then use the required schema version otherwise fallback
// to an older version.
Expand All @@ -1018,7 +1018,7 @@ private void writeIdentity(final XMLStreamWriter streamWriter, final LoadedIdent
streamWriter.writeStartDocument();
streamWriter.writeCharacters("\n");
streamWriter.writeStartElement("identity");
streamWriter.writeDefaultNamespace(requiredVersion(newIdentity).getNamespace());
streamWriter.writeDefaultNamespace(requiredVersion().getNamespace());

if (integrityEnabled) {
streamWriter.writeCharacters("\n ");
Expand Down Expand Up @@ -1099,6 +1099,7 @@ private void writeIdentity(final XMLStreamWriter streamWriter, final LoadedIdent
streamWriter.writeEndDocument();
}

@Override
public void dispose() {
// Release the lock for this realm identity
IdentityLock identityLock = lock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,8 @@ public boolean verifyCertificate(X509Certificate certificate, Attributes attribu

for (int i = 0; i < size; i++) {
Object attrDigest = attribute.get(i);
if (attrDigest != null){
if (digest.equalsIgnoreCase((String) attrDigest)) {
return true;
}
if (attrDigest != null && digest.equalsIgnoreCase((String) attrDigest)){
return true;
}
}
} catch (NoSuchAlgorithmException | CertificateEncodingException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@
*/
class CredentialStoreCommand extends Command {

public static int ACTION_NOT_DEFINED = 5;
public static int ALIAS_NOT_FOUND = 6;
public static final int ACTION_NOT_DEFINED = 5;
public static final int ALIAS_NOT_FOUND = 6;

public static final String RSA_ALGORITHM = "RSA";
public static final String DSA_ALGORITHM = "DSA";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public class ElytronTool {
/**
* status code for unrecognized command
*/
public static int ElytronToolExitStatus_unrecognizedCommand = 1;
public static final int ElytronToolExitStatus_unrecognizedCommand = 1;
/**
* status code for no problems
*/
public static int ElytronToolExitStatus_OK = 0;
public static final int ElytronToolExitStatus_OK = 0;

private Map<String, Command> commandRegistry = new HashMap<>();
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ private void printSummary (String keystorePassword, String salt, int iterationCo
if (keystorePassword != null) {
password = keystorePassword;
if (salt != null && iterationCount > -1) {
password = keystorePassword.startsWith(MASK_PREFIX) ? keystorePassword + ";" + salt + ";" + String.valueOf(iterationCount)
password = keystorePassword.startsWith(MASK_PREFIX) ? keystorePassword + ";" + salt + ";" + iterationCount
: MaskCommand.computeMasked(keystorePassword, salt, iterationCount);
}
}
Expand Down
Loading