When the Exception is thrown, I get: 


                                                          
 java.lang.Thread.run                       Thread.java:  745
                            
 java.util.concurrent.ThreadPoolExecutor$Worker.run           
ThreadPoolExecutor.java:  615
                              
java.util.concurrent.ThreadPoolExecutor.runWorker           
ThreadPoolExecutor.java: 1145
      
 java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run 
 ScheduledThreadPoolExecutor.java:  293
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301 
 ScheduledThreadPoolExecutor.java:  178
                                    
java.util.concurrent.FutureTask.runAndReset                   
FutureTask.java:  304
                            
java.util.concurrent.Executors$RunnableAdapter.call                   
 Executors.java:  471
                                                                            
...                                        
                                            
excel-to-csv.start/convert-excel/fn                         start.clj:   64
                                              
excel-to-csv.file-converter/start                file_converter.clj:   30
                                          
 excel-to-csv.file-converter/start/fn                file_converter.clj:   
31
                                                      
 excel-to-csv.xls/convert                           xls.clj:   69
                              
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>                 
HSSFWorkbook.java:  303
                              
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>                 
HSSFWorkbook.java:  322
                        
 org.apache.poi.poifs.filesystem.POIFSFileSystem.<init>             
 POIFSFileSystem.java:  138
                                
org.apache.poi.poifs.storage.HeaderBlock.<init>                 
 HeaderBlock.java:  104
                                
org.apache.poi.poifs.storage.HeaderBlock.<init>                 
 HeaderBlock.java:  131
org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data 
appears to be in the Office 2007+ XML. You are calling the part of POI that 
deals with OLE2 Office Documents. You need to call a different part of POI 
to process this data (eg XSSF instead of HSSF)


Which is what I am expecting. But it seems like my try/catch does not catch 
this. How is that possible? 




On Friday, November 25, 2016 at 6:41:57 PM UTC-5, larry google groups wrote:
>
> I know some of you will tell me that I shouldn't use try/catch for control 
> flow. That is fine. I might redo this. But for now, I'd like to simply know 
> why this doesn't work. I have this function: 
>
> (defn start []
>   (let [filenames-as-seq-of-strings (.list (io/file 
> "/home/ec2-user/uploads/"))]
>     (doseq [f filenames-as-seq-of-strings]
>       (println "in file_converter.start, the file is " (str f))
>       (spit  (str "/home/ec2-user/converted_csv_files/" f ".csv") " ")
>       (let [input-file (java.io.File. (str "/home/ec2-user/uploads/" f))
>             
>             output-file (java.io.File. (str 
> "/home/ec2-user/converted_csv_files/" f ".csv"))]
>             (try 
>               (xls/convert input-file output-file)
>               (catch Exception e
>                 (println e)
>                 (xlsx/convert input-file output-file)))))))
>
> Given some Microsoft Excel files, I first try to parse them as xls files, 
> and if that doesn't work, then in the catch block I would like to try to 
> parse them xlsx files. 
>
> If I run this app in the terminal with "java -jar" I see the exception as 
> I expect. But this line never seems to get called:
>
>                 (xlsx/convert input-file output-file)
>
> This convert function starts with: 
>
> (defn convert
>   "Stealing code from 
> http://stackoverflow.com/questions/31873931/java-lang-outofmemoryerror-gc-overhead-limit-exceeded-when-loading-an-xlsx-file
> "
>   [^java.io.File input-file ^java.io.File output-file]
>    (println "at the start of xlsx")
>
> But I never see that println in the terminal. 
>
> Why not?
>
>
>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to