[MarkLogic Dev General] NPE on isAutoCommit and getUpdate in 9.0-3

Dave Liepmann dave.liepmann at gmail.com
Mon Jan 15 06:54:49 PST 2018


Hi folks,

I'm getting a NullPointerException when trying to call isAutoCommit or
getUpdate on a fresh Session object under MarkLogic XCC version 9.0-3. The
NPE does _not_ occur if either setAutoCommit or setUpdate is called first.
Is this intentional behavior? All other getters for Session return without
error even if no value is set.

I've constructed a minimal viable example. See below or attached.


import java.net.URI;

import com.marklogic.xcc.ContentSource;
import com.marklogic.xcc.ContentSourceFactory;
import com.marklogic.xcc.Session;

public class mve {
    public static void main(String[] args) throws Exception {
        if (args.length != 1) {
            System.err.println("usage: xcc://user:password@host
:port/contentbase");
            return;
        }

        System.out.println("Running minimal viable example of MarkLogic
isAutoCommit/getUpdate bug...");

        URI uri = new URI(args[0]);
        ContentSource contentSource =
ContentSourceFactory.newContentSource(uri);
        Session updateSession = contentSource.newSession();

        // comment out the following two lines to cause a
NullPointerException to be thrown on getUpdate and isAutoCommit:
        updateSession.setAutoCommit(false);
        updateSession.setUpdate(Session.Update.TRUE);

        System.out.println("is AutoCommit?");
        System.out.println(updateSession.isAutoCommit()); // if lines 21
and 22 are both commented out, this will cause NPE

        System.out.println("getUpdate?");
        System.out.println(updateSession.getUpdate());  // if lines 21 and
22 are both commented out, this will cause NPE
    }
}



Best regards,
Dave Liepmann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20180115/78632b73/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mve.java
Type: application/octet-stream
Size: 1237 bytes
Desc: not available
Url : http://developer.marklogic.com/pipermail/general/attachments/20180115/78632b73/attachment.obj 


More information about the General mailing list