Roberto Sánchez
2014-09-18 ca4f38f1305667758c2c2e90b45cd19bdb532721
src/main/java/net/curisit/securis/LicenseValidator.java
....@@ -16,15 +16,18 @@
1616
1717 private static final Logger log = LogManager.getLogger(LicenseValidator.class);
1818
19
- public static LicenseValidator singleton = new LicenseValidator();
20
- public static byte[] LOGO_SECRET;
19
+ private static LicenseValidator singleton = new LicenseValidator();
20
+ protected static byte[] LOGO_SECRET;
2121
22
- private LicenseValidator() {
22
+ static {
2323 try {
2424 LOGO_SECRET = "Logo ipsum s3cr3t test áíóú".getBytes("utf-8");
2525 } catch (UnsupportedEncodingException e) {
2626 log.error("Unexpected error getting LOGO secret", e);
2727 }
28
+ }
29
+
30
+ private LicenseValidator() {
2831 }
2932
3033 public static LicenseValidator getInstance() {
....@@ -57,8 +60,9 @@
5760
5861 public void validateHW(RequestBean reqBean, String appCode, String customerCode) throws SeCurisException {
5962 RequestBean currentHW = ReqGenerator.getInstance().createRequest(appCode, customerCode);
60
- if (!currentHW.match(reqBean))
63
+ if (!currentHW.match(reqBean)) {
6164 throw new SeCurisException("Current System info mismatch the License System info:\n Licensed: " + JsonUtils.toJSON(reqBean, true) + "\n Expected: " + JsonUtils.toJSON(currentHW, true));
65
+ }
6266 }
6367
6468 }