Fixing error with validation files
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user