Skip to content

Java Runtime exception thrown when installed API module has incorrect URI #947

@georgeajit

Description

@georgeajit

Version of MarkLogic Java Client API : develop
Version of MarkLogic Server : 9.0 nightly build
Java version : 1.8
OS and version : Windows
Input: service.json file

{
  "endpointDirectory" : "/ext/TestE2EIntegerParaReturnDouble/",
  "$javaClass" : "com.marklogic.client.functionaltest.TestE2EInegerParaReturnDouble"
}

Module file name : TestE2EIntegerParamReturnDouble.sjs
Function declaration file:

{
  "functionName" : "TestE2EItemPrice",
 "params" : [ {
    "name" : "itemId",
    "datatype" : "int",
    "multiple" : false,
    "nullable" : true
  } ],
  "return" : {
    "datatype" : "double",
    "multiple" : false,
    "nullable" : true
  }
}

Install the modules at an URI such as, /ext/TestE2EIntegerParamReturnDouble.sjs

Actual output: Java Rruntime exception is thrown when the API endpoint is invoked from a JUnit test.

java.lang.RuntimeException: Returned document as text/html; charset=utf-8 instead of text/plain
	at com.marklogic.client.impl.AbstractProxy.checkNull(AbstractProxy.java:1122)
	at com.marklogic.client.impl.AbstractProxy$SingleResponseImpl.setResponseBody(AbstractProxy.java:1303)
	at com.marklogic.client.impl.AbstractProxy$SingleResponseImpl.setResponse(AbstractProxy.java:1300)
	at com.marklogic.client.impl.AbstractProxy$OkHttpServicesPlus.receiveImpl(AbstractProxy.java:1058)
	at com.marklogic.client.impl.AbstractProxy$RequestDefinitionImpl.withDocumentResponse(AbstractProxy.java:1095)
	at com.marklogic.client.impl.AbstractProxy$DBFunctionRequest.responseSingle(AbstractProxy.java:746)
	at com.marklogic.client.functionaltest.TestE2EInegerParaReturnDouble.TestE2EItemPrice(TestE2EInegerParaReturnDouble.java:35)
	at com.marklogic.client.functionaltest.TestClientAPIE2EInegerParaReturnDouble.TestE2EItemPrice(TestClientAPIE2EInegerParaReturnDouble.java:167)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

Expected output: Endpoint to return a value. When there is an error, messages should be more user friendly.

Alternatives: None

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions