hey, I have this code that should save a java.util.Vector of custom serializable classes:
if(filename.equals("")){
javax.swing.JFileChooser fc = new javax.swing.JFileChooser();
if(fc.showSaveDialog(this) == javax.swing.JFileChooser.APPROVE_OPTION){
filename = fc.getSelectedFile().toString();
}
}
try{
java.io.FileOutputStream fos = new java.io.FileOutputStream(filename);
java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
java.io.ObjectOutputStream oos = new java.io.ObjectOutputStream(baos);
oos.writeObject((Object)tl.entities);
baos.writeTo(fos);
oos.close();
fos.close();
baos.close();
}catch(java.io.FileNotFoundException e){
javax.swing.JOptionPane.showMessageDialog(this, "FileNotFoundException: Could not save file: "+e.getCause()+" ("+e.getMessage()+")", "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
}catch(java.io.IOException e){
javax.swing.JOptionPane.showMessageDialog(this, "IOException: Could not save file: "+e.getCause()+" ("+e.getMessage()+")", "Error", javax.swing.JOptionPane.ERROR_MESSAGE);
}
But when saving, it shows one of the defined dialog errors saying: "IOException: Could not save file: null (com.sun.java.swing.plaf.windows.WindowsFileChooserUI)" and there's an NullPointerException in the command line at javax.swing.plaf.basic.BasicListUI.convertModelToRow(BasicListUI.java:1251)