Skip to content

Conversation

@katysaintin
Copy link
Contributor

Manage a java.lang.IllegalArgumentException: Illegal pattern
when default_snapshot_name_date_format preference is set to a wrong format

In the previous version default_snapshot_name_date_format was a flag true or false.
Now, it can be a Date format.

Our user receive this error and the application is freezing :

2025-03-10 09:54:58 WARNING [[org.phoebus.framework.jobs](http://org.phoebus.framework.jobs/)] Job 'Take snapshot' failed
java.lang.IllegalArgumentException: Illegal pattern character 't'
    at java.base/java.text.SimpleDateFormat.compile(SimpleDateFormat.java:849)
    at java.base/java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:657)
    at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:628)
    at java.base/java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:603)
    at org.phoebus.applications.saveandrestore.ui.snapshot.SnapshotTableViewController.lambda$takeSnapshot$24(SnapshotTableViewController.java:250)
    at [org.phoebus.framework.jobs.Job.execute](http://org.phoebus.framework.jobs.job.execute/)(Job.java:50)
    at [org.phoebus.framework.jobs.JobManager.execute](http://org.phoebus.framework.jobs.jobmanager.execute/)(JobManager.java:54)
    at [org.phoebus.framework.jobs.JobManager.lambda](http://org.phoebus.framework.jobs.jobmanager.lambda/)$schedule$0(JobManager.java:45)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    at java.base/java.lang.Thread.run(Thread.java:842)

In addition, the preferences defined in save_and_restore_preferences.properties are not generated in the preferences list in the documentation https://control-system-studio.readthedocs.io/en/latest/preference_properties.html#saveandrestore .
This list is generated by https://github.com/ControlSystemStudio/phoebus/blob/master/docs/source/conf.py , I suppose that the script does not manage 2 preferences files in the same package.

The missing preferences are detected since PR #2927

default_snapshot_name_date_format is set to a wrong format
@georgweiss
Copy link
Collaborator

In the previous version default_snapshot_name_date_format was a flag true or false

@katysaintin, can you please clarify in regards to "previous version"? I cannot see in the history of the preferences file that is has been true/false.

@katysaintin
Copy link
Contributor Author

In the previous version default_snapshot_name_date_format was a flag true or false

@katysaintin, can you please clarify in regards to "previous version"? I cannot see in the history of the preferences file that is has been true/false.

Yes I will check with @agaget , it was an old PR . I ll tell you that ASAP.
We also try to fix conf.py to generates the doc correctly

Copy link
Collaborator

@georgweiss georgweiss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, it makes sense to handle invalid date format, but please add a line of logging when catching the exception so that one may find why a date stamp was not added to the name.

@katysaintin
Copy link
Contributor Author

Yes of course, log warning message done ✔️

@katysaintin
Copy link
Contributor Author

Ok @georgweiss we check with @agaget . In fact , the true or false value, was an old wrong configuration from his side. So the preference always have to be a valid date format.

save_and_restore_preferences.properties
@katysaintin
Copy link
Contributor Author

katysaintin commented Mar 10, 2025

I finally found the problem for the preferences list documentation .
Fix in app/save-and-restore/util/src/main/resources/save_and_restore_util_preferences.properties
The package name was the same of app/save-and-restore/app/src/main/resources/save_and_restore_preferences.properties

And the python script conf.py based on the package name defined in the header to generate preferences documentation.

Fix for #2927

@katysaintin katysaintin merged commit 50ecd42 into ControlSystemStudio:master Mar 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants