From 0e71771ae8f4fdbe1d0ac5ded35751512a5e88e5 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Wed, 31 Jul 2024 17:47:50 +0530 Subject: [PATCH 1/9] feat: add status code --- .../LexFloatClientException.java | 318 +++++++++++------- 1 file changed, 200 insertions(+), 118 deletions(-) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index cdffb18..1bf6b54 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -20,225 +20,252 @@ public int getCode() { public static String getErrorMessage(int errorCode) { String message; switch (errorCode) { - case LF_E_PRODUCT_ID: - message = "The product id is incorrect."; - break; - case LF_E_CALLBACK: - message = "Invalid or missing callback function."; - break; - case LF_E_HOST_URL: - message = "Missing or invalid server url."; - break; - case LF_E_TIME: - message = "Ensure system date and time settings are correct."; - break; - case LF_E_INET: - message = "Failed to connect to the server due to network error."; - break; - case LF_E_NO_LICENSE: - message = "License has not been leased yet."; - break; - case LF_E_LICENSE_EXISTS: - message = "License has already been leased."; - break; - case LF_E_LICENSE_NOT_FOUND: - message = "License does not exist on server or has already expired."; - break; - case LF_E_LICENSE_EXPIRED_INET: - message = "License lease has expired due to network error."; - break; - case LF_E_LICENSE_LIMIT_REACHED: - message = "The server has reached it's allowed limit of floating licenses."; - break; - case LF_E_BUFFER_SIZE: - message = "The buffer size was smaller than required."; - break; - case LF_E_METADATA_KEY_NOT_FOUND: - message = "The metadata key does not exist."; - break; - case LF_E_METADATA_KEY_LENGTH: - message = "Metadata key length is more than 256 characters."; - break; - case LF_E_METADATA_VALUE_LENGTH: - message = "Metadata value length is more than 4096 characters."; - break; - case LF_E_FLOATING_CLIENT_METADATA_LIMIT: - message = "The floating client has reached it's metadata fields limit."; - break; - case LF_E_METER_ATTRIBUTE_NOT_FOUND: - message = "The meter attribute does not exist."; - break; - case LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED: - message = "The meter attribute has reached it's usage limit."; - break; - case LF_E_PRODUCT_VERSION_NOT_LINKED: - message = "No product version is linked with the license."; - break; - case LF_E_FEATURE_FLAG_NOT_FOUND: - message = "The product version feature flag does not exist."; - break; - case LF_E_IP: - message = "IP address is not allowed."; - break; - case LF_E_CLIENT: - message = "Client error."; - break; - case LF_E_SERVER: - message = "Server error."; - break; - case LF_E_SERVER_TIME_MODIFIED: - message = "System time on server has been tampered with."; - break; - case LF_E_SERVER_LICENSE_NOT_ACTIVATED: - message = "The server has not been activated using a license key."; - break; - case LF_E_SERVER_LICENSE_EXPIRED: - message = "The server license has expired."; - break; - case LF_E_SERVER_LICENSE_SUSPENDED: - message = "The server license has been suspended."; - break; - case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: - message = "The grace period for server license is over."; - break; - default: - message = "Unknown error!"; - + case LF_OK: + message = "Success code."; + break; + case LF_FAIL: + message = "Failure code."; + break; + case LF_E_PRODUCT_ID: + message = "The product id is incorrect."; + break; + case LF_E_CALLBACK: + message = "Invalid or missing callback function."; + break; + case LF_E_HOST_URL: + message = "Missing or invalid server url."; + break; + case LF_E_TIME: + message = "Ensure system date and time settings are correct."; + break; + case LF_E_INET: + message = "Failed to connect to the server due to network error."; + break; + case LF_E_NO_LICENSE: + message = "License has not been leased yet."; + break; + case LF_E_LICENSE_EXISTS: + message = "License has already been leased."; + break; + case LF_E_LICENSE_NOT_FOUND: + message = "License does not exist on server or has already expired."; + break; + case LF_E_LICENSE_EXPIRED_INET: + message = "License lease has expired due to network error."; + break; + case LF_E_LICENSE_LIMIT_REACHED: + message = "The server has reached it's allowed limit of floating licenses."; + break; + case LF_E_BUFFER_SIZE: + message = "The buffer size was smaller than required."; + break; + case LF_E_METADATA_KEY_NOT_FOUND: + message = "The metadata key does not exist."; + break; + case LF_E_METADATA_KEY_LENGTH: + message = "Metadata key length is more than 256 characters."; + break; + case LF_E_METADATA_VALUE_LENGTH: + message = "Metadata value length is more than 4096 characters."; + break; + case LF_E_FLOATING_CLIENT_METADATA_LIMIT: + message = "The floating client has reached it's metadata fields limit."; + break; + case LF_E_METER_ATTRIBUTE_NOT_FOUND: + message = "The meter attribute does not exist."; + break; + case LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED: + message = "The meter attribute has reached it's usage limit."; + break; + case LF_E_PRODUCT_VERSION_NOT_LINKED: + message = "No product version is linked with the license."; + break; + case LF_E_FEATURE_FLAG_NOT_FOUND: + message = "The product version feature flag does not exist."; + break; + case LF_E_SYSTEM_PERMISSION: + message = "Insufficient system permissions."; + break; + case LF_E_IP: + message = "IP address is not allowed."; + break; + case LF_E_INVALID_PERMISSION_FLAG: + message = "Invalid permission flag."; + break; + case LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: + message = "Offline floating license is not allowed for per-instance leasing strategy."; + break; + case LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: + message = "Maximum offline lease duration exceeded."; + break; + case LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: + message = "Allowed offline floating clients limit reached."; + break; + case LF_E_WMIC: + message = "Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled. This error is specific to Windows only."; + break; + case LF_E_MACHINE_FINGERPRINT: + message = "Machine fingerprint has changed since activation."; + break; + case LF_E_PROXY_NOT_TRUSTED: + message = "Request blocked due to untrusted proxy."; + break; + case LF_E_CLIENT: + message = "Client error."; + break; + case LF_E_SERVER: + message = "Server error."; + break; + case LF_E_SERVER_TIME_MODIFIED: + message = "System time on server has been tampered with."; + break; + case LF_E_SERVER_LICENSE_NOT_ACTIVATED: + message = "The server has not been activated using a license key."; + break; + case LF_E_SERVER_LICENSE_EXPIRED: + message = "The server license has expired."; + break; + case LF_E_SERVER_LICENSE_SUSPENDED: + message = "The server license has been suspended."; + break; + case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: + message = "The grace period for server license is over."; + break; + default: + message = "Unknown error!"; } return message; } /* * CODE: LF_OK - * + * * MESSAGE: Success code. */ public static final int LF_OK = 0; /* * CODE: LF_FAIL - * + * * MESSAGE: Failure code. */ public static final int LF_FAIL = 1; /* * CODE: LF_E_PRODUCT_ID - * + * * MESSAGE: The product id is incorrect. */ public static final int LF_E_PRODUCT_ID = 40; /* * CODE: LF_E_CALLBACK - * + * * MESSAGE: Invalid or missing callback function. */ public static final int LF_E_CALLBACK = 41; /* * CODE: LF_E_HOST_URL - * + * * MESSAGE: Missing or invalid server url. */ public static final int LF_E_HOST_URL = 42; /* * CODE: LF_E_TIME - * + * * MESSAGE: Ensure system date and time settings are correct. */ public static final int LF_E_TIME = 43; /* * CODE: LF_E_INET - * + * * MESSAGE: Failed to connect to the server due to network error. */ public static final int LF_E_INET = 44; /* * CODE: LF_E_NO_LICENSE - * + * * MESSAGE: License has not been leased yet. */ public static final int LF_E_NO_LICENSE = 45; /* * CODE: LF_E_LICENSE_EXISTS - * + * * MESSAGE: License has already been leased. */ public static final int LF_E_LICENSE_EXISTS = 46; /* * CODE: LF_E_LICENSE_NOT_FOUND - * - * MESSAGE: License does not exist on server or has already expired. This - * happens when the request to refresh the license is delayed. + * + * MESSAGE: License does not exist on server or has already expired. This happens when the request to refresh the license is delayed. */ public static final int LF_E_LICENSE_NOT_FOUND = 47; /* * CODE: LF_E_LICENSE_EXPIRED_INET - * - * MESSAGE: License lease has expired due to network error. This happens when - * the request to refresh the license fails due to network error. + * + * MESSAGE: License lease has expired due to network error. This happens when the request to refresh the license fails due to network error. */ public static final int LF_E_LICENSE_EXPIRED_INET = 48; /* * CODE: LF_E_LICENSE_LIMIT_REACHED - * + * * MESSAGE: The server has reached it's allowed limit of floating licenses. */ public static final int LF_E_LICENSE_LIMIT_REACHED = 49; /* * CODE: LF_E_BUFFER_SIZE - * + * * MESSAGE: The buffer size was smaller than required. */ public static final int LF_E_BUFFER_SIZE = 50; /* * CODE: LF_E_METADATA_KEY_NOT_FOUND - * + * * MESSAGE: The metadata key does not exist. */ public static final int LF_E_METADATA_KEY_NOT_FOUND = 51; /* * CODE: LF_E_METADATA_KEY_LENGTH - * + * * MESSAGE: Metadata key length is more than 256 characters. */ public static final int LF_E_METADATA_KEY_LENGTH = 52; /* * CODE: LF_E_METADATA_VALUE_LENGTH - * + * * MESSAGE: Metadata value length is more than 4096 characters. */ public static final int LF_E_METADATA_VALUE_LENGTH = 53; /* - * CODE: LF_E_ACTIVATION_METADATA_LIMIT - * + * CODE: LF_E_FLOATING_CLIENT_METADATA_LIMIT + * * MESSAGE: The floating client has reached it's metadata fields limit. */ public static final int LF_E_FLOATING_CLIENT_METADATA_LIMIT = 54; /* * CODE: LF_E_METER_ATTRIBUTE_NOT_FOUND - * + * * MESSAGE: The meter attribute does not exist. */ public static final int LF_E_METER_ATTRIBUTE_NOT_FOUND = 55; /* * CODE: LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED - * + * * MESSAGE: The meter attribute has reached it's usage limit. */ public static final int LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED = 56; @@ -257,59 +284,114 @@ public static String getErrorMessage(int errorCode) { */ public static final int LF_E_FEATURE_FLAG_NOT_FOUND = 58; + /* + * CODE: LF_E_SYSTEM_PERMISSION + * + * MESSAGE: Insufficient system permissions. + */ + public static final int LF_E_SYSTEM_PERMISSION = 59; + /* * CODE: LF_E_IP - * + * * MESSAGE: IP address is not allowed. */ public static final int LF_E_IP = 60; + /* + * CODE: LF_E_INVALID_PERMISSION_FLAG + * + * MESSAGE: Invalid permission flag. + */ + public static final int LF_E_INVALID_PERMISSION_FLAG = 61; + + /* + * CODE: LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED + * + * MESSAGE: Offline floating license is not allowed for per-instance leasing strategy. + */ + public static final int LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED = 62; + + /* + * CODE: LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED + * + * MESSAGE: Maximum offline lease duration exceeded. + */ + public static final int LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED = 63; + + /* + * CODE: LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED + * + * MESSAGE: Allowed offline floating clients limit reached. + */ + public static final int LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED = 64; + + /* + * CODE: LF_E_WMIC + * + * MESSAGE: Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled. This error is specific to Windows only. + */ + public static final int LF_E_WMIC = 65; + + /* + * CODE: LF_E_MACHINE_FINGERPRINT + * + * MESSAGE: Machine fingerprint has changed since activation. + */ + public static final int LF_E_MACHINE_FINGERPRINT = 66; + + /* + * CODE: LF_E_PROXY_NOT_TRUSTED + * + * MESSAGE: Request blocked due to untrusted proxy. + */ + public static final int LF_E_PROXY_NOT_TRUSTED = 67; + /* * CODE: LF_E_CLIENT - * + * * MESSAGE: Client error. */ public static final int LF_E_CLIENT = 70; /* * CODE: LF_E_SERVER - * + * * MESSAGE: Server error. */ public static final int LF_E_SERVER = 71; /* * CODE: LF_E_SERVER_TIME_MODIFIED - * - * MESSAGE: System time on server has been tampered with. Ensure your date and - * time settings are correct on the server machine. + * + * MESSAGE: System time on server has been tampered with. Ensure your date and time settings are correct on the server machine. */ public static final int LF_E_SERVER_TIME_MODIFIED = 72; /* * CODE: LF_E_SERVER_LICENSE_NOT_ACTIVATED - * + * * MESSAGE: The server has not been activated using a license key. */ public static final int LF_E_SERVER_LICENSE_NOT_ACTIVATED = 73; /* * CODE: LF_E_SERVER_LICENSE_EXPIRED - * + * * MESSAGE: The server license has expired. */ public static final int LF_E_SERVER_LICENSE_EXPIRED = 74; /* * CODE: LF_E_SERVER_LICENSE_SUSPENDED - * + * * MESSAGE: The server license has been suspended. */ public static final int LF_E_SERVER_LICENSE_SUSPENDED = 75; /* * CODE: LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER - * + * * MESSAGE: The grace period for server license is over. */ public static final int LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER = 76; From decdd62a8ce88b85e3ed8db26a0ccf44ac2a7a6d Mon Sep 17 00:00:00 2001 From: muneebkq Date: Fri, 2 Aug 2024 18:38:50 +0530 Subject: [PATCH 2/9] feat: add missing codes --- .../LexFloatClientException.java | 286 ++---------------- 1 file changed, 26 insertions(+), 260 deletions(-) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index 1bf6b54..4c76e4b 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -1,5 +1,4 @@ package com.cryptlex.lexfloatclient; - public class LexFloatClientException extends Exception { int errorCode; @@ -20,12 +19,7 @@ public int getCode() { public static String getErrorMessage(int errorCode) { String message; switch (errorCode) { - case LF_OK: - message = "Success code."; - break; - case LF_FAIL: - message = "Failure code."; - break; + // Existing error codes case LF_E_PRODUCT_ID: message = "The product id is incorrect."; break; @@ -83,33 +77,9 @@ public static String getErrorMessage(int errorCode) { case LF_E_FEATURE_FLAG_NOT_FOUND: message = "The product version feature flag does not exist."; break; - case LF_E_SYSTEM_PERMISSION: - message = "Insufficient system permissions."; - break; case LF_E_IP: message = "IP address is not allowed."; break; - case LF_E_INVALID_PERMISSION_FLAG: - message = "Invalid permission flag."; - break; - case LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: - message = "Offline floating license is not allowed for per-instance leasing strategy."; - break; - case LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: - message = "Maximum offline lease duration exceeded."; - break; - case LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: - message = "Allowed offline floating clients limit reached."; - break; - case LF_E_WMIC: - message = "Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled. This error is specific to Windows only."; - break; - case LF_E_MACHINE_FINGERPRINT: - message = "Machine fingerprint has changed since activation."; - break; - case LF_E_PROXY_NOT_TRUSTED: - message = "Request blocked due to untrusted proxy."; - break; case LF_E_CLIENT: message = "Client error."; break; @@ -131,268 +101,64 @@ public static String getErrorMessage(int errorCode) { case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: message = "The grace period for server license is over."; break; + + // Missing error codes + case LF_E_SYSTEM_PERMISSION: + message = "Insufficient system permissions."; + break; + case LF_E_INVALID_PERMISSION_FLAG: + message = "Invalid permission flag."; + break; + case LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: + message = "Offline floating license is not allowed for per-instance leasing strategy."; + break; + case LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: + message = "Maximum offline lease duration exceeded."; + break; + case LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: + message = "Allowed offline floating clients limit reached."; + break; + case LF_E_WMIC: + message = "Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled."; + break; + case LF_E_MACHINE_FINGERPRINT: + message = "Machine fingerprint has changed since activation."; + break; + default: message = "Unknown error!"; } return message; } - /* - * CODE: LF_OK - * - * MESSAGE: Success code. - */ + // Existing error codes public static final int LF_OK = 0; - - /* - * CODE: LF_FAIL - * - * MESSAGE: Failure code. - */ public static final int LF_FAIL = 1; - - /* - * CODE: LF_E_PRODUCT_ID - * - * MESSAGE: The product id is incorrect. - */ public static final int LF_E_PRODUCT_ID = 40; - - /* - * CODE: LF_E_CALLBACK - * - * MESSAGE: Invalid or missing callback function. - */ public static final int LF_E_CALLBACK = 41; - - /* - * CODE: LF_E_HOST_URL - * - * MESSAGE: Missing or invalid server url. - */ public static final int LF_E_HOST_URL = 42; - - /* - * CODE: LF_E_TIME - * - * MESSAGE: Ensure system date and time settings are correct. - */ public static final int LF_E_TIME = 43; - - /* - * CODE: LF_E_INET - * - * MESSAGE: Failed to connect to the server due to network error. - */ public static final int LF_E_INET = 44; - - /* - * CODE: LF_E_NO_LICENSE - * - * MESSAGE: License has not been leased yet. - */ public static final int LF_E_NO_LICENSE = 45; - - /* - * CODE: LF_E_LICENSE_EXISTS - * - * MESSAGE: License has already been leased. - */ public static final int LF_E_LICENSE_EXISTS = 46; - - /* - * CODE: LF_E_LICENSE_NOT_FOUND - * - * MESSAGE: License does not exist on server or has already expired. This happens when the request to refresh the license is delayed. - */ public static final int LF_E_LICENSE_NOT_FOUND = 47; - - /* - * CODE: LF_E_LICENSE_EXPIRED_INET - * - * MESSAGE: License lease has expired due to network error. This happens when the request to refresh the license fails due to network error. - */ public static final int LF_E_LICENSE_EXPIRED_INET = 48; - - /* - * CODE: LF_E_LICENSE_LIMIT_REACHED - * - * MESSAGE: The server has reached it's allowed limit of floating licenses. - */ public static final int LF_E_LICENSE_LIMIT_REACHED = 49; - - /* - * CODE: LF_E_BUFFER_SIZE - * - * MESSAGE: The buffer size was smaller than required. - */ public static final int LF_E_BUFFER_SIZE = 50; - - /* - * CODE: LF_E_METADATA_KEY_NOT_FOUND - * - * MESSAGE: The metadata key does not exist. - */ public static final int LF_E_METADATA_KEY_NOT_FOUND = 51; - - /* - * CODE: LF_E_METADATA_KEY_LENGTH - * - * MESSAGE: Metadata key length is more than 256 characters. - */ public static final int LF_E_METADATA_KEY_LENGTH = 52; - - /* - * CODE: LF_E_METADATA_VALUE_LENGTH - * - * MESSAGE: Metadata value length is more than 4096 characters. - */ public static final int LF_E_METADATA_VALUE_LENGTH = 53; - - /* - * CODE: LF_E_FLOATING_CLIENT_METADATA_LIMIT - * - * MESSAGE: The floating client has reached it's metadata fields limit. - */ public static final int LF_E_FLOATING_CLIENT_METADATA_LIMIT = 54; - - /* - * CODE: LF_E_METER_ATTRIBUTE_NOT_FOUND - * - * MESSAGE: The meter attribute does not exist. - */ public static final int LF_E_METER_ATTRIBUTE_NOT_FOUND = 55; - - /* - * CODE: LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED - * - * MESSAGE: The meter attribute has reached it's usage limit. - */ public static final int LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED = 56; - - /* - * CODE: LF_E_PRODUCT_VERSION_NOT_LINKED - * - * MESSAGE: No product version is linked with the license. - */ public static final int LF_E_PRODUCT_VERSION_NOT_LINKED = 57; - - /* - * CODE: LF_E_FEATURE_FLAG_NOT_FOUND - * - * MESSAGE: The product version feature flag does not exist. - */ public static final int LF_E_FEATURE_FLAG_NOT_FOUND = 58; - - /* - * CODE: LF_E_SYSTEM_PERMISSION - * - * MESSAGE: Insufficient system permissions. - */ public static final int LF_E_SYSTEM_PERMISSION = 59; - - /* - * CODE: LF_E_IP - * - * MESSAGE: IP address is not allowed. - */ public static final int LF_E_IP = 60; - - /* - * CODE: LF_E_INVALID_PERMISSION_FLAG - * - * MESSAGE: Invalid permission flag. - */ public static final int LF_E_INVALID_PERMISSION_FLAG = 61; - - /* - * CODE: LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED - * - * MESSAGE: Offline floating license is not allowed for per-instance leasing strategy. - */ public static final int LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED = 62; - - /* - * CODE: LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED - * - * MESSAGE: Maximum offline lease duration exceeded. - */ public static final int LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED = 63; - - /* - * CODE: LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED - * - * MESSAGE: Allowed offline floating clients limit reached. - */ public static final int LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED = 64; - - /* - * CODE: LF_E_WMIC - * - * MESSAGE: Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled. This error is specific to Windows only. - */ public static final int LF_E_WMIC = 65; - - /* - * CODE: LF_E_MACHINE_FINGERPRINT - * - * MESSAGE: Machine fingerprint has changed since activation. - */ public static final int LF_E_MACHINE_FINGERPRINT = 66; - - /* - * CODE: LF_E_PROXY_NOT_TRUSTED - * - * MESSAGE: Request blocked due to untrusted proxy. - */ - public static final int LF_E_PROXY_NOT_TRUSTED = 67; - - /* - * CODE: LF_E_CLIENT - * - * MESSAGE: Client error. - */ - public static final int LF_E_CLIENT = 70; - - /* - * CODE: LF_E_SERVER - * - * MESSAGE: Server error. - */ - public static final int LF_E_SERVER = 71; - - /* - * CODE: LF_E_SERVER_TIME_MODIFIED - * - * MESSAGE: System time on server has been tampered with. Ensure your date and time settings are correct on the server machine. - */ - public static final int LF_E_SERVER_TIME_MODIFIED = 72; - - /* - * CODE: LF_E_SERVER_LICENSE_NOT_ACTIVATED - * - * MESSAGE: The server has not been activated using a license key. - */ - public static final int LF_E_SERVER_LICENSE_NOT_ACTIVATED = 73; - - /* - * CODE: LF_E_SERVER_LICENSE_EXPIRED - * - * MESSAGE: The server license has expired. - */ - public static final int LF_E_SERVER_LICENSE_EXPIRED = 74; - - /* - * CODE: LF_E_SERVER_LICENSE_SUSPENDED - * - * MESSAGE: The server license has been suspended. - */ - public static final int LF_E_SERVER_LICENSE_SUSPENDED = 75; - - /* - * CODE: LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER - * - * MESSAGE: The grace period for server license is over. - */ - public static final int LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER = 76; } From c9634abb2b23bc9f730c63f9435568faf52a0d78 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Fri, 2 Aug 2024 18:51:37 +0530 Subject: [PATCH 3/9] feat : add missing error code --- .../LexFloatClientException.java | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index 4c76e4b..825df03 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -1,4 +1,5 @@ package com.cryptlex.lexfloatclient; + public class LexFloatClientException extends Exception { int errorCode; @@ -101,7 +102,7 @@ public static String getErrorMessage(int errorCode) { case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: message = "The grace period for server license is over."; break; - + // Missing error codes case LF_E_SYSTEM_PERMISSION: message = "Insufficient system permissions."; @@ -124,14 +125,51 @@ public static String getErrorMessage(int errorCode) { case LF_E_MACHINE_FINGERPRINT: message = "Machine fingerprint has changed since activation."; break; + + case LF_E_SERVER_TIME_MODIFIED: + message = "System time on server has been tampered with."; + break; + case LF_E_SERVER_LICENSE_NOT_ACTIVATED: + message = "The server has not been activated using a license key."; + break; + case LF_E_SERVER_LICENSE_EXPIRED: + message = "The server license has expired."; + break; + case LF_E_SERVER_LICENSE_SUSPENDED: + message = "The server license has been suspended."; + break; + case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: + message = "The grace period for server license is over."; + break; + // 70-series error codes + case LF_E_CLIENT: + message = "Client error."; + break; + case LF_E_SERVER: + message = "Server error."; + break; + case LF_E_SERVER_TIME_MODIFIED: + message = "System time on server has been tampered with."; + break; + case LF_E_SERVER_LICENSE_NOT_ACTIVATED: + message = "The server has not been activated using a license key."; + break; + case LF_E_SERVER_LICENSE_EXPIRED: + message = "The server license has expired."; + break; + case LF_E_SERVER_LICENSE_SUSPENDED: + message = "The server license has been suspended."; + break; + case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: + message = "The grace period for server license is over."; + break; + default: message = "Unknown error!"; } return message; } - - // Existing error codes public static final int LF_OK = 0; public static final int LF_FAIL = 1; public static final int LF_E_PRODUCT_ID = 40; @@ -161,4 +199,11 @@ public static String getErrorMessage(int errorCode) { public static final int LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED = 64; public static final int LF_E_WMIC = 65; public static final int LF_E_MACHINE_FINGERPRINT = 66; + public static final int LF_E_CLIENT = 70; + public static final int LF_E_SERVER = 71; + public static final int LF_E_SERVER_TIME_MODIFIED = 72; + public static final int LF_E_SERVER_LICENSE_NOT_ACTIVATED = 73; + public static final int LF_E_SERVER_LICENSE_EXPIRED = 74; + public static final int LF_E_SERVER_LICENSE_SUSPENDED = 75; + public static final int LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER = 76; } From d629a997c48d2a24ebad663e33b36bda2a9b76b7 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Mon, 5 Aug 2024 09:33:49 +0530 Subject: [PATCH 4/9] feat: add missing codes --- .../LexFloatClientException.java | 199 ++++++++++++++++-- 1 file changed, 181 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index 825df03..8b1a7d2 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -102,8 +102,6 @@ public static String getErrorMessage(int errorCode) { case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: message = "The grace period for server license is over."; break; - - // Missing error codes case LF_E_SYSTEM_PERMISSION: message = "Insufficient system permissions."; break; @@ -138,11 +136,6 @@ public static String getErrorMessage(int errorCode) { case LF_E_SERVER_LICENSE_SUSPENDED: message = "The server license has been suspended."; break; - case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: - message = "The grace period for server license is over."; - break; - - // 70-series error codes case LF_E_CLIENT: message = "Client error."; break; @@ -161,49 +154,219 @@ public static String getErrorMessage(int errorCode) { case LF_E_SERVER_LICENSE_SUSPENDED: message = "The server license has been suspended."; break; - case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: - message = "The grace period for server license is over."; - break; - default: message = "Unknown error!"; } return message; } + /* + * CODE: LF_OK + * + * MESSAGE: Success code. + */ public static final int LF_OK = 0; + + /* + * CODE: LF_FAIL + * + * MESSAGE: Failure code. + */ public static final int LF_FAIL = 1; + + /* + * CODE: LF_E_PRODUCT_ID + * + * MESSAGE: The product id is incorrect. + */ public static final int LF_E_PRODUCT_ID = 40; + + /* + * CODE: LF_E_CALLBACK + * + * MESSAGE: Invalid or missing callback function. + */ public static final int LF_E_CALLBACK = 41; + + /* + * CODE: LF_E_HOST_URL + * + * MESSAGE: Missing or invalid server url. + */ public static final int LF_E_HOST_URL = 42; + + /* + * CODE: LF_E_TIME + * + * MESSAGE: Ensure system date and time settings are correct. + */ public static final int LF_E_TIME = 43; + + /* + * CODE: LF_E_INET + * + * MESSAGE: Failed to connect to the server due to network error. + */ public static final int LF_E_INET = 44; + + /* + * CODE: LF_E_NO_LICENSE + * + * MESSAGE: License has not been leased yet. + */ public static final int LF_E_NO_LICENSE = 45; + + /* + * CODE: LF_E_LICENSE_EXISTS + * + * MESSAGE: License has already been leased. + */ public static final int LF_E_LICENSE_EXISTS = 46; + + /* + * CODE: LF_E_LICENSE_NOT_FOUND + * + * MESSAGE: License does not exist on server or has already expired. This + * happens when the request to refresh the license is delayed. + */ public static final int LF_E_LICENSE_NOT_FOUND = 47; + + /* + * CODE: LF_E_LICENSE_EXPIRED_INET + * + * MESSAGE: License lease has expired due to network error. This happens when + * the request to refresh the license fails due to network error. + */ public static final int LF_E_LICENSE_EXPIRED_INET = 48; + + /* + * CODE: LF_E_LICENSE_LIMIT_REACHED + * + * MESSAGE: The server has reached it's allowed limit of floating licenses. + */ public static final int LF_E_LICENSE_LIMIT_REACHED = 49; + + /* + * CODE: LF_E_BUFFER_SIZE + * + * MESSAGE: The buffer size was smaller than required. + */ public static final int LF_E_BUFFER_SIZE = 50; + + /* + * CODE: LF_E_METADATA_KEY_NOT_FOUND + * + * MESSAGE: The metadata key does not exist. + */ public static final int LF_E_METADATA_KEY_NOT_FOUND = 51; + + /* + * CODE: LF_E_METADATA_KEY_LENGTH + * + * MESSAGE: Metadata key length is more than 256 characters. + */ public static final int LF_E_METADATA_KEY_LENGTH = 52; + + /* + * CODE: LF_E_METADATA_VALUE_LENGTH + * + * MESSAGE: Metadata value length is more than 4096 characters. + */ public static final int LF_E_METADATA_VALUE_LENGTH = 53; + + /* + * CODE: LF_E_ACTIVATION_METADATA_LIMIT + * + * MESSAGE: The floating client has reached it's metadata fields limit. + */ public static final int LF_E_FLOATING_CLIENT_METADATA_LIMIT = 54; + + /* + * CODE: LF_E_METER_ATTRIBUTE_NOT_FOUND + * + * MESSAGE: The meter attribute does not exist. + */ public static final int LF_E_METER_ATTRIBUTE_NOT_FOUND = 55; + + /* + * CODE: LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED + * + * MESSAGE: The meter attribute has reached it's usage limit. + */ public static final int LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED = 56; + + /** + * CODE: LF_E_PRODUCT_VERSION_NOT_LINKED + * + * MESSAGE: No product version is linked with the license. + */ public static final int LF_E_PRODUCT_VERSION_NOT_LINKED = 57; + + /** + * CODE: LF_E_FEATURE_FLAG_NOT_FOUND + * + * MESSAGE: The product version feature flag does not exist. + */ public static final int LF_E_FEATURE_FLAG_NOT_FOUND = 58; - public static final int LF_E_SYSTEM_PERMISSION = 59; + + /** + * Insufficient system permissions. + */ + public static final int LF_E_SYSTEM_PERMISSION = 59, + + /* + * CODE: LF_E_IP + * + * MESSAGE: IP address is not allowed. + */ public static final int LF_E_IP = 60; - public static final int LF_E_INVALID_PERMISSION_FLAG = 61; - public static final int LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED = 62; - public static final int LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED = 63; - public static final int LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED = 64; - public static final int LF_E_WMIC = 65; - public static final int LF_E_MACHINE_FINGERPRINT = 66; + + /* + * CODE: LF_E_CLIENT + * + * MESSAGE: Client error. + */ public static final int LF_E_CLIENT = 70; + + /* + * CODE: LF_E_SERVER + * + * MESSAGE: Server error. + */ public static final int LF_E_SERVER = 71; + + /* + * CODE: LF_E_SERVER_TIME_MODIFIED + * + * MESSAGE: System time on server has been tampered with. Ensure your date and + * time settings are correct on the server machine. + */ public static final int LF_E_SERVER_TIME_MODIFIED = 72; + + /* + * CODE: LF_E_SERVER_LICENSE_NOT_ACTIVATED + * + * MESSAGE: The server has not been activated using a license key. + */ public static final int LF_E_SERVER_LICENSE_NOT_ACTIVATED = 73; + + /* + * CODE: LF_E_SERVER_LICENSE_EXPIRED + * + * MESSAGE: The server license has expired. + */ public static final int LF_E_SERVER_LICENSE_EXPIRED = 74; + + /* + * CODE: LF_E_SERVER_LICENSE_SUSPENDED + * + * MESSAGE: The server license has been suspended. + */ public static final int LF_E_SERVER_LICENSE_SUSPENDED = 75; + + /* + * CODE: LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER + * + * MESSAGE: The grace period for server license is over. + */ public static final int LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER = 76; } From 20ab5d045cee63b0fb5e0da5eaa40862b4b7aa9c Mon Sep 17 00:00:00 2001 From: muneebkq Date: Mon, 5 Aug 2024 09:36:25 +0530 Subject: [PATCH 5/9] fic: add missing codes --- .../LexFloatClientException.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index 8b1a7d2..51d5c22 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -320,6 +320,49 @@ public static String getErrorMessage(int errorCode) { */ public static final int LF_E_IP = 60; + + /* + * CODE: LF_E_INVALID_PERMISSION_FLAG + * + * MESSAGE: Invalid permission flag. + */ + public static final int LF_E_INVALID_PERMISSION_FLAG = 61; + + /* + * CODE: LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED + * + * MESSAGE: Offline floating license is not allowed for per-instance leasing strategy. + */ + public static final int LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED = 62; + + /* + * CODE: LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED + * + * MESSAGE: Maximum offline lease duration exceeded. + */ + public static final int LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED = 63; + + /* + * CODE: LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED + * + * MESSAGE: Allowed offline floating clients limit reached. + */ + public static final int LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED = 64; + + /* + * CODE: LF_E_WMIC + * + * MESSAGE: Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled. + */ + public static final int LF_E_WMIC = 65; + + /* + * CODE: LF_E_MACHINE_FINGERPRINT + * + * MESSAGE: Machine fingerprint has changed since activation. + */ + public static final int LF_E_MACHINE_FINGERPRINT = 66; + /* * CODE: LF_E_CLIENT * From b1d4c82041057a8400bd242ba853015620b804e6 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Mon, 5 Aug 2024 09:37:44 +0530 Subject: [PATCH 6/9] refactor: jsdoc --- .../com/cryptlex/lexfloatclient/LexFloatClientException.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index 51d5c22..bfddd62 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -20,7 +20,6 @@ public int getCode() { public static String getErrorMessage(int errorCode) { String message; switch (errorCode) { - // Existing error codes case LF_E_PRODUCT_ID: message = "The product id is incorrect."; break; From 1e1b074f90cbe2b1848c9504792952eb887b67c9 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Mon, 5 Aug 2024 10:03:11 +0530 Subject: [PATCH 7/9] refactor: coding format --- .../LexFloatClientException.java | 252 ++++++++---------- 1 file changed, 110 insertions(+), 142 deletions(-) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index bfddd62..65d1318 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -20,141 +20,110 @@ public int getCode() { public static String getErrorMessage(int errorCode) { String message; switch (errorCode) { - case LF_E_PRODUCT_ID: - message = "The product id is incorrect."; - break; - case LF_E_CALLBACK: - message = "Invalid or missing callback function."; - break; - case LF_E_HOST_URL: - message = "Missing or invalid server url."; - break; - case LF_E_TIME: - message = "Ensure system date and time settings are correct."; - break; - case LF_E_INET: - message = "Failed to connect to the server due to network error."; - break; - case LF_E_NO_LICENSE: - message = "License has not been leased yet."; - break; - case LF_E_LICENSE_EXISTS: - message = "License has already been leased."; - break; - case LF_E_LICENSE_NOT_FOUND: - message = "License does not exist on server or has already expired."; - break; - case LF_E_LICENSE_EXPIRED_INET: - message = "License lease has expired due to network error."; - break; - case LF_E_LICENSE_LIMIT_REACHED: - message = "The server has reached it's allowed limit of floating licenses."; - break; - case LF_E_BUFFER_SIZE: - message = "The buffer size was smaller than required."; - break; - case LF_E_METADATA_KEY_NOT_FOUND: - message = "The metadata key does not exist."; - break; - case LF_E_METADATA_KEY_LENGTH: - message = "Metadata key length is more than 256 characters."; - break; - case LF_E_METADATA_VALUE_LENGTH: - message = "Metadata value length is more than 4096 characters."; - break; - case LF_E_FLOATING_CLIENT_METADATA_LIMIT: - message = "The floating client has reached it's metadata fields limit."; - break; - case LF_E_METER_ATTRIBUTE_NOT_FOUND: - message = "The meter attribute does not exist."; - break; - case LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED: - message = "The meter attribute has reached it's usage limit."; - break; - case LF_E_PRODUCT_VERSION_NOT_LINKED: - message = "No product version is linked with the license."; - break; - case LF_E_FEATURE_FLAG_NOT_FOUND: - message = "The product version feature flag does not exist."; - break; - case LF_E_IP: - message = "IP address is not allowed."; - break; - case LF_E_CLIENT: - message = "Client error."; - break; - case LF_E_SERVER: - message = "Server error."; - break; - case LF_E_SERVER_TIME_MODIFIED: - message = "System time on server has been tampered with."; - break; - case LF_E_SERVER_LICENSE_NOT_ACTIVATED: - message = "The server has not been activated using a license key."; - break; - case LF_E_SERVER_LICENSE_EXPIRED: - message = "The server license has expired."; - break; - case LF_E_SERVER_LICENSE_SUSPENDED: - message = "The server license has been suspended."; - break; - case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: - message = "The grace period for server license is over."; - break; - case LF_E_SYSTEM_PERMISSION: - message = "Insufficient system permissions."; - break; - case LF_E_INVALID_PERMISSION_FLAG: - message = "Invalid permission flag."; - break; - case LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: - message = "Offline floating license is not allowed for per-instance leasing strategy."; - break; - case LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: - message = "Maximum offline lease duration exceeded."; - break; - case LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: - message = "Allowed offline floating clients limit reached."; - break; - case LF_E_WMIC: - message = "Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled."; - break; - case LF_E_MACHINE_FINGERPRINT: - message = "Machine fingerprint has changed since activation."; - break; - - case LF_E_SERVER_TIME_MODIFIED: - message = "System time on server has been tampered with."; - break; - case LF_E_SERVER_LICENSE_NOT_ACTIVATED: - message = "The server has not been activated using a license key."; - break; - case LF_E_SERVER_LICENSE_EXPIRED: - message = "The server license has expired."; - break; - case LF_E_SERVER_LICENSE_SUSPENDED: - message = "The server license has been suspended."; - break; - case LF_E_CLIENT: - message = "Client error."; - break; - case LF_E_SERVER: - message = "Server error."; - break; - case LF_E_SERVER_TIME_MODIFIED: - message = "System time on server has been tampered with."; - break; - case LF_E_SERVER_LICENSE_NOT_ACTIVATED: - message = "The server has not been activated using a license key."; - break; - case LF_E_SERVER_LICENSE_EXPIRED: - message = "The server license has expired."; - break; - case LF_E_SERVER_LICENSE_SUSPENDED: - message = "The server license has been suspended."; - break; - default: - message = "Unknown error!"; + case LF_E_PRODUCT_ID: + message = "The product id is incorrect."; + break; + case LF_E_CALLBACK: + message = "Invalid or missing callback function."; + break; + case LF_E_HOST_URL: + message = "Missing or invalid server url."; + break; + case LF_E_TIME: + message = "Ensure system date and time settings are correct."; + break; + case LF_E_INET: + message = "Failed to connect to the server due to network error."; + break; + case LF_E_NO_LICENSE: + message = "License has not been leased yet."; + break; + case LF_E_LICENSE_EXISTS: + message = "License has already been leased."; + break; + case LF_E_LICENSE_NOT_FOUND: + message = "License does not exist on server or has already expired."; + break; + case LF_E_LICENSE_EXPIRED_INET: + message = "License lease has expired due to network error."; + break; + case LF_E_LICENSE_LIMIT_REACHED: + message = "The server has reached it's allowed limit of floating licenses."; + break; + case LF_E_BUFFER_SIZE: + message = "The buffer size was smaller than required."; + break; + case LF_E_METADATA_KEY_NOT_FOUND: + message = "The metadata key does not exist."; + break; + case LF_E_METADATA_KEY_LENGTH: + message = "Metadata key length is more than 256 characters."; + break; + case LF_E_METADATA_VALUE_LENGTH: + message = "Metadata value length is more than 4096 characters."; + break; + case LF_E_FLOATING_CLIENT_METADATA_LIMIT: + message = "The floating client has reached it's metadata fields limit."; + break; + case LF_E_METER_ATTRIBUTE_NOT_FOUND: + message = "The meter attribute does not exist."; + break; + case LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED: + message = "The meter attribute has reached it's usage limit."; + break; + case LF_E_PRODUCT_VERSION_NOT_LINKED: + message = "No product version is linked with the license."; + break; + case LF_E_FEATURE_FLAG_NOT_FOUND: + message = "The product version feature flag does not exist."; + break; + case LF_E_IP: + message = "IP address is not allowed."; + break; + case LF_E_SYSTEM_PERMISSION: + message = "Insufficient system permissions."; + break; + case LF_E_INVALID_PERMISSION_FLAG: + message = "Invalid permission flag."; + break; + case LF_E_OFFLINE_FLOATING_LICENSE_NOT_ALLOWED: + message = "Offline floating license is not allowed for per-instance leasing strategy."; + break; + case LF_E_MAX_OFFLINE_LEASE_DURATION_EXCEEDED: + message = "Maximum offline lease duration exceeded."; + break; + case LF_E_ALLOWED_OFFLINE_FLOATING_CLIENTS_LIMIT_REACHED: + message = "Allowed offline floating clients limit reached."; + break; + case LF_E_WMIC: + message = "Fingerprint couldn't be generated because Windows Management Instrumentation (WMI) service has been disabled."; + break; + case LF_E_MACHINE_FINGERPRINT: + message = "Machine fingerprint has changed since activation."; + break; + case LF_E_CLIENT: + message = "Client error."; + break; + case LF_E_SERVER: + message = "Server error."; + break; + case LF_E_SERVER_TIME_MODIFIED: + message = "System time on server has been tampered with."; + break; + case LF_E_SERVER_LICENSE_NOT_ACTIVATED: + message = "The server has not been activated using a license key."; + break; + case LF_E_SERVER_LICENSE_EXPIRED: + message = "The server license has expired."; + break; + case LF_E_SERVER_LICENSE_SUSPENDED: + message = "The server license has been suspended."; + break; + case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: + message = "The grace period for server license is over."; + break; + default: + message = "Unknown error!"; } return message; } @@ -292,25 +261,25 @@ public static String getErrorMessage(int errorCode) { * MESSAGE: The meter attribute has reached it's usage limit. */ public static final int LF_E_METER_ATTRIBUTE_USES_LIMIT_REACHED = 56; - - /** + + /* * CODE: LF_E_PRODUCT_VERSION_NOT_LINKED * * MESSAGE: No product version is linked with the license. */ public static final int LF_E_PRODUCT_VERSION_NOT_LINKED = 57; - /** + /* * CODE: LF_E_FEATURE_FLAG_NOT_FOUND * * MESSAGE: The product version feature flag does not exist. */ public static final int LF_E_FEATURE_FLAG_NOT_FOUND = 58; - /** + /* * Insufficient system permissions. */ - public static final int LF_E_SYSTEM_PERMISSION = 59, + public static final int LF_E_SYSTEM_PERMISSION = 59; /* * CODE: LF_E_IP @@ -319,7 +288,6 @@ public static String getErrorMessage(int errorCode) { */ public static final int LF_E_IP = 60; - /* * CODE: LF_E_INVALID_PERMISSION_FLAG * @@ -411,4 +379,4 @@ public static String getErrorMessage(int errorCode) { * MESSAGE: The grace period for server license is over. */ public static final int LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER = 76; -} +} \ No newline at end of file From b773f6dca693f303ac2f14d33fdd745fcf25c9b3 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Tue, 6 Aug 2024 10:12:24 +0530 Subject: [PATCH 8/9] feat: add LF_E_PROXY_NOT_TRUSTED --- .../cryptlex/lexfloatclient/LexFloatClientException.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index 65d1318..223a7f1 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -122,6 +122,9 @@ public static String getErrorMessage(int errorCode) { case LF_E_SERVER_LICENSE_GRACE_PERIOD_OVER: message = "The grace period for server license is over."; break; + case LF_E_PROXY_NOT_TRUSTED: + message = "Request blocked due to untrusted proxy."; + break; default: message = "Unknown error!"; } @@ -329,6 +332,12 @@ public static String getErrorMessage(int errorCode) { * MESSAGE: Machine fingerprint has changed since activation. */ public static final int LF_E_MACHINE_FINGERPRINT = 66; + /* + * CODE: LF_E_PROXY_NOT_TRUSTED + * + * MESSAGE: Request blocked due to untrusted proxy. + */ + public static final int LF_E_PROXY_NOT_TRUSTED = 67, /* * CODE: LF_E_CLIENT From 4b6de3fb8c3b0bb3469f0db72945c8ce7407eea5 Mon Sep 17 00:00:00 2001 From: muneebkq Date: Tue, 6 Aug 2024 11:01:40 +0530 Subject: [PATCH 9/9] refactor: error code --- .../com/cryptlex/lexfloatclient/LexFloatClientException.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java index 223a7f1..7438669 100644 --- a/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java +++ b/src/main/java/com/cryptlex/lexfloatclient/LexFloatClientException.java @@ -337,7 +337,7 @@ public static String getErrorMessage(int errorCode) { * * MESSAGE: Request blocked due to untrusted proxy. */ - public static final int LF_E_PROXY_NOT_TRUSTED = 67, + public static final int LF_E_PROXY_NOT_TRUSTED = 67; /* * CODE: LF_E_CLIENT