Author: pwang
Date: 2011-03-24 15:03:12 -0700 (Thu, 24 Mar 2011)
New Revision: 24587

Modified:
   
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
Log:
Reset inputStream after preview

Modified: 
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
===================================================================
--- 
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
     2011-03-24 21:29:04 UTC (rev 24586)
+++ 
core3/table-import-impl/trunk/src/main/java/org/cytoscape/tableimport/internal/ui/ImportTablePanel.java
     2011-03-24 22:03:12 UTC (rev 24587)
@@ -2578,13 +2578,33 @@
                                e.printStackTrace();
                                throw new IllegalArgumentException("Could not 
read Excel file.  Maybe the file is broken?");
                        } finally {
-                               if (is != null)
+                               if (is != null) {
                                        is.close();
+                               }
+                               
                        }
                }
+               
+               boolean is_isClosed = false;
+               try {
+                       this.is.available();
+               }
+               catch (Exception e){
+                       is_isClosed = true;
+               }
+
+               // Mark the inputStream before preview
+               if (!is_isClosed){
+                       this.is.mark(Integer.MAX_VALUE);
+               }
+               
                previewPanel.setPreviewTable(workbook, this.is, this.fileType, 
sourceURL, delimiters, null, previewSize, commentChar,
-                                            startLine - 1);
-               
+                                                    startLine - 1);
+               // Reset the inputStream to the mark after preview
+               if (!is_isClosed){
+                               this.is.reset();
+               }
+
                if (previewPanel.getPreviewTable() == null)
                        return;
 

-- 
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en.

Reply via email to