Export command does not work when it is the first called command in the shell.
For example, if I launch a shell with nxshell.sh, If I run an "ls" command before, the export command, the export works fine.
If I launch a shell the same way, and I directly run my export command, i get a nullpointer and the export does not work :
java.lang.NullPointerException
at org.nuxeo.ecm.core.api.repository.RepositoryInstanceHandler.open(RepositoryInstanceHandler.java:116)
at org.nuxeo.ecm.core.api.repository.RepositoryInstanceHandler.getSession(RepositoryInstanceHandler.java:101)
at org.nuxeo.ecm.core.api.repository.RepositoryInstanceHandler.invoke(RepositoryInstanceHandler.java:168)
at $Proxy11.getRootDocument(Unknown Source)
at org.nuxeo.ecm.shell.CommandContext.getCurrentDocument(CommandContext.java:134)
at org.nuxeo.ecm.shell.commands.repository.ListCommand.run(ListCommand.java:41)
at org.nuxeo.ecm.shell.CommandLineService.runCommand(CommandLineService.java:335)
at org.nuxeo.ecm.shell.commands.InteractiveCommand.runCommand(InteractiveCommand.java:165)
at org.nuxeo.ecm.shell.commands.InteractiveCommand.processInput(InteractiveCommand.java:135)
at org.nuxeo.ecm.shell.commands.InteractiveCommand.run(InteractiveCommand.java:104)
at org.nuxeo.ecm.shell.CommandLineService.runCommand(CommandLineService.java:335)
at org.nuxeo.ecm.shell.Main.main(Main.java:100)
at org.nuxeo.ecm.shell.CommandLineService$1.run(CommandLineService.java:363)
at org.nuxeo.osgi.application.StandaloneApplication.main(StandaloneApplication.java:343)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.nuxeo.osgi.application.Main.main(Main.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.nuxeo.runtime.launcher.Main.main(Main.java:88)
This becomes critical when someone tries to run the export command in batch mode using .nxclient -console export (...) since the export is always the "first command to be run".
Seems to be coming from the way of opening a session in ExportCommand.java and ImportCommand :
// open a session
repository = client.openRepository();
Those two classes may rather extend AbstractCommand in the way ListCommand do it.