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

Dennis Reil Dennis.Reil at reddot.de
Fri Sep 1 08:18:04 CEST 2006


Ok, another try with the attached patch-file.

regards,
	Dennis

Am Donnerstag, den 31.08.2006, 20:56 +0200 schrieb Marc Eppelmann:
> 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
> _______________________________________________
> izpack-devel mailing list
> izpack-devel at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/izpack-devel
-- 
Grüße

        Dennis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RuleInputField.java.patch
Type: text/x-patch
Size: 2027 bytes
Desc: not available
Url : https://lists.berlios.de/pipermail/izpack-devel/attachments/20060901/b7da5dce/attachment.bin 


More information about the izpack-devel mailing list