error writing an bigger size object to file

label Programming
account_circle Unassigned
schedule 3 Days
account_balance_wallet $5

Hello all, i m getting error while writing object to a file. for smaller size object no error it works fine but larger size object it writes but later getting error. can anybody help in this regard?


private void mistreeActionPerformed(java.awt.event.ActionEvent evt) {   
// TODO add your handling code here:
//int ret = jc.showOpenDialog(this);
  //  if(ret == JFileChooser.APPROVE_OPTION)
  //  {
  try
  {
  File f = jc.getSelectedFile();
  if(f != null){
  String fname = f.getAbsolutePath();
  datasetfile.setText(fname);   
  String database = fname;
  // tree = new MISTree();
  //if(fname != null)
  misTreeConstruction(database, output, Misout,MISfile);
  }
  else
  JOptionPane.showMessageDialog(null, "Plz select a file first");
     //tree.backtotrans();
  //printStats();
   
  }catch(Exception ex) {
  JOptionPane.showMessageDialog(null, "Error in input file Plz select trasanction file");
  // ex.printStackTrace();
  return;
  }
  // }
   
}  


public void misTreeConstruction(String input, String output, String Misout,String MISIn)
       throws FileNotFoundException, IOException {
     // record start time
     startTimestamp = System.currentTimeMillis();
     
     transactionCount = 0;
     // (1) PREPROCESSING: Perform an initial database scan to determine the
     // MIS of each item
     
     // This map is used to count the support of each item
     // Key: item  Value: support
mapSupport = new HashMap<Integer, Integer>();
mapSup = new HashMap<Integer, Integer>();
     // az---initializing MISs--------------
  //  writer1 = new BufferedWriter(new FileWriter(MISIn));
  calcMIS(input,Misout);
  initMISfromFile(MISIn);

     // reset the number of frequent itemsets to 0
     itemsetCount = 0;
     
     // create the object for writing the output file
     writer = new BufferedWriter(new FileWriter(output));

     // (2) Scan the database to build the initial FP-Tree
     // Before inserting a transaction in the FPTree, we sort the items
     // by decreasing order of MIS.
   tree = new MISTree();

     BufferedReader reader = new BufferedReader(new FileReader(input));
     String line;
     // read the transaction database line (transaction) by line
     // until the end of file
     while (((line = reader.readLine()) != null)) {
       // split the current transaction into items (they are separated by spaces)
       String[] lineSplited = line.split(" ");
       List<Integer> transaction = new ArrayList<Integer>();
       
       // for each item in the transaction
       for (String itemString : lineSplited) {
         // convert item to integer
         Integer item = Integer.parseInt(itemString);
         
         // increase the support of the item by 1
         Integer count = mapSupport.get(item);
         if (count == null) {
           mapSupport.put(item, 1);
  mapSup.put(item, 1);
         } else {
           mapSupport.put(item, ++count);
  mapSup.put(item, count);
         }
         // all items are added to transactions
         transaction.add(item);
       }
       transactionCount++; // increase the number of transactions
       
       // sort item in the transaction by non increasing order of MIS
       Collections.sort(transaction, this.itemComparator);
       
       // add the sorted transaction to the MISTree.
       tree.addTransaction(transaction);
       
     }// while
     reader.close();  // close the input file
     //writetologinred("Displaying tree");
   
  txt_area.setText("Displaying tree"+"\n");
   
     tree.print(tree.root, txt_area);

     // We create the header table for the tree
     tree.createHeaderList(this.itemComparator);
   
   
   
   
  //here
   
   
   
  try{
  JOptionPane.showMessageDialog(null,"in try");
     FileOutputStream fout = new FileOutputStream("d://obj.ser");
  JOptionPane.showMessageDialog(null,"obj created");
     ObjectOutputStream foos = new ObjectOutputStream(fout);  
  JOptionPane.showMessageDialog(null,"oos created");  ///til here i get output later getting error
     foos.writeObject(tree);
  JOptionPane.showMessageDialog(null,"here compltes writeobj");
  foos.flush();
  JOptionPane.showMessageDialog(null,"after flush");
     //foos.close();
  fout.close();
  JOptionPane.showMessageDialog(null,"alll");
     System.out.println("Done");
 
    }catch(Exception ex){
      JOptionPane.showMessageDialog(null,"error");
    }
   
   
   
  //here
   
   
   
  //frqpat.setEnabled(true);
  }

error is like this

Exception in thread "AWT-EventQueue-0" java.lang.StackOverflowError

  at java.lang.Exception.<init>(Unknown Source)

  at java.lang.reflect.InvocationTargetException.<init>(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.defaultWriteFields(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)

  at java.io.ObjectOutputStream.writeObject(Unknown Source)

  at java.util.ArrayList.writeObject(Unknown Source)

  at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)

  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

  at java.lang.reflect.Method.invoke(Unknown Source)

  at java.io.ObjectStreamClass.invokeWriteObject(Unknown Source)

  at java.io.ObjectOutputStream.writeSerialData(Unknown Source)

  at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)

  at java.io.ObjectOutputStream.writeObject0(Unknown Source)


Oct 22nd, 2017
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366542(v=vs.85).aspx

http://www.aspupload.com/manual_simple.html
Jul 4th, 2013

Studypool's Notebank makes it easy to buy and sell old notes, study guides, reviews, etc.
Click to visit
The Notebank
...
Oct 22nd, 2017
...
Oct 22nd, 2017
Oct 23rd, 2017
check_circle
Mark as Final Answer
check_circle
Unmark as Final Answer
check_circle
Final Answer

Secure Information

Content will be erased after question is completed.

check_circle
Final Answer