You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Christian Haselbach <ch...@tngtech.com> on 2004/11/08 23:26:04 UTC

Problem with ImageSubmit

Hello,

sorry if this is the wrong mailing list for this.

There is a problem with the ImageSubmit. If the provided image is not
accessible (e.g., broken link) some browsers (e.g., mozilla) just
show the context of the alt-tag (if provided). Now, when you click
this link, mozilla will set the corresponding x and y paramters to
"", i.e., not null. This rises a number format exception. The
problem is probably in ImageSubmit.java:

if (pointBinding != null)
{
    int x = Integer.parseInt(value);

    parameterName = name + ".y";
    value = context.getParameter(parameterName);

    int y = Integer.parseInt(value);

    pointBinding.setObject(new Point(x, y));
}

Replacing this with

if (pointBinding != null)
{
    int x = "".equals(value) ? -1 : Integer.parseInt(value);

    parameterName = name + ".y";
    value = context.getParameter(parameterName);

    int y = "".equals(value) ? -1 : Integer.parseInt(value);

    pointBinding.setObject(new Point(x, y));
}

should solve the problem.

Should I file a bug? Has anyone an Idea for a workaround to work with
current version of tapestry?

The above solution has a drawback: it provides invalid coordinates.
However, giving (0,0) is not appropriate, too, because then the
application has no way to find out that something is wrong.

Ciao Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org