diff options
| author | J08nY | 2024-06-21 14:36:23 +0200 |
|---|---|---|
| committer | J08nY | 2024-06-21 14:36:23 +0200 |
| commit | c112d3e49bbbbf33cc70d12d196e109543c19a3c (patch) | |
| tree | 11a7ec1e99e9b311c420b9c2f736951a21fa6776 /standalone/src/main/java | |
| parent | 9c2b3c836bddddd9486d7ed74b5a95af683ff83e (diff) | |
| download | ECTester-c112d3e49bbbbf33cc70d12d196e109543c19a3c.tar.gz ECTester-c112d3e49bbbbf33cc70d12d196e109543c19a3c.tar.zst ECTester-c112d3e49bbbbf33cc70d12d196e109543c19a3c.zip | |
Diffstat (limited to 'standalone/src/main/java')
| -rw-r--r-- | standalone/src/main/java/cz/crcs/ectester/standalone/ECTesterStandalone.java | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/standalone/src/main/java/cz/crcs/ectester/standalone/ECTesterStandalone.java b/standalone/src/main/java/cz/crcs/ectester/standalone/ECTesterStandalone.java index 10e95ca..e6d8188 100644 --- a/standalone/src/main/java/cz/crcs/ectester/standalone/ECTesterStandalone.java +++ b/standalone/src/main/java/cz/crcs/ectester/standalone/ECTesterStandalone.java @@ -136,16 +136,6 @@ public class ECTesterStandalone { } libs = libObjects.toArray(new ProviderECLibrary[0]); - //TODO: push this further down to only initialize if necessary. - // and only initialize the chosen lib (so give libs a name in Java only) - for (ECLibrary lib : libs) { - try { - lib.initialize(); - } catch (Exception ex) { - System.err.println(ex.getMessage()); - } - } - cfg = new Config(libs); if (!cfg.readOptions(cli)) { return; @@ -302,7 +292,17 @@ public class ECTesterStandalone { */ private void listLibraries() { for (ProviderECLibrary lib : libs) { - if (lib.isInitialized() && (cfg.selected == null || lib == cfg.selected)) { + if (cfg.selected == null || lib == cfg.selected) { + try { + if (!lib.initialize()) { + continue; + } + } catch (Exception ex) { + System.err.println("Error initializing " + lib.fullName()); + System.err.println(ex.getMessage()); + continue; + } + System.out.println("\t- " + Colors.bold(lib.name())); System.out.println(Colors.bold("\t\t- Fullname: ") + lib.getProvider().getName()); System.out.println(Colors.bold("\t\t- Version: ") + lib.getProvider().getVersionStr()); @@ -942,7 +942,7 @@ public class ECTesterStandalone { if (libraryName != null) { List<ProviderECLibrary> matchedLibs = new LinkedList<>(); for (ProviderECLibrary lib : libs) { - if (lib.isInitialized() && lib.name().toLowerCase().contains(libraryName.toLowerCase())) { + if (lib.name().toLowerCase().contains(libraryName.toLowerCase())) { matchedLibs.add(lib); } } @@ -954,6 +954,12 @@ public class ECTesterStandalone { return false; } else { selected = matchedLibs.get(0); + try { + selected.initialize(); + } catch (Exception ex) { + System.err.println("Error initializing " + selected.fullName()); + System.err.println(ex.getMessage()); + } } } } |
