I had a small app that was compelling, and then I added in a java class, 
and now when I run "lein uberjar" I get  java.lang.OutOfMemoryError.

I'm working on my MacBook Pro, 16 gigs of memory

Dependencies were: 


  :dependencies [
                 [org.clojure/clojure "1.7.0"]
                 [com.taoensso/timbre "4.3.1"]
                 [dire "0.5.4"]
                 [slingshot "0.12.2"]
                 [clj-time "0.6.0"]
                 [org.clojure/test.check "0.9.0"]
                 [me.raynes/fs "1.4.4"]
                 [clj-stacktrace "0.2.7"]                 
                 [sax/sax "2.0.1"]
                 [xml-apis/xml-apis "2.0.2"]
                 [javax.xml.stream/stax-api "1.0-2"]
                 [overtone/at-at "1.2.0"]
                 [org.clojure/data.xml "0.1.0-beta1"]

                 [org.apache.poi/poi "3.9"]               
                 [org.apache.poi/poi-ooxml "3.9"]
                 ]

And the above compiled, but then I added: 

                 [org.eclipse.birt.runtime/org.eclipse.birt.runtime "4.2.2"]

And that was about when things fell apart. 

In my project.clj I also have: 

  :source-paths      ["src/clojure"]
  :java-source-paths ["src/java"]

And I have added one Java file to src/java:

package com.heddy.excel_to_csv;


import java.io.InputStream;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.xssf.eventusermodel.XLSX2CSV;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.helpers.XMLReaderFactory;


public class SheetHandler extends DefaultHandler {
    private SharedStringsTable sst;
    private String lastContents;
    private boolean nextIsString;
    private SheetHandler(SharedStringsTable sst) {
        this.sst = sst;
    }
    public void startElement(String uri, String localName, String name,
                             Attributes attributes) throws SAXException {
        // c => cell
        if(name.equals("c")) {
            // Print the cell reference
            System.out.print(attributes.getValue("r") + " - ");
            // Figure out if the value is an index in the SST
            String cellType = attributes.getValue("t");
            if(cellType != null && cellType.equals("s")) {
                nextIsString = true;
            } else {
                nextIsString = false;
            }
        }
        // Clear contents cache
        lastContents = "";
    }
    public void endElement(String uri, String localName, String name)
        throws SAXException {
        // Process the last contents as required.
        // Do now, as characters() may be called more than once
        if(nextIsString) {
            int idx = Integer.parseInt(lastContents);
            lastContents = new 
XSSFRichTextString(sst.getEntryAt(idx)).toString();
            nextIsString = false;
        }

        // v => contents of a cell
        // Output after we've seen the string contents
        if(name.equals("v")) {
            System.out.println(lastContents);
        }
    }

    public void characters(char[] ch, int start, int length)
        throws SAXException {
        lastContents += new String(ch, start, length);
    }
}

I have never used a Java file like this before, so I wasn't sure how to 
proceed. I invented the "package" name, which could be all wrong. 

I've stolen the Java code from here: 

https://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java

Any thoughts why I would get an OutOfMemory?






-- 
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