Fixing error with validation files

This commit is contained in:
Finn
2025-10-04 01:33:57 +02:00
parent bae9f56907
commit c9b6d50be6
4 changed files with 5 additions and 8 deletions

View File

@@ -6,7 +6,7 @@
<groupId>org.openautonomousconnection</groupId>
<artifactId>protocol</artifactId>
<version>1.0.0-BETA.6</version>
<version>1.0.0-BETA.7</version>
<organization>
<name>Open Autonomous Connection</name>
<url>https://open-autonomous-connection.org/</url>

View File

@@ -127,8 +127,7 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
// Validate each file in the folder
for (File file : files) {
if (!file.getName().startsWith(prefix) || !file.getName().endsWith(extension))
throw new CertificateException(file.getAbsolutePath() + " is not valid");
if (!file.getName().startsWith(prefix)) throw new CertificateException(file.getAbsolutePath() + " is not valid");
// Check for specific files
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);

View File

@@ -126,8 +126,7 @@ public abstract class ProtocolDNSServer extends DefaultMethodsOverrider {
// Validate each file in the folder
for (File file : files) {
if (!file.getName().startsWith(prefix) || !file.getName().endsWith(extension))
throw new CertificateException(file.getAbsolutePath() + " is not valid");
if (!file.getName().startsWith(prefix)) throw new CertificateException(file.getAbsolutePath() + " is not valid");
// Check if the file matches the expected naming convention
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);

View File

@@ -255,7 +255,7 @@ public final class ProtocolWebServer {
* @throws CertificateException If a required certificate file is missing or invalid.
* @throws IOException If an I/O error occurs while checking the files.
*/
private void checkFileExists(File folder, String prefix, String extension) throws CertificateException, IOException {
private final void checkFileExists(File folder, String prefix, String extension) throws CertificateException, IOException {
boolean found = false;
// Ensure the folder exists
@@ -268,8 +268,7 @@ public final class ProtocolWebServer {
// Check for the required certificate file
for (File file : files) {
if (!file.getName().startsWith(prefix) || !file.getName().endsWith(extension))
throw new CertificateException(file.getAbsolutePath() + " is not valid");
if (!file.getName().startsWith(prefix)) throw new CertificateException(file.getAbsolutePath() + " is not valid");
// Check for file matching the public IP address
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);