Closed tiagosalvador closed 2 years ago
Hey, thanks for opening your first issue! 🙂 Be sure to check out the wiki and the HT forum for support.
@tiagosalvador to find this, i need more information. could you please add a longer part of the error stack trace. it is best to upload the database (zip backup) so that I can reproduce the problem with the debugger.
@wsbrenk here are the full screenshots with the error trace: https://ibb.co/pyt7SWq https://ibb.co/x2NmF3H
As for the database, that might be part of the problem. I can't seem to find it. I check the package contents of the Hattrick Organizer app and it's not there. I have several .hrf files, is that what you want?
i'm not a mac expert. could you please checkt if this does exist:
~/Library/Application Support/HO
if yes, there should be a database folder and hopefully some backups (which i could read on windows systems). on windows there are zip files.
No, ~/Library/Application Support/HO does not exist.
hmm- looks strange. maybe your installation didn't succeed.
could you check this. maybe this could help: https://ho.readthedocs.io/en/latest/installing_ho.html
Didn't really help. I tried reinstalling and still the same problem. I believe the database is being stored somewhere, but maybe just the wrong place since I was able to create a new one. I'm using the last macOS, maybe that's the reason.
I dug a little bit more and it seems I have to Library folders and was able to find the database. db_tsalvador-2021-12-20.zip
to me, everything looks good!?
maybe you should restore this backup too.
Everything looks fine in that screenshot, but I still have the same issue after restoring to that backup. I don't even get the 4 sub-tabs (Training, Prediction, Analyzer, Effect). Maybe it's something related to the Mac and Java? Because another thing that happens is that I have to do the CHPP authorization everytime I open HO.
could you please check, if there is a log file of your session. should also be in that HO directory.
Yes, there is. In the meantime, I have tried reinstalling it to, so uploading a new database file as well. error.log HO-2021-12-21.log output.log
Edit: remove link to db
@tychobrailleur as this is mac os specific, any chance you can have a look at it ?
Looks linked to #1291
I'll try to spend more time on it this weekend, but everything works ok on the head of master
. The error in the log is:
12:51:32 [Error] core.util.ExceptionHandler: java.lang.NullPointerException: Cannot invoke "core.training.TrainingPerWeek.getTrainingDate()" because "previousTraining" is null
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.model.TrainingModel.adjustFutureTrainingsVector(TrainingModel.java:175)
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.model.TrainingModel.getFutureTrainings(TrainingModel.java:69)
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.TrainingPanel.reload(TrainingPanel.java:71)
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.TrainingPanel.<init>(TrainingPanel.java:63)
12:51:32 [Error] core.util.ExceptionHandler: module.training.TrainingModulePanel.initComponents(TrainingModulePanel.java:66)
12:51:32 [Error] core.util.ExceptionHandler: module.training.TrainingModulePanel.initialize(TrainingModulePanel.java:28)
12:51:32 [Error] core.util.ExceptionHandler: core.gui.comp.panel.LazyPanel.callInitialize(LazyPanel.java:150)
which I believe we have seen before? It doesn't quite match the original error mentioned, though:
Cannot invoke "core.training.WeeklyTrainingType.getTrainingSkillPartlyTrainingPositions()" because "tt" is null
Might be worth checking out the code to see how that tt
var can be null
.
That NPE has been fixed in commit a4d2edeeca799d3b29bb172041a4d89e79b2ff13
I cannot find the tt
variable mentioned in the original bug report, so it looks like everything should be fine with the next release.
Thank you for looking into it! Unfortunately, I don't think it is fixed. I installed the latest release (alpha) and now there is a new error. https://ibb.co/K5XGr0y https://ibb.co/61vnD7M
This seems to be a different error:
java.lang.IndexOutOfBounds Exception: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions .outOfBounds(Preconditions .java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions .checkIndex(Preconditions.java:266)
at java.base/java.util.Objects.checkIndex(Objects.java:359)
at java.base/java.util.ArrayList.get(ArrayList.java:427)
at core.training.FutureTrainingManager.previewPlayer(FutureTrainingManager.java:82)
at core.training.FutureTrainingManager.<init>(FutureTrainingManager.java:41)
at module.training.ui.model.OutputTableModel.fillWithData(OutputTableModel.java:155)
at module.training.ui.OutputPanel.update(OutputPanel.java:77)
at module.training.ui.OutputPanel.initialize(OutputPanel.java:70)
at core.gui.comp.panellazylmagePanel.callInitialize(LazylmagePanel.java:145)
at core.gui.comp.panellazylmagePanel$2.hierarchyChanged(LazylmagePanel.java:132)
It looks like there isn't any future training for a specific player (table FUTURETRAINING
is empty). Any thoughts, @wsbrenk?
@tychobrailleur i'm not able to reproduce this error on my windows system. the only idea i have is, that some kind of coincidence with wrong packages of java or HO could be the reason. maybe we included wrong java version to the mac dmg files or the user has old java instances on his mac which are not compatible with HO5 ???
For what is worth I have the new mac with the Apple M1 Pro chip. I have also tried it on an older mac with an intel chip and got the same error.
@tychobrailleur i'm not able to reproduce this error on my windows system. the only idea i have is, that some kind of coincidence with wrong packages of java or HO could be the reason. maybe we included wrong java version to the mac dmg files or the user has old java instances on his mac which are not compatible with HO5 ???
I am somewhat doubtful this is a JVM issue; an older JVM would completely blow up, the app would not even start. I have tried to install HO-5.1.3877.2-JRE.dmg
and copied the DB under ~/Library/Application Support/HO/db
on macOS Big Sur, and I cannot reproduce.
Looking closely at the code, it looks to me that this new issue is a fallout of the fix from a4d2edeeca799d3b29bb172041a4d89e79b2ff13 “#1305 fix npe in TrainingModel.adjustFutureTrainingsVector”:
From TrainingModel#getFutureTrainings
:
public List<TrainingPerWeek> getFutureTrainings() {
if (futureTrainings == null) {
var _futureTrainings = DBManager.instance().getFutureTrainingsVector();
. . .
_futureTrainings = adjustFutureTrainingsVector(_futureTrainings, UserParameter.instance().futureWeeks);
. . .
futureTrainings = _futureTrainings;
}
return futureTrainings;
adjustFutureTrainingsVector
must return an empty list (which was coming from the SQL query on the empty FUTURETRAINING
table) for the exception above to occur, and the only reason would be that the check for null is true below:
private List<TrainingPerWeek> adjustFutureTrainingsVector(List<TrainingPerWeek> _futureTrainings, int requiredNBentries) {
List<TrainingPerWeek> newfutureTrainings = new ArrayList<>();
TrainingPerWeek previousTraining = TrainingManager.instance().getNextWeekTraining();
if ( previousTraining != null) { // <-- Change in a4d2edeeca799d3b29bb172041a4d89e79b2ff13
which was the change in the commit.
@wsbrenk What was the reason for previousTraining
to be null in the first place?
In any case, I think we need to code a bit more defensively here, and verify that this.futureTrainings
in FutureTrainingManager
contains at least numberOfWeeks
elements, and TrainingModel#getFutureTrainings
would need a cleanup: writing _futureTrainings
multiple times, and using it as input to another method is a tad suspicious.
@tychobrailleur it's hard for me to remember - I assume that it can be a situation with the nt teams, withfor whom a missing of previousTraining had led to an npe.
to be honest - i don't understand why checking of previous training not null could cause this error?
@tychobrailleur just opened my notepad++ and found this:
12:51:17 [Info] core.HO: VERSION: 5.0 versionType: RELEASE RevisionNumber: 3843
12:51:19 [Info] core.model.HOVerwaltung: language used for interface is: English
12:51:19 [Error] core.util.DateTimeUtils: ZoneID could not be identified from hashValue
12:51:19 [Error] core.util.HTDatetimeBase: ZoneID could not be identified, reverting to System defaults !
12:51:19 [Error] core.training.TrainingWeekManager: Error while performing getNextWeekTraining()
12:51:19 [Info] core.gui.HOMainFrame: This is HO! version 5.0, have fun!
12:51:19 [Info] core.gui.HOMainFrame: Operating system found: Mac OS X on x86_64 (10.16)
12:51:19 [Info] core.gui.HOMainFrame: Using java: 15.0.1 (AdoptOpenJDK)
12:51:22 [Error] core.db.TeamsLogoTable: logo information not available in database for team ID=1409735
12:51:22 [Error] core.gui.theme.ThemeManager: logo not found for team 1409735
12:51:22 [Error] core.db.TeamsLogoTable: logo information not available in database for team ID=86757
12:51:22 [Error] core.gui.theme.ThemeManager: logo not found for team 86757
12:51:25 [Error] core.db.TeamsLogoTable: logo information not available in database for team ID=1409735
12:51:25 [Error] core.gui.theme.ThemeManager: logo not found for team 1409735
12:51:25 [Error] core.db.TeamsLogoTable: logo information not available in database for team ID=86757
12:51:25 [Error] core.gui.theme.ThemeManager: logo not found for team 86757
12:51:26 [Error] core.db.TeamsLogoTable: logo information not available in database for team ID=1409735
12:51:26 [Error] core.gui.theme.ThemeManager: logo not found for team 1409735
12:51:26 [Error] core.db.TeamsLogoTable: logo information not available in database for team ID=86757
12:51:26 [Error] core.gui.theme.ThemeManager: logo not found for team 86757
12:51:32 [Error] core.util.ExceptionHandler: java.lang.NullPointerException: Cannot invoke "core.training.TrainingPerWeek.getTrainingDate()" because "previousTraining" is null
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.model.TrainingModel.adjustFutureTrainingsVector(TrainingModel.java:175)
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.model.TrainingModel.getFutureTrainings(TrainingModel.java:69)
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.TrainingPanel.reload(TrainingPanel.java:71)
12:51:32 [Error] core.util.ExceptionHandler: module.training.ui.TrainingPanel.
this was the reason for the change you found.
@tychobrailleur just opened my notepad++ and found this:
[Error] core.training.TrainingWeekManager: Error while performing getNextWeekTraining()
So there was something in TrainingWeekManager#getNextWeekTraining
that was causing one of those to return null
:
if (!rs.last()) {
HOLogger.instance().error(TrainingWeekManager.class, "Error while performing getNextWeekTraining()");
return null;
}
or
if (numRows != 1) {
HOLogger.instance().error(TrainingWeekManager.class, "Error while performing getNextWeekTraining()");
return null;
}
I don't get how tiagosalvador gets into that situation, the DB returns one record for that query:
sql> SELECT TRAININGDATE, TRAININGSART, TRAININGSINTENSITAET, STAMINATRAININGPART, COTRAINER, TRAINER
FROM XTRADATA
INNER JOIN TEAM on XTRADATA.HRF_ID = TEAM.HRF_ID
INNER JOIN VEREIN on XTRADATA.HRF_ID = VEREIN.HRF_ID
INNER JOIN SPIELER on XTRADATA.HRF_ID = SPIELER.HRF_ID AND SPIELER.TRAINER > 0
INNER JOIN (
SELECT TRAININGDATE, max(HRF_ID) MAX_HR_ID FROM XTRADATA GROUP BY TRAININGDATE
) IJ1 ON XTRADATA.HRF_ID = IJ1.MAX_HR_ID
WHERE XTRADATA.TRAININGDATE > '2021-12-23';
+> +> +> +> +> +> +> +> TRAININGDATE TRAININGSART TRAININGSINTENSITAET STAMINATRAININGPART COTRAINER TRAINER
--------------------- ------------ -------------------- ------------------- --------- -------
2021-12-23 19:00:00.0 3 100 10 10 7
but the same error message appears in the 21/12 log file:
12:51:19 [Error] core.util.DateTimeUtils: ZoneID could not be identified from hashValue
12:51:19 [Error] core.util.HTDatetimeBase: ZoneID could not be identified, reverting to System defaults !
12:51:19 [Error] core.training.TrainingWeekManager: Error while performing getNextWeekTraining()
I would not be surprised if this was caused by the ZoneID
issue there.
BTW, @tiagosalvador https://github.com/akasolace/HO/issues/1291#issuecomment-1021240088 gives a recipe to solve the CHPP token issue; I take it you also close the app using Cmd+Q?
Yes, the CHPP token is no longer an issue! Thanks!
@tychobrailleur #1350 is another ticket that has a time zone problem. I'm afraid some things don't fit yet.
@tychobrailleur #1350 is another ticket that has a time zone problem. I'm afraid some things don't fit yet.
Yes, I saw that one. What problem is the timezone stuff trying to solve? Is it for users to be able to see times in their own timezones, as opposed to the team's?
One thing that needs to be done is to filter the list of timezones returned by Java, which contains anything and everything, to only keep the ones with the form America/Los_Angeles
. I could have a look but it won't be before the weekend now.
Yes, I saw that one. What problem is the timezone stuff trying to solve? Is it for users to be able to see times in their own timezones, as opposed to the team's?
Yes
@tiagosalvador When you get the chance, would you please be able to install the Alpha release, and provide us with the logs? Please make sure to back up the HO folder ~/Library/Application Support/HO
beforehand.
Here they are. I can now enter the Training tab. I was able to edit past trainings, but I see no future training (see https://ibb.co/xDVfWYL). When I try the subtab predictions, that's when I get errors now.
Here they are. I can now enter the Training tab. I was able to edit past trainings, but I see no future training (see https://ibb.co/xDVfWYL). When I try the subtab predictions, that's when I get errors now.
Is that after downloading new data from Hattrick as well?
Relevant logs:
[Error] DateTimeUtils: ZoneID could not be identified from hashValue
[Error] HTDatetimeBase: ZoneID could not be identified, reverting to System defaults: America/Montreal
[Debug] TrainingWeekManager: Next week training date: 2022-02-04T00:00:00Z
[Error] TrainingWeekManager: Error while performing getNextWeekTraining(): empty result set
. . .
[Debug] TrainingModel: Previous training date: null
[Debug] FutureTrainingTable: FutureTraining table has been cleared !
[Warning] FutureTrainingManager: training weeks computed: 0 not matching number of weeks: 16
[Warning] FutureTrainingManager: training weeks computed: 0 not matching number of weeks: 16
[Warning] FutureTrainingManager: training weeks computed: 0 not matching number of weeks: 16
[Warning] FutureTrainingManager: training weeks computed: 0 not matching number of weeks: 16
. . .
[Debug] TrainingModel: Previous training date: null
[Debug] FutureTrainingTable: FutureTraining table has been cleared !
That query returns an empty list for 2022-02-04
:
SELECT TRAININGDATE, TRAININGSART, TRAININGSINTENSITAET, STAMINATRAININGPART, COTRAINER, TRAINER
FROM XTRADATA
INNER JOIN TEAM on XTRADATA.HRF_ID = TEAM.HRF_ID
INNER JOIN VEREIN on XTRADATA.HRF_ID = VEREIN.HRF_ID
INNER JOIN SPIELER on XTRADATA.HRF_ID = SPIELER.HRF_ID AND SPIELER.TRAINER > 0
INNER JOIN (
SELECT TRAININGDATE, max(HRF_ID) MAX_HR_ID FROM XTRADATA GROUP BY TRAININGDATE
) IJ1 ON XTRADATA.HRF_ID = IJ1.MAX_HR_ID
WHERE XTRADATA.TRAININGDATE > '%s'
Again, I cannot reproduce with the original db.
The other error will also have to be fixed to “recover” nicely:
[Error] ExceptionHandler: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
[Error] ExceptionHandler: java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
[Error] ExceptionHandler: java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
[Error] ExceptionHandler: java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
[Error] ExceptionHandler: java.base/java.util.Objects.checkIndex(Objects.java:359)
[Error] ExceptionHandler: java.base/java.util.ArrayList.get(ArrayList.java:427)
[Error] ExceptionHandler: module.training.ui.FutureTrainingPrioPopup.actionPerformed(FutureTrainingPrioPopup.java:53)
[Error] ExceptionHandler: java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
[Error] ExceptionHandler: java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313)
[Error] ExceptionHandler: java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
[Error] ExceptionHandler: java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
[Error] ExceptionHandler: java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374)
[Error] ExceptionHandler: java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1028)
[Error] ExceptionHandler: java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072)
[Error] ExceptionHandler: java.desktop/java.awt.Component.processMouseEvent(Component.java:6626)
[Error] ExceptionHandler: java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3389)
[Error] ExceptionHandler: java.desktop/java.awt.Component.processEvent(Component.java:6391)
[Error] ExceptionHandler: java.desktop/java.awt.Container.processEvent(Container.java:2266)
[Error] ExceptionHandler: java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5001)
[Error] ExceptionHandler: java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
[Error] ExceptionHandler: java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
[Error] ExceptionHandler: java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
[Error] ExceptionHandler: java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
[Error] ExceptionHandler: java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
[Error] ExceptionHandler: java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
[Error] ExceptionHandler: java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2780)
[Error] ExceptionHandler: java.desktop/java.awt.Component.dispatchEvent(Component.java:4833)
[Error] ExceptionHandler: java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
[Error] ExceptionHandler: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
[Error] ExceptionHandler: java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
[Error] ExceptionHandler: java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
[Error] ExceptionHandler: java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
[Error] ExceptionHandler: java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
[Error] ExceptionHandler: java.desktop/java.awt.EventQueue$5.run(EventQueue.java:746)
[Error] ExceptionHandler: java.desktop/java.awt.EventQueue$5.run(EventQueue.java:744)
[Error] ExceptionHandler: java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
[Error] ExceptionHandler: java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
[Error] ExceptionHandler: java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:743)
[Error] ExceptionHandler: java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
[Error] ExceptionHandler: java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
[Error] ExceptionHandler: java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
[Error] ExceptionHandler: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
[Error] ExceptionHandler: java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[Error] ExceptionHandler: java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Yes, it was after downloading new data from Hattrick.
Since you mentioned you couldn't reproduce with original db, I started a whole new database. I experienced the same issue. It's attached along with the error log. Hope it helps! HO-2022-02-03.log
Edit: removed link to db
Since you mentioned you couldn't reproduce with original db, I started a whole new database. I experienced the same issue.
Nice, thanks @tiagosalvador, quote proactive! Still cannot reproduce out of the box.
Interestingly the next training date I am getting is
TrainingWeekManager: Next week training date: 2022-02-03T19:00:00Z
If I force the code to get what you are getting (2022-02-04T00:00:00Z
), I do get the same error.
I am pretty sure it's timezone gymnastics that is going wrong here, and the prime suspect is this method, where timezone is not taken into account:
var date = HOVerwaltung.instance().getModel().getXtraDaten().getNextTrainingDate();
if ( date != null ) {
cl_NextTrainingDate = date.toInstant();
cl_LastUpdateDate = DBManager.instance().getMaxHrf().getDatum().toInstant();
}
In the DB the next training date is 2022-02-03 19:00:00
(presumably Lisbon time?), but if it is treated as America/Montreal
as per log, this becomes 2022-02-04T00:00:00Z
UTC, which causes the problem.
I am thinking in TrainingWeekManager#getNextTraining()
:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.from(ZoneOffset.UTC));
the timezone to be used should be user's TZ rather than UTC.
@tychobrailleur based on your comment, I was able to fix it!!!
So my Hattrick Team is in Portugal, but I live in Montreal. America/Montreal is therefore the timezone I have set on my computer. Once I changed it to Lisbon's time and reopened HO all is working!!! If I switch back to America/Montreal timezone, the error pops up again.
This also explains why no one was able to reproduce the error. I'm guessing if you change the timezone on your computer to America/Montreal you will be able to reproduce it.
Also, on Hattrick I have my timezone set to America/Montreal as well. I tried to switch it to Lisbon's time, downloaded new data on HO, but the error was still there. So it really is the timezone set on my computer, which for this experiment was still America/Montreal, that is the root of the problem.
@tychobrailleur based on your comment, I was able to fix it!!!
Cool, that confirms my theory. :-)
Going through CHPP, date time is CEST, so I am pretty sure this is the conversion back from Instant to UTC that causes the issue, as the JDK assumes the date.toInstant
is in zone America/Montreal
.
So it really is the timezone set on my computer, which for this experiment was still America/Montreal, that is the root of the problem.
Yes, exactly. In this instance, it has nothing to do with the preferred timezone selected in the preferences, it is the system's zone that matters, vs. CEST (i.e. not even UTC).
@tiagosalvador I see only one possible fix, you have to move back to Portugal!! 🤣
Hahaha Funny thing though, when I first reported this I was actually in Portugal, but my Mac never automatically updated the timezone and I never bother too...
This issue should be fixed by #1375 once merged. I have tested on Linux: managed to reproduce by setting system timezone to Canada/Toronto, and verified that issue went away after applying fix.
Thanks a lot @tiagosalvador for your patience and assistance on this one!
To Reproduce Steps to reproduce the behavior:
Platform information: