| Summary: | [Theming] Not all styles are applied properly | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Sebastian Bauer <mail> | ||||||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||||
| Severity: | normal | ||||||||||
| Priority: | P3 | CC: | cole, ivan, ruediger.herrmann | ||||||||
| Version: | unspecified | ||||||||||
| Target Milestone: | 1.5 M3 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Linux | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Sebastian Bauer
Created attachment 205309 [details]
The CSS file for the test
Created attachment 205310 [details]
The test application
Created attachment 205311 [details]
The configurator
The problem is in QxImage#hashCode, which returns same hashCode for different gradients. I would say more precisely that the problem is that ImagePropertyAdapter.getKey uses the QxImage.hashCode instead of using a key guaranteed to be unique. The same could be said for all of the adapters in ThemePropertyAdapterRegistry. Make the multipliers smaller in QxImage#hashCode to avoid out of integers range. Changes are in CVS HEAD. I don't understand how this fix will _reliably_ solve the issue. Could you explain why the collisions occurred and why the smaller values prevent this? Apart from this, I agree with Cole that ImagePropertyAdapter.getKey methods could be implemented better than using Object#hashCode(). But we should also keep the strings short as they are send over the wire. (In reply to comment #7) > I don't understand how this fix will _reliably_ solve the issue. Could you > explain why the collisions occurred and why the smaller values prevent this? > > Apart from this, I agree with Cole that ImagePropertyAdapter.getKey methods > could be implemented better than using Object#hashCode(). But we should also > keep the strings short as they are send over the wire. I agree with you that this fix is not 100% reliable - probably with 10 stop colors in the gradient the hash code will exceed the max integer value again. But I don't see such a real use case. I've added a JUnit test with 5 stop colors + start and end color and there is no collision. I agree with Cole too, that we have to find a proper implementation of ImagePropertyAdapter.getKey that guarantee the unique key. Here is an example of calculation collision: -2104393728 * 31 + 1113587712 + -2104393728 = -1802502144 43089920 * 31 + 1113587712 + 43089920 = -1802502144 Just for the record - QxImage#hashCode now uses CRC32. One more note for the record: bug 362390 suggests a proper fix. |