[izpack-devel] Patch for suppressing null pointer in RuleInputField

Marc Eppelmann marc.eppelmann at gmx.de
Thu Aug 31 20:56:06 CEST 2006


Hi Dennis, 

This Patch is currently not immediately applicable. Please can you send us 
patches in the unified patch format, which will be used (created and applied) 
by eclipse as seperate attachment?

Thn I will check it again.

Cheers
Marc

Am Mittwoch, 30. August 2006 10:27 schrieb Dennis Reil:
> Hi,
>
> When I use a rule input field in UserInputPanel, I always get a null
> pointer exception from caretUpdate() in RuleInputField. This is caused
> by an activeField set to null somewhere else. So just test if
> activeField equals null before calling any method on it.
>
> Below you'll find a patch for this problem.
>
> kind regards,
>      Dennis
>
>
>
>
> Index:
> /workspace/IzPack3-trunk/src/lib/com/izforge/izpack/panels/RuleInputField.j
>ava =================================================================== ---
> /workspace/IzPack3-trunk/src/lib/com/izforge/izpack/panels/RuleInputField.j
>ava	(revision 1554) +++
> /workspace/IzPack3-trunk/src/lib/com/izforge/izpack/panels/RuleInputField.j
>ava	(working copy)
>
> @@ -748,17 +748,20 @@
>     
> /*-------------------------------------------------------------------------
>-*/ public void caretUpdate(CaretEvent event)
>      {
> -        String text = activeField.getText();
> -        int fieldSize = activeField.getEditLength();
> -        int caretPosition = activeField.getCaretPosition();
> -        int selection = activeField.getSelectionEnd() -
> activeField.getSelectionStart();
> -
> -        if ((!inputFields.lastElement().equals(activeField)) && (!
> activeField.unlimitedEdit()))
> +        if (activeField != null)
>          {
> -            if ((text.length() == fieldSize) && (selection == 0) &&
> (caretPosition == fieldSize)
> -                    && !backstep)
> +            String text = activeField.getText();
> +            int fieldSize = activeField.getEditLength();
> +            int caretPosition = activeField.getCaretPosition();
> +            int selection = activeField.getSelectionEnd() -
> activeField.getSelectionStart();
> +
> +            if ((!inputFields.lastElement().equals(activeField)) && (!
> activeField.unlimitedEdit()))
>              {
> -                activeField.transferFocus();
> +                if ((text.length() == fieldSize) && (selection == 0)
> +                        && (caretPosition == fieldSize) && !backstep)
> +                {
> +                    activeField.transferFocus();
> +                }
>              }
>          }
>      }
>
>
>
> _______________________________________________
> izpack-devel mailing list
> izpack-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-devel



More information about the izpack-devel mailing list