benjamin84 / fest

Automatically exported from code.google.com/p/fest
0 stars 0 forks source link

NPE when calling deleteText() on filled textfield #123

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Call method deleteText() on a textfield that is not empty.

What is the expected output? What do you see instead?
The textfield should be emptied, but instead a NullPointerException occurs.

What version of the product are you using? On what operating system?
1.0a1 on Windows

Please provide any additional information below.
Here's the fest part of the stack trace:

java.lang.NullPointerException
at org.fest.swing.core.RobotFixture.enterText(RobotFixture.java:433)
at
org.fest.swing.driver.JTextComponentDriver.enterText(JTextComponentDriver.java:9
7)
at
org.fest.swing.driver.JTextComponentDriver.replaceText(JTextComponentDriver.java
:78)
at
org.fest.swing.driver.JTextComponentDriver.deleteText(JTextComponentDriver.java:
63)
at
org.fest.swing.fixture.JTextComponentFixture.deleteText(JTextComponentFixture.ja
va:155)

The exception occurs here:

  /** ${@inheritDoc} */
  public void enterText(String text) {
    for (char character : text.toCharArray())
      type(character);
  }

That is because the varaible is null in my case. I recommend the following fix:

  /** ${@inheritDoc} */
  public void enterText(String text) {
    if (text != null) {
      for (char character : text.toCharArray())
        type(character);
      }
  }

Regards, Manuel

Original issue reported on code.google.com by manuel.k...@gmail.com on 8 Apr 2008 at 6:45

GoogleCodeExporter commented 9 years ago
Thanks a lot Manuel!

We'll have this bug fixed for our next release :)

Best regards,
-Alex

Original comment by Alex.Rui...@gmail.com on 8 Apr 2008 at 3:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Fixed NullPointerException in method 'enterText' in org.fest.core.RobotFixture.

Original comment by Alex.Rui...@gmail.com on 11 Apr 2008 at 2:26

GoogleCodeExporter commented 9 years ago
Set the module as a label, instead of being part of the title.

Original comment by Alex.Rui...@gmail.com on 1 Dec 2008 at 1:55