Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- }
- }
Add Comment
Please, Sign In to add comment