como gaço pra corrigir esse exception na minha consulta
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at sistemageral.Recibo.pesquisarRecibo(Recibo.java:338)
at sistemageral.Recibo.jBPesqActionPerformed(Recibo.java:313)
at sistemageral.Recibo.access$100(Recibo.java:21)
at sistemageral.Recibo$2.actionPerformed(Recibo.java:164)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
[quote=rodrigo.menezes]como gaço pra corrigir esse exception na minha consulta
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at sistemageral.Recibo.pesquisarRecibo(Recibo.java:338)
at sistemageral.Recibo.jBPesqActionPerformed(Recibo.java:313)
at sistemageral.Recibo.access$100(Recibo.java:21)
at sistemageral.Recibo$2.actionPerformed(Recibo.java:164)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6041)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3265)
at java.awt.Component.processEvent(Component.java:5806)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4413)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
at java.awt.Container.dispatchEventImpl(Container.java:2102)
at java.awt.Window.dispatchEventImpl(Window.java:2440)
at java.awt.Component.dispatchEvent(Component.java:4243)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
[/quote]
NullPointerException é atributo sem referencia, ou seja null.
posta seu codigo ai.
[quote=rodrigo.menezes][quote=kaique]Procure a classe Recibo.java, olhe o código da linha 33 e cole aqui. É nessa linha que está sendo propagado o erro.
[]'s.[/quote]linha 33 é comentario ja definido do netbeans[/quote]
Foi mal. Não prestei atenção a figura que apareceu na sua primeira mensagem. A linha correta onde o erro está sendo propagado é a linha 338.
Cola ela aqui pra gente ver o que pdoe estar acontecendo…
[quote=kaique][quote=rodrigo.menezes][quote=kaique]Procure a classe Recibo.java, olhe o código da linha 33 e cole aqui. É nessa linha que está sendo propagado o erro.
[]'s.[/quote]linha 33 é comentario ja definido do netbeans[/quote]
Foi mal. Não prestei atenção a figura que apareceu na sua primeira mensagem. A linha correta onde o erro está sendo propagado é a linha 338.
Cola ela aqui pra gente ver o que pdoe estar acontecendo…
[]'s.[/quote]// tai apartir da 336
sql ="select * from paciente Where codigo ='num'" ;
TesteConexao.setResultSet(sql);
if(TesteConexao.resultSet.next()){
//atualizarRecibo();
JOptionPane.showMessageDialog(null," encontrado");
//jtResp.requestFocus();
}
else{
JOptionPane.showMessageDialog(null,"Código não encontrado");
jtRegistro.requestFocus();
TesteConexao.setResultSet(usuario);
}
}
catch (SQLException erro){
JOptionPane.showMessageDialog(null,"Erro na Pesquisa");
}
catch(NullPointerException erro){
erro.printStackTrace();
JOptionPane.showMessageDialog(null,"Erro na Consulta");
}