Menu

#5 JLabelFinder::setText, setCaseIndependent don't work

open-fixed
nobody
None
7
2007-12-13
2007-12-07
A.Safonov
No

Hi, just've found it:
JLabelFinder has two wrong methods:

/**
* Set the finder into a case independent mode.
* @param ignoreCase true if case should be ignored.
*/
public void setCaseIndependent(final boolean ignoreCase) {
super.setCaseIndependent(ignoreCase);
m_caseIndependent = ignoreCase;
createPatternMatcher(m_text, m_caseIndependent);
}

/**
* Set the label text to be matched.
* @param text Text to be matched.
*/
public final void setText(final String text) {
m_text = text;
createPatternMatcher(m_text, m_caseIndependent);
}

Everywhere should be NOT createPatternMatcher but recreatePatternMatcher
Because createPatternMatcher has a check for m_patternMatcher == null - that's why after constuctor calicn call of setText and setCaseIndependent are useless.

Discussion

  • A.Safonov

    A.Safonov - 2007-12-07
    • priority: 5 --> 7
     
  • A.Safonov

    A.Safonov - 2007-12-07

    Logged In: YES
    user_id=1778112
    Originator: YES

    Same problem with LabeledComponentFinder

     
  • A.Safonov

    A.Safonov - 2007-12-07

    Logged In: YES
    user_id=1778112
    Originator: YES

    Ooops, one more thing:
    public LabeledComponentFinder(final String text,
    final boolean caseIndependent) {
    setText(text); <==========
    m_caseIndependent = caseIndependent;
    super.createPatternMatcher(text, caseIndependent);
    }
    SHOULD BE:
    public LabeledComponentFinder(final String text,
    final boolean caseIndependent) {
    m_text = text;
    m_caseIndependent = caseIndependent;
    super.createPatternMatcher(text, caseIndependent);
    }

     
  • A.Safonov

    A.Safonov - 2007-12-10

    Logged In: YES
    user_id=1778112
    Originator: YES

    Ooops, one more thing:
    public LabeledComponentFinder(final String text,
    final boolean caseIndependent) {
    setText(text); <==========
    m_caseIndependent = caseIndependent;
    super.createPatternMatcher(text, caseIndependent);
    }
    SHOULD BE:
    public LabeledComponentFinder(final String text,
    final boolean caseIndependent) {
    m_text = text;
    m_caseIndependent = caseIndependent;
    super.createPatternMatcher(text, caseIndependent);
    }

     
  • Pavel Krupets

    Pavel Krupets - 2007-12-13
    • status: open --> open-fixed
     

Log in to post a comment.