aboutsummaryrefslogtreecommitdiff
path: root/standalone/src
diff options
context:
space:
mode:
authorJ08nY2024-06-21 14:36:23 +0200
committerJ08nY2024-06-21 14:36:23 +0200
commitc112d3e49bbbbf33cc70d12d196e109543c19a3c (patch)
tree11a7ec1e99e9b311c420b9c2f736951a21fa6776 /standalone/src
parent9c2b3c836bddddd9486d7ed74b5a95af683ff83e (diff)
downloadECTester-c112d3e49bbbbf33cc70d12d196e109543c19a3c.tar.gz
ECTester-c112d3e49bbbbf33cc70d12d196e109543c19a3c.tar.zst
ECTester-c112d3e49bbbbf33cc70d12d196e109543c19a3c.zip
Diffstat (limited to 'standalone/src')
-rw-r--r--standalone/src/main/java/cz/crcs/ectester/standalone/ECTesterStandalone.java30
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());
+ }
}
}
}