Skip to content

Commit 3cf641d

Browse files
authored
MLE-20182:mlcp import failing with XDMP-DOCSTARTTAGCHAR upon using aggregates as input_file_type option (#533)
1 parent 57da32c commit 3cf641d

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

src/main/java/com/marklogic/contentpump/AggregateXMLReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private void processStartElement() throws XMLStreamException {
304304
if (LOG.isTraceEnabled()) {
305305
LOG.trace(nsDeclPrefix + ":" + nsDeclUri);
306306
}
307-
if (DEFAULT_NS == nsDeclPrefix) {
307+
if (DEFAULT_NS == nsDeclPrefix || ("".equals(nsDeclPrefix))) {
308308
sb.append(" xmlns=\"" + nsDeclUri + "\"");
309309
} else {
310310
sb.append(" xmlns:" + nsDeclPrefix + "=\"" + nsDeclUri

src/test/java/com/marklogic/contentpump/TestImportAggregate.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,4 +601,28 @@ public void testImportMedlineAutoID() throws Exception {
601601
assertEquals("2", result.next().asString());
602602
Utils.closeSession();
603603
}
604+
605+
@Test
606+
public void testBug20182() throws Exception {
607+
String cmd = "IMPORT -host localhost -username admin -password"
608+
+ " admin -input_file_path " + Constants.TEST_PATH.toUri()
609+
+ "/agg/20182.xml"
610+
+ " -thread_count 1"
611+
+ " -input_file_type aggregates"
612+
+ " -port " + Constants.port + " -database " + Constants.testDb;
613+
String[] args = cmd.split(" ");
614+
assertFalse(args.length == 0);
615+
616+
Utils.clearDB(Utils.getTestDbXccUri(), Constants.testDb);
617+
618+
String[] expandedArgs = null;
619+
expandedArgs = OptionsFileUtil.expandArguments(args);
620+
ContentPump.runCommand(expandedArgs);
621+
622+
ResultSequence result = Utils.runQuery(
623+
Utils.getTestDbXccUri(), "fn:count(fn:collection())");
624+
assertTrue(result.hasNext());
625+
assertEquals("2", result.next().asString());
626+
Utils.closeSession();
627+
}
604628
}

src/test/resources/agg/20182.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<people>
2+
<person>
3+
<first xmlns="http://marklogic.com/examples">George</first>
4+
<last>Washington</last>
5+
</person>
6+
<person>
7+
<first xmlns="http://marklogic.com/examples">Betsy</first>
8+
<last>Ross</last>
9+
</person>
10+
</people>

0 commit comments

Comments
 (0)