LocalizedImageResource does not serialize locale/style fields -------------------------------------------------------------
Key: WICKET-1062 URL: https://issues.apache.org/jira/browse/WICKET-1062 Project: Wicket Issue Type: Bug Components: wicket Affects Versions: 1.3.0-beta4 Reporter: John Ray I have a page where clicking an AjaxLink causes an Image to be updated. In the onClick() method of the link I change the image via setImageResourceReference(). I then call AjaxRequestTarget.addComponent(image) to have the image rendered. Everything works great when the page is first loaded however if I navigate to a different page and then back again the image doesn't update the first time I click the link. The problem is that the LocalizedImageResource saves the current locale/style in transient fields when it is first created. By navigating to a different page and then back again it causes the class to get serialized and the locale and style are initialized to null. In setSrcAttribute() this code then compares the locale against the image component's locale. Locale l = component.getLocale(); String s = component.getStyle(); if (resourceKind == null || (!Objects.equal(locale, component.getLocale()) || !Objects.equal(style, component .getStyle()))) { // Get new component locale and style locale = component.getLocale(); style = component.getStyle(); // Invalidate current resource so it will be reloaded/recomputed resourceReference = null; resource = null; } Since the local in LocalizedImageResource was not serialized it never matches and my call to setImageResourceReference() is basically ignored. If you just remove the transient keyword from the locale and style fields it fixes the problem. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.