The API should really catch this situation. Basically, you are calling a function that requires an input but you are not providing one. In that case the API sets the input to "null", and the detailed operation is called. The detailed operation is not expecting a null input.
This is API piece that is not flagging the error properly: // Parse the input Configuration input; if (protocol.equals("json")) { if (argument.length() != 0) { input = new Configuration(); input.fromJSON(argument); } else input = null; } else { response.sendError(response.SC_BAD_REQUEST,"Unknown API protocol: "+protocol); return; } Since this is POST, it should assume that the input cannot be null, and if it is, it's a bad request. Karl On Mon, Oct 25, 2021 at 2:44 AM ritika jain <ritikajain5...@gmail.com> wrote: > Hi, > > I am getting Null pointer exceptions while creating a job programmatic > approach via PHP. > Can anybody suggest the reason for this?. > > <html> <head> <meta http-equiv="Content-Type" content="text/html; > charset=UTF-8"/> <title>Error 500 Server Error</title> </head> > <body><h2>HTTP ERROR 500</h2> <p>Problem accessing > /mcf-api-service/json/jobs. Reason: <pre> Server Error</pre></p><h3>Caused > by:</h3><pre>java.lang.NullPointerException at > org.apache.manifoldcf.agents.system.ManifoldCF.findConfigurationNode(ManifoldCF.java:208) > at > org.apache.manifoldcf.crawler.system.ManifoldCF.apiPostJob(ManifoldCF.java:3539) > at > org.apache.manifoldcf.crawler.system.ManifoldCF.executePostCommand(ManifoldCF.java:3585) > at > org.apache.manifoldcf.apiservlet.APIServlet.executePost(APIServlet.java:576) > at org.apache.manifoldcf.apiservlet.APIServlet.doPost(APIServlet.java:175) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at > javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at > org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769) at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) > at > org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125) > at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) > at > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) > at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) > at org.eclipse.jetty.server.Server.handle(Server.java:497) at > org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at > org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248) > at > org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539) > at java.lang.Thread.run(Thread.java:748) </pre> <hr><i><small>Powered by > Jetty://</small></i><hr/> </body> </html> > >