Skip to content

Commit 8d5ac68

Browse files
committed
fix #151--support OTHER (not NULL) EvalResult.Type for responses with no X-Primitive header
1 parent 96827ac commit 8d5ac68

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/main/java/com/marklogic/client/impl/JerseyServices.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3642,7 +3642,7 @@ public EvalResult.Type getType() {
36423642
}
36433643
String xPrimitive = content.getHeader("X-Primitive");
36443644
if ( xPrimitive == null ) {
3645-
return EvalResult.Type.NULL;
3645+
return EvalResult.Type.OTHER;
36463646
} else if ( "string".equals(xPrimitive) || "untypedAtomic".equals(xPrimitive) ) {
36473647
return EvalResult.Type.STRING;
36483648
} else if ( "boolean".equals(xPrimitive) ) {
@@ -3691,6 +3691,8 @@ public EvalResult.Type getType() {
36913691
return EvalResult.Type.QNAME;
36923692
} else if ( "time".equals(xPrimitive) ) {
36933693
return EvalResult.Type.TIME;
3694+
} else if ( "null".equals(xPrimitive) ) {
3695+
return EvalResult.Type.NULL;
36943696
}
36953697
return EvalResult.Type.OTHER;
36963698
}

src/test/java/com/marklogic/client/test/EvalTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class EvalTest {
5757
@BeforeClass
5858
public static void beforeClass() {
5959
Common.connectEval();
60-
System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug");
60+
//System.setProperty("org.apache.commons.logging.simplelog.log.org.apache.http.wire", "debug");
6161
}
6262
@AfterClass
6363
public static void afterClass() {
@@ -326,6 +326,9 @@ private void runAndTest(ServerEvaluationCall call)
326326
result = results.next();
327327
assertEquals("myCtsQuery should be Type.OTHER", EvalResult.Type.OTHER, result.getType());
328328
assertEquals("myCtsQuery should be Format.TEXT", Format.TEXT, result.getFormat());
329+
result = results.next();
330+
assertEquals("myFunction should be Type.OTHER", EvalResult.Type.OTHER, result.getType());
331+
assertEquals("myFunction should be Format.TEXT", Format.TEXT, result.getFormat());
329332
} finally { results.close(); }
330333
}
331334

src/test/resources/evaltest.xqy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ let $myAttribute := $myElement/@*
3333
let $myComment := $myComment/comment()
3434
let $myProcessingInstruction := $myProcessingInstruction/processing-instruction()
3535
let $myCtsQuery := cts:word-query('a')
36+
let $myFunction := xdmp:functions()[2]
3637
return (
3738
$test:myString, $myArray, $myObject, $myAnyUri,
3839
$myBinary, $myBase64Binary, $myHexBinary, $myDuration, $myQName,
3940
$myDocument, $myAttribute, $myComment, $myElement, $myProcessingInstruction, $myText,
4041
$myBool, $myInteger, $myBigInteger, $myDecimal, $myDouble, $myFloat,
4142
$myGDay, $myGMonth, $myGMonthDay, $myGYear, $myGYearMonth, $myDate, $myDateTime, $myTime,
42-
$myNull, $myCtsQuery
43+
$myNull, $myCtsQuery, $myFunction
4344
)

0 commit comments

Comments
 (0)