google-code-export / wiquery

Automatically exported from code.google.com/p/wiquery
MIT License
1 stars 1 forks source link

NumberFormatException with ResizableBehaviour #169

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. add ResizableBehaviour to an image
2. resize

What is the expected output? What do you see instead?
Image should be resized, but instead I am seeing an Exception.

What version of the product are you using? On what operating system?
1.2.3 on Ubuntu 10.10

Please provide any additional information below.
Tried with FF 3.6.16 and Chromium 10.0.648.133. Doesn't occur every time, 
sometimes the number obtained can be parsed to int, sometimes not.

Stacktrace:
java.lang.NumberFormatException: For input string: "317.7916666666667"
     at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
     at java.lang.Integer.parseInt(Integer.java:458)
     at java.lang.Integer.parseInt(Integer.java:499)
     at org.odlabs.wiquery.ui.resizable.ResizableAjaxBehavior.onResize(ResizableAjaxBehavior.java:188)
     at org.odlabs.wiquery.ui.resizable.ResizableAjaxBehavior.respond(ResizableAjaxBehavior.java:218)
     at org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:300)
     at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEvents(BehaviorRequestTarget.java:142)
     at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
     at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
     at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
     at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1436)
     at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
     at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
     at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
     ...

Original issue reported on code.google.com by radu.bar...@gmail.com on 30 Mar 2011 at 7:01

GoogleCodeExporter commented 9 years ago
This patch should fix the issue, please include in the next release. I would 
have also provided unit tests for it, but the wicket framework and its final 
methods make it close to impossible to send mock data.

Original comment by radu.bar...@gmail.com on 30 Mar 2011 at 7:51

Attachments:

GoogleCodeExporter commented 9 years ago
Many thanks !!

I will push this patch for the next release

Best regards

Julien Roche

Original comment by roche....@gmail.com on 31 Mar 2011 at 6:40

GoogleCodeExporter commented 9 years ago
Changes on the patch when we will use the wicket 1.5:

public final void onResize(AjaxRequestTarget target) {
        int height = this.getComponent().getRequest().getQueryParameters().getParameterValue(
                RESIZED_HEIGHT).toInt();
        int width = this.getComponent().getRequest().getQueryParameters().getParameterValue(
                RESIZED_WIDTH).toInt();
        onResize(height, width, target);
    }

Fix in r738

Original comment by roche....@gmail.com on 31 Mar 2011 at 8:53