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

Attachment: mve.java
Description: Binary data

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to