Eclipse does not allow me to run my application since it launches the following:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Conexion.LlenadoCombo (Conexion.java:177)
public void LlenadoCombo(JComboBox CBEntradas){
rs=Consulta("select * from informativo");
try{
while(rs.next()){
CBEntradas.addItem(rs.getString("idInformativo")+": "+rs.getString("asunto"));
}
}catch(SQLException e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
The error is marked on line 4 while(rs.next()){
It is a method of filling items String
to JComboBox
from a SQL Server database, I have not had any error in the connection and I have a connection locally so I discard an error of that origin . I had previously compiled , the error came after adding a line of code in another event of the main class. However, this line of code does not use any of the variables of this method nor does it modify any important attribute of the main class.
Any solution or is it an Eclipse bug?