Update: I've looked at the code that this point to...

int prevNr = prevNodeInLevel[level];    // TODO: remove potential ArrayIndexOutOfBoundsException
        if (prevNr > -1)
            doc.next[prevNr] = nodeNr;
        doc.next[nodeNr] = prevNodeInLevel[level - 1];
        prevNodeInLevel[level] = nodeNr;
        ++level;
        return nodeNr;

HA! Looks like I found that potential problem. How do I remove it?


Thanks,

Patrick

On Tue, Jun 28, 2011 at 5:33 PM, Patrick Bosek <patrick.bosek@jorsek.com> wrote:
Hi Everyone,

I'm getting an error when I try to return a document stored in my database through one of my java functions. I can access this document through eXist and the admin console with out a problem, but when I try to return it from my java module (as a NodeProxy) I end up with this error. Also if I simply System.out.print() the NodeProxy it returns me the right path and documentElement. Any suggestions?

I'm on 1.4.x


2011-06-28 17:28:22,548 [P1-8] ERROR (XQueryServlet.java [process]:438) - -1
java.lang.ArrayIndexOutOfBoundsException: -1
    at org.exist.memtree.MemTreeBuilder.startElement(MemTreeBuilder.java:146)
    at org.exist.memtree.DocumentBuilderReceiver.startElement(DocumentBuilderReceiver.java:139)
    at org.exist.memtree.DocumentImpl.copyStartNode(DocumentImpl.java:917)
    at org.exist.memtree.DocumentImpl.copyTo(DocumentImpl.java:883)
    at org.exist.memtree.DocumentImpl.copyTo(DocumentImpl.java:877)
    at org.exist.memtree.NodeImpl.copyTo(NodeImpl.java:689)
    at org.exist.xquery.EnclosedExpr.eval(EnclosedExpr.java:105)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
    at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
    at org.exist.xquery.ElementConstructor.eval(ElementConstructor.java:271)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
    at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:56)
    at org.exist.xquery.DebuggableExpression.eval(DebuggableExpression.java:63)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:208)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
    at org.exist.xquery.LetExpr.eval(LetExpr.java:206)
    at org.exist.xquery.BindingExpression.eval(BindingExpression.java:158)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
    at org.exist.xquery.PathExpr.eval(PathExpr.java:241)
    at org.exist.xquery.AbstractExpression.eval(AbstractExpression.java:61)
    at org.exist.xquery.XQuery.execute(XQuery.java:228)
    at org.exist.xquery.XQuery.execute(XQuery.java:183)
    at org.exist.xmldb.LocalXPathQueryService.execute(LocalXPathQueryService.java:185)
    at org.exist.http.servlets.XQueryServlet.process(XQueryServlet.java:414)
    at org.exist.http.servlets.XQueryServlet.doGet(XQueryServlet.java:171)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
    at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:473)
    at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:263)
    at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:171)
    at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:44)
    at org.exist.http.urlrewrite.XQueryURLRewrite.doRewrite(XQueryURLRewrite.java:432)
    at org.exist.http.urlrewrite.XQueryURLRewrite.doFilter(XQueryURLRewrite.java:303)
    at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
    at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
    at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
    at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
    at org.mortbay.http.HttpServer.service(HttpServer.java:909)
    at org.mortbay.http.HttpConnection.service(HttpConnection.java:820)
    at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986)
    at org.mortbay.http.HttpConnection.handle(HttpConnection.java:837)
    at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245)
    at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
    at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


Thanks!


--
Patrick Bosek
Jorsek Software
Cell (585) 820 9634
Office (585) 239 6060
Jorsek.com




--
Patrick Bosek
Jorsek Software
Cell (585) 820 9634
Office (585) 239 6060
Jorsek.com