[1.0.1] click() on Region/Location outside screen gives Null pointer exception --- should be more explanatory

Bug #1224863 reported by Dumas on 2013-09-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sikuli
Critical
RaiMan

Bug Description

fixed with 1.1.0
-----------------

1 - Version of SIKULI : X-1.0.1
2 - Operating system : Windows XP Pro SP3
3 - Procedure to reproduce the bug: The Null Pointer Exception was raised in this line of my code

      self.clickFunction_dict[action.lower()](reg)

where:
      self.clickFunction_dict = {"left" : click, "right" : rightClick, "double" : doubleClick}
      action = "left"
      reg is a region object created before.

This function has worked many thousands times before to crash yesterday.

4 - I recently passed to SIKULI X-1.0.1. I never encountered this problem with SIKULI X-1.0-rc3.

Dumas (pierreduma) wrote :

Hi,
Regarding the bug that i just posted, it seems to be reproducible.
I am looking for its origin and keep you informed.
Best regards,
Pierre Dumas

Dumas (pierreduma) wrote :

Hi,
I found the origin of the bug.
It occurs when region is created with X = width of the screen and/or Y = height of the screen
Examples:
r = Region(1600, 0, 0, 0)
click(r)

r = Region(0, 1200, 0, 0)
click(r)

r = Region(1600, 1200, 0, 0)
click(r)

But
r = Region(0, 0, 0, 0)
click(r)

works (despite of an error message that inform you that region is outside the screen)

Best regards,
Pierre Dumas

RaiMan (raimund-hocke) wrote :

Thanks for finding and evaluating:

The Region class is totally revised in this aspect and strictly according to the Java Rectangle rules.

... means the Region
Region(SCREEN.w, SCREEN.h, 1, 1)

is one pixel below and one pixel right to the bottom right corner of the primary screen and hence outside any screen if there is no screen at this coordinates.

A Region must have a width and height both > 0, otherwise it is undefined (the message though for a top left corner on a screen is misleading).
*** I will fix this the way, that I will produce a sensible error message and as a convenience set the attribute being 0 to 1.

What is inconvenient, that the click on a Region/Location outside any screen leads to a null pointer exception.
*** I will change this to an exception with a better message.

summary: - Null pointer exception raised at click function call
+ [1.0.1] click() on Region/Location outside screen gives Null pointer
+ exception --- should be more explanatory

Hi,
Thank you for your quick response.
Indeed, the problem happens when we try to click outside the screen.
At the moment, i just catch the exception and the problem is solved.
Best regards
Pierre Dumas

> Date: Fri, 13 Sep 2013 10:17:30 +0000
> From: <email address hidden>
> To: <email address hidden>
> Subject: [Bug 1224863] Re: Null pointer exception raised at click function call
>
> Thanks for finding and evaluating:
>
> The Region class is totally revised in this aspect and strictly
> according to the Java Rectangle rules.
>
> ... means the Region
> Region(SCREEN.w, SCREEN.h, 1, 1)
>
> is one pixel below and one pixel right to the bottom right corner of the
> primary screen and hence outside any screen if there is no screen at
> this coordinates.
>
> A Region must have a width and height both > 0, otherwise it is undefined (the message though for a top left corner on a screen is misleading).
> *** I will fix this the way, that I will produce a sensible error message and as a convenience set the attribute being 0 to 1.
>
> What is inconvenient, that the click on a Region/Location outside any screen leads to a null pointer exception.
> *** I will change this to an exception with a better message.
>
> ** Summary changed:
>
> - Null pointer exception raised at click function call
> + [1.0.1] click() on Region/Location outside screen gives Null pointer exception --- should be more explanatory
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1224863
>
> Title:
> [1.0.1] click() on Region/Location outside screen gives Null pointer
> exception --- should be more explanatory
>
> Status in Sikuli:
> New
>
> Bug description:
> 1 - Version of SIKULI : X-1.0.1
> 2 - Operating system : Windows XP Pro SP3
> 3 - Procedure to reproduce the bug: The Null Pointer Exception was raised in this line of my code
>
> self.clickFunction_dict[action.lower()](reg)
>
> where:
> self.clickFunction_dict = {"left" : click, "right" : rightClick, "double" : doubleClick}
> action = "left"
> reg is a region object created before.
>
> This function has worked many thousands times before to crash
> yesterday.
>
> 4 - I recently passed to SIKULI X-1.0.1. I never encountered this
> problem with SIKULI X-1.0-rc3.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/sikuli/+bug/1224863/+subscriptions

RaiMan (raimund-hocke) on 2013-09-23
Changed in sikuli:
status: New → Fix Committed
importance: Undecided → High
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.1.0
RaiMan (raimund-hocke) on 2014-09-17
Changed in sikuli:
importance: High → Critical
description: updated
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers