JeffersonLab / hps-java

HPS reconstruction and analysis framework in Java
2 stars 10 forks source link

Fix the conditions option command line tool "Print" function #1012

Closed andrea-celentano closed 1 year ago

andrea-celentano commented 1 year ago

Currently, it looks like the Print function for the CommandLineTool does not work.

To reproduce this issue:

java -cp distribution/target/hps-distribution-5.2.2-SNAPSHOT-bin.jar -Dorg.hps.conditions.url=jdbc:mysql://hpsdb.jlab.org/hps_conditions_dev org.hps.conditions.cli.CommandLineTool -r 10103 -d HPS-PhysicsRun2019-v1-4pt5 print -t ecal_gains

Results to:

Sep 22, 2023 12:42:12 PM org.hps.conditions.cli.CommandLineTool setupConditionsManager
INFO: Setting up the conditions manager ...
Sep 22, 2023 12:42:13 PM org.hps.conditions.database.DatabaseConditionsManager createConnection
INFO: Opening conditions db connection ...
url: jdbc:mysql://hpsdb.jlab.org/hps_conditions_dev
user: hpsuser
Sep 22, 2023 12:42:14 PM org.hps.conditions.database.DatabaseConditionsManager closeConnection
INFO: Closing database connection.
Sep 22, 2023 12:42:14 PM org.hps.conditions.cli.CommandLineTool setupConditionsManager
INFO: Done setting up the conditions manager!
Sep 22, 2023 12:42:14 PM org.hps.conditions.cli.PrintCommand execute
INFO: printing conditions with name: ecal_gains
Sep 22, 2023 12:42:14 PM org.hps.conditions.database.DatabaseConditionsManager createConnection
INFO: Opening conditions db connection ...
url: jdbc:mysql://hpsdb.jlab.org/hps_conditions_dev
user: hpsuser
Sep 22, 2023 12:42:25 PM org.hps.conditions.cli.PrintCommand printConditionsRecords
INFO: printing conditions sets: ecal_gains 
Sep 22, 2023 12:42:25 PM org.hps.conditions.database.AbstractConditionsObjectConverter getData
INFO: loading conditions set...
id: 3648
name: ecal_gains
runStart: 9001
runEnd: 999999
tableName: ecal_gains
collectionId: 3943
updated: 2023-09-18 11:26:01.0
created: 2023-09-18 11:26:01.0
tag: null
createdBy: andrea
notes: gains from cosmics back in development db, for MIPS studies

Sep 22, 2023 12:42:25 PM org.hps.conditions.cli.PrintCommand printCollectionHeader
INFO: 
--------------------------------------
table: ecal_gains
collection ID: 3943
--------------------------------------
ecal_channel_id,gain
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')
    at org.hps.conditions.cli.PrintCommand.printCollection(PrintCommand.java:167)
    at org.hps.conditions.cli.PrintCommand.printCollections(PrintCommand.java:202)
    at org.hps.conditions.cli.PrintCommand.printConditionsRecords(PrintCommand.java:267)
    at org.hps.conditions.cli.PrintCommand.execute(PrintCommand.java:148)
    at org.hps.conditions.cli.CommandLineTool.run(CommandLineTool.java:151)
    at org.hps.conditions.cli.CommandLineTool.main(CommandLineTool.java:59)