Skip to content

update status.yml ERR10016 to have only one parameter #314

Closed
@stevehu

Description

In the OrchestrationHandler.java we have combined method and path together as one argument for the error input.

            String methodPath = String.format("Method: %s, RequestPath: %s", exchange.getRequestMethod(), exchange.getRequestPath());
            setExchangeStatus(exchange, MISSING_HANDlER, methodPath);

However, the status.yml ERR10016 expects two parameters as the error is define as:

ERR10016:
  statusCode: 400
  code: ERR10016
  message: MISSING_HANDlER
  description: Could not find handler for the uri %s and method %s.

This causes the error description format exception and you can see it in the log. It is not a show stopper but a lot of users will be panic if they see this.

This is the error in the log.

java.util.MissingFormatArgumentException: Format specifier '%s'
	at java.util.Formatter.format(Formatter.java:2519)
	at java.util.Formatter.format(Formatter.java:2455)
	at java.lang.String.format(String.java:2940)
	at com.networknt.status.Status.<init>(Status.java:90)
	at com.networknt.handler.LightHttpHandler.setExchangeStatus(LightHttpHandler.java:21)
	at com.networknt.handler.OrchestrationHandler.handleRequest(OrchestrationHandler.java:18)
	at io.undertow.server.handlers.GracefulShutdownHandler.handleRequest(GracefulShutdownHandler.java:69)
	at io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)
	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
	at io.undertow.server.protocol.http2.Http2ReceiveListener.handleRequests(Http2ReceiveListener.java:215)
	at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:124)
	at io.undertow.server.protocol.http2.Http2ReceiveListener.handleEvent(Http2ReceiveListener.java:67)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:948)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:929)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener$1.run(AbstractFramedChannel.java:955)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:935)
	at io.undertow.server.protocol.framed.AbstractFramedChannel$FrameReadListener.handleEvent(AbstractFramedChannel.java:929)
	at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
	at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)
	at io.undertow.protocols.ssl.SslConduit$SslReadReadyHandler.readReady(SslConduit.java:1175)
	at io.undertow.protocols.ssl.SslConduit$1.run(SslConduit.java:168)
	at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:582)
	at org.xnio.nio.WorkerThread.run(WorkerThread.java:466)

The workaround is simple. You need to externalize the status.yml file from light-4j/status module. Most users have this file externalized already as they are using it to define their own error codes. Once you have the config file externalized, update the error ERR10016 to something like this.

ERR10016:
  statusCode: 400
  code: ERR10016
  message: MISSING_HANDlER
  description: Could not find handler for the endpoint %s.

For the next release, we are going to update the embedded status.yml with the description "Could not find the handler for the endpoint %s." for ERR10016.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions