I recently downloaded the latest realease, but now "Checking for problems" (Ctrl + Shift + V) throws an error: "Comparison method violates its general contract".
I downloaded and installed the latest weekly release, and now the check works. But the beta version was really slow, so I reverted back to the stable release...
So a solution would still interest me. :)
Last edit: Erik De Boeck 2024-12-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I cleared the logs, re-opened OmegaT, and exported the logs to the file "before error". I then ran "Checking for problems" (not sure how it's called exactly in English), and saved the new file "after error". The error statements begin on line 467.
@backjudge88, Hiroshi has implemented a fix in that PR. Could you build the code and see if the solution works? If you can’t build the code, we can provide you with a compiled version.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@brandelune It's not appropriate to ask the reporter to verify the fix in this case, because the issue stems from internal logic errors rather than user-facing behavior. The problems are:
The StAX MS Office filter does not correctly handle MSO temporary files and raises exceptions when it shouldn't.
The GlossarySearcher class does not handle null values properly when caused by the StAX filter.
The GlossarySearcher class displays the resulting exception to the user, even though this error is internal and should be silently handled.
This is an internal processing issue and not something the user should encounter directly.
Required fixes:
The StAX MS Office filter should ignore MSO temporary files.
The GlossarySearcher should be made robust against null inputs.
Exceptions from internal logic should be handled gracefully and not shown to end users.
👍
1
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have built the jar for the topic branch.
When you have a installation of the OmegaT 6.0.1 and test the change here, you can replace your installed OmegaT.jar with the attachment.
You should check current application folder has files such as readme.txt, OmegaT.jar , and others. You should rename current OmegaT.jar with OmegaT-old.jar then copy the hotfix OmegaT.jar to there.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Replacing the jar file of my installed OmegaT instance resulted in the same error window as in my first post. Unfortunately, I didn't think of exporting logs.
Downloading "Windows installer packaged with 64-bit JRE" again and re-installing (which probably was pointless, because I now see the latest change was done in August 2024), and tried "checking for problems". Same error window.
I again replaced the jar in the OmegaT installation folder. Now I saved the logs before trying to "check for problems". Same result. I then saved the logs again.
I ran into this problem again... I tried the latest build of 6.0.2, which threw an error when loading the project. The error refers to a file that doesn't exist:
Okay, I found out that there is a second level to hidden files in Windows, so I got rid of ~$rtalingsvoorbereiding.docx. But that didn't change anything for the error about which this ticket is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Since I opened the ticket a few months ago, I've gained a bit more understanding of Java. It looks like we're being directed to GlossarySearcher.java:279, but that line is empty (https://github.com/omegat-org/omegat/blob/6327a55c9b1884c0a9561419d8a092d9b4641e5f/src/org/omegat/gui/glossary/GlossarySearcher.java#L279).
So the weekly build of 6.0.2 must not be from the master branch?
When I run 6.1.0's weekly build, I don't get the error.
But for full disclosure, that version threw these errors at startup:
Thank you for the feedback. A fix of ClassNotFound from SegmentPropertiesArea class has been merged yesterday with https://github.com/omegat-org/omegat/pull/1845
This issue does not affect functions. Please check next weekly release.
Last edit: Hiroshi Miura 2025-12-30
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The issue is that the condition (o2.getSrcText().contains(o1.getSrcText()) || o1.getSrcText().contains(o2.getSrcText())) is used to decide whether to compare by length, but it doesn't guarantee a consistent ordering across multiple elements.
A strategy
// longer is better if one contains another
causes a problem.
For example: A contains B. B contains C.
But A might NOT contain C (though in string terms it would, but imagine more complex logic or overlapping cases).
More importantly, if A contains B, we sort by length. If A does not contain D, we might fall through to alphabetical sorting. This "switching" of sorting criteria based on a non-transitive property (like "contains") is what trips up TimSort.
The Example
Consider these three strings: A: "abc" (Length 3) B: "a" (Length 1) C: "bc" (Length 2)
A contains B and C B does not contains C
when compared with A-BA-C the determined order is A < B, A < C
Comparisons:
Compare A and B: A contains B. Sort by length (longer first). A < B (Result -4).
Compare B and C: Neither contains the other. Sort alphabetically. B < C ("apple" < "banana").
Compare A and C: Neither contains the other. Sort alphabetically. C < A ("banana" < "apple pie").
The Violation: We have:
A < B
B < C
...but C < A!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I downloaded and installed the latest weekly release, and now the check works. But the beta version was really slow, so I reverted back to the stable release...
So a solution would still interest me. :)
Last edit: Erik De Boeck 2024-12-26
I cleared the logs, re-opened OmegaT, and exported the logs to the file "before error". I then ran "Checking for problems" (not sure how it's called exactly in English), and saved the new file "after error". The error statements begin on line 467.
Thank you for the report.
I picked the lines from the reported log
The source code in OmegaT 6.0 of
GlossarySearcherclass line 249 is likehttps://github.com/omegat-org/omegat/blob/releases/6.0/src/org/omegat/gui/glossary/GlossarySearcher.java#L248-L251
There are several bad habits in the function.
It should be changed such as
I find an error from MS office filter from the log.
Your office file is broken such as partial download or somthing.
This is not a standard MS Office file, it is a MSO temporary file that MSO creates when one opens the file.
See:
https://sourceforge.net/p/omegat/feature-requests/1596/
https://sourceforge.net/p/omegat/bugs/1080/
Pushed PR https://github.com/omegat-org/omegat/pull/1365 for release 6.0 branch.
The problem may be also exist on current master/6.1 beta versions.
Last edit: Hiroshi Miura 2025-04-28
The PR for master branch.
https://github.com/omegat-org/omegat/pull/1424
@backjudge88, Hiroshi has implemented a fix in that PR. Could you build the code and see if the solution works? If you can’t build the code, we can provide you with a compiled version.
@brandelune It's not appropriate to ask the reporter to verify the fix in this case, because the issue stems from internal logic errors rather than user-facing behavior. The problems are:
This is an internal processing issue and not something the user should encounter directly.
Required fixes:
Ok. My bad. Thank you for pointing that out.
So the issue is still unresolved? Or is it resolved, but am I unable to check it/contribute?
You can build the code from the PR if you want. Or you can wait for the weekly release after the merging.
I have built the jar for the topic branch.
When you have a installation of the OmegaT 6.0.1 and test the change here, you can replace your installed OmegaT.jar with the attachment.
There is an application folder on your OS. Please check manual.
https://omegat.sourceforge.io/manual-snapshot/en/chapter.appendices.html#application.folder
You should check current application folder has files such as
readme.txt,OmegaT.jar, and others. You should rename currentOmegaT.jarwithOmegaT-old.jarthen copy the hotfixOmegaT.jarto there.That's what I did in attempts 2-4.
I wasn't fully sure what you meant, but in any case:
1. Running the jar from a folder with only the jar resulted in this error:
The fix was merged in 3 month ago, and waiting release.
I ran into this problem again... I tried the latest build of 6.0.2, which threw an error when loading the project. The error refers to a file that doesn't exist:
Then, when checking for errors, the
Comparison method violates its general contractpops up again. Again, see attached logs.Last edit: Erik De Boeck 2025-12-29
Okay, I found out that there is a second level to hidden files in Windows, so I got rid of
~$rtalingsvoorbereiding.docx. But that didn't change anything for the error about which this ticket is.Since I opened the ticket a few months ago, I've gained a bit more understanding of Java. It looks like we're being directed to
GlossarySearcher.java:279, but that line is empty (https://github.com/omegat-org/omegat/blob/6327a55c9b1884c0a9561419d8a092d9b4641e5f/src/org/omegat/gui/glossary/GlossarySearcher.java#L279).So the weekly build of 6.0.2 must not be from the
masterbranch?When I run 6.1.0's weekly build, I don't get the error.
But for full disclosure, that version threw these errors at startup:
So in summary: the error is still there in 6.0.2, but not in 6.1.0.
Thank you for the feedback. A fix of ClassNotFound from SegmentPropertiesArea class has been merged yesterday with
https://github.com/omegat-org/omegat/pull/1845
This issue does not affect functions. Please check next weekly release.
Last edit: Hiroshi Miura 2025-12-30
The Problem
The issue was introduced to fix BUGS#1239 "feat: glossary support optional sort by src length"
The issue is that the condition
(o2.getSrcText().contains(o1.getSrcText()) || o1.getSrcText().contains(o2.getSrcText()))is used to decide whether to compare by length, but it doesn't guarantee a consistent ordering across multiple elements.A strategy
causes a problem.
For example:
A contains B.
B contains C.
But A might NOT contain C (though in string terms it would, but imagine more complex logic or overlapping cases).
More importantly, if A contains B, we sort by length. If A does not contain D, we might fall through to alphabetical sorting. This "switching" of sorting criteria based on a non-transitive property (like "contains") is what trips up
TimSort.The Example
Consider these three strings:
A: "abc" (Length 3)
B: "a" (Length 1)
C: "bc" (Length 2)
A contains B and C
B does not contains C
when compared with
A-BA-Cthe determined order isA < B,A < CThe trap:
A: "apple pie" (Length 9)
B: "apple" (Length 5)
C: "banana" (Length 6)
Comparisons:
Compare A and B: A contains B. Sort by length (longer first). A < B (Result -4).
Compare B and C: Neither contains the other. Sort alphabetically. B < C ("apple" < "banana").
Compare A and C: Neither contains the other. Sort alphabetically. C < A ("banana" < "apple pie").
The Violation: We have:
I forgot I have already fixed the bug with PR#1424
It is why branch releases/6.0 has "contains" but master branch has "startsWith".
Ok I want to align with the fix for v6.0.2 .