hello..
this is the situation.. i have a method in a class which is called from the main. i have no problem called the method from the main.. however the problem lies in the line that i will show below.. i'm pasting the whole method so that u have a complete understand of it..
CODE
public void retrieveData(){
System.out.println("test retrivedata method");
ResultSet rs= null;
ResultSets=new ArrayList<String[]>();
try{
rs=stmt.executeQuery("Select * from weightedwordlist"); //-->error appears at this line
}
catch(SQLException e){}
System.out.println("test execute query");
try{
while(rs.next()){
String[] row={
rs.getString("Word"),rs.getString("Weight")
};
ResultSets.add(row);
}
}
catch(Exception e){
System.out.println("Exception in AptmntTableModel");
}
System.out.println("Data from db" + ResultSets);
}
when testing the output, it displays the first line "test retrivedata method" but then the error appears.. as pasted below:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at CalculateWWLWeight.retrieveData(CalculateWWLWeight.java:63)
at SpamFilter.createSetComparison(SpamFilter.java:343)
at SpamFilter.jButtonFilterActionPerformed(SpamFilter.java:202)
at SpamFilter.access$100(SpamFilter.java:19)
at SpamFilter$2.actionPerformed(SpamFilter.java:95)
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:6038)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
at java.awt.Component.processEvent(Component.java:5803)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
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:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
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)
Pls can someone help me?? thank u