Fixing error with validation files
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>org.openautonomousconnection</groupId>
|
<groupId>org.openautonomousconnection</groupId>
|
||||||
<artifactId>protocol</artifactId>
|
<artifactId>protocol</artifactId>
|
||||||
<version>1.0.0-BETA.6</version>
|
<version>1.0.0-BETA.7</version>
|
||||||
<organization>
|
<organization>
|
||||||
<name>Open Autonomous Connection</name>
|
<name>Open Autonomous Connection</name>
|
||||||
<url>https://open-autonomous-connection.org/</url>
|
<url>https://open-autonomous-connection.org/</url>
|
||||||
|
|||||||
@@ -127,8 +127,7 @@ public abstract class ProtocolClient extends DefaultMethodsOverrider {
|
|||||||
|
|
||||||
// Validate each file in the folder
|
// Validate each file in the folder
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (!file.getName().startsWith(prefix) || !file.getName().endsWith(extension))
|
if (!file.getName().startsWith(prefix)) throw new CertificateException(file.getAbsolutePath() + " is not valid");
|
||||||
throw new CertificateException(file.getAbsolutePath() + " is not valid");
|
|
||||||
|
|
||||||
// Check for specific files
|
// Check for specific files
|
||||||
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);
|
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ public abstract class ProtocolDNSServer extends DefaultMethodsOverrider {
|
|||||||
|
|
||||||
// Validate each file in the folder
|
// Validate each file in the folder
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (!file.getName().startsWith(prefix) || !file.getName().endsWith(extension))
|
if (!file.getName().startsWith(prefix)) throw new CertificateException(file.getAbsolutePath() + " is not valid");
|
||||||
throw new CertificateException(file.getAbsolutePath() + " is not valid");
|
|
||||||
|
|
||||||
// Check if the file matches the expected naming convention
|
// Check if the file matches the expected naming convention
|
||||||
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);
|
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ public final class ProtocolWebServer {
|
|||||||
* @throws CertificateException If a required certificate file is missing or invalid.
|
* @throws CertificateException If a required certificate file is missing or invalid.
|
||||||
* @throws IOException If an I/O error occurs while checking the files.
|
* @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;
|
boolean found = false;
|
||||||
|
|
||||||
// Ensure the folder exists
|
// Ensure the folder exists
|
||||||
@@ -268,8 +268,7 @@ public final class ProtocolWebServer {
|
|||||||
|
|
||||||
// Check for the required certificate file
|
// Check for the required certificate file
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (!file.getName().startsWith(prefix) || !file.getName().endsWith(extension))
|
if (!file.getName().startsWith(prefix)) throw new CertificateException(file.getAbsolutePath() + " is not valid");
|
||||||
throw new CertificateException(file.getAbsolutePath() + " is not valid");
|
|
||||||
|
|
||||||
// Check for file matching the public IP address
|
// Check for file matching the public IP address
|
||||||
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);
|
if (!found) found = file.getName().equalsIgnoreCase(prefix + NetworkUtils.getPublicIPAddress() + extension);
|
||||||
|
|||||||
Reference in New Issue
Block a user