Boa tarde pessoal!
Estou com problemas no seguinte código
public static String removeStrings(String str){
StringBuffer tratado = new StringBuffer();
Pattern numericos = Pattern.compile("[0-9]", Pattern.CASE_INSENSITIVE);
Matcher resComparacao = numericos.matcher(str);
while (resComparacao.find()) {
tratado.append(resComparacao.group());
}
return tratado.toString();
}
e
private void txtValidadePropertyChange(java.beans.PropertyChangeEvent evt) {
txtValidade.getDocument().addDocumentListener(new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
txtValidade.setText(Uteis.removeStrings(txtValidade.getText()));
}
public void removeUpdate(DocumentEvent e) {
txtValidade.setText(Uteis.removeStrings(txtValidade.getText()));
}
public void insertUpdate(DocumentEvent e) {
txtValidade.setText(Uteis.removeStrings(txtValidade.getText()));
}
});
}
erro: java.lang.IllegalStateException: Attempt to mutate in notification
alguma dica??