Esse erro está aparecendo quando faço alguma ação com os botões do meu programa (Cadastrar e Logar). Não consigo identificar onde está o erro e consequentemente, onde posso mudar para que esse erro suma, deve ser na persistencia do dados que está equivocada ou sei lá. Se alguém poder me ajudar eu agradeceria muito, pois isso é um projeto do meu curso.
Trecho de parte do código da ação do botão de login:
private class OuvinteBotaoLogin implements ActionListener{
private JFrame tela;
public OuvinteBotaoLogin(JFrame tela) {
this.tela = tela;
}
public void actionPerformed(ActionEvent evento) {
String acessoEmail = email.getText();
String acessoSenha = new String(campoDeSenha.getPassword());
Persistencia p = new Persistencia();
Central c = p.recuperarDados("dados.xml");
if(acessoEmail.equals("") && acessoSenha.equals("")) {
JOptionPane.showMessageDialog(tela, "Dados Inválidos!", "Falha", JOptionPane.ERROR_MESSAGE);
}else {
if(acessoEmail.equals(c.getLocatario().getEmail()) && acessoSenha.equals(c.getLocatario().getSenha())) {
c.setUsuarioLogado(acessoEmail);
p.salvarDados(c, "dados.xml");
Locatario locatario = c.getLocatario();
new TelaHome(locatario).setLocationRelativeTo(tela);
dispose();
}else {
for (Locador locador : c.getLocadoresCadastrados()) {
if (acessoEmail.equals(locador.getEmail()) && acessoSenha.equals(locador.getSenha())) {
c.setUsuarioLogado(acessoEmail);
p.salvarDados(c, "dados.xml");
new TelaHome(locador).setLocationRelativeTo(tela);
dispose();
}
}
}
}
}
Exception in thread "AWT-EventQueue-0" com.thoughtworks.xstream.io.StreamException:
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:117)
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:84)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:1094)
at persistencia.Persistencia.recuperarDados(Persistencia.java:37)
at telas.TelaInicial$OuvinteBotaoLogin.actionPerformed(TelaInicial.java:177)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown
Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:
Byte inválido 2 da sequência UTF-8 do byte 3.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(Unknown Source)
atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentCo
ntentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
atcom.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocume
nt(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.thoughtworks.xstream.io.xml.DomDriver.createReader(DomDriver.java:108)
... 41 more