Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Disabling verbose error messages

    One thing we would like to do in our application is disable verbose error messages (i.e. stack traces) in responses to the UI from the server. What is the recommended way of doing this?

    For example, using the showcase, if I send the following request, where I include invalid XML:

    Click image for larger version

Name:	capture.png
Views:	1269
Size:	144.8 KB
ID:	242078

    I get this response:
    Code:
    HTTP/1.1 200 OK
    Date: Thu, 22 Dec 2016 21:45:38 GMT
    Server: Apache-Coyote/1.1
    Content-Type: text/html; charset=UTF-8
    Content-Length: 4118
    Set-Cookie: JSESSIONID=026B0F75BB1E406168438CD0E7AFFB9E; Path=/showcase; HttpOnly
    Connection: close
    
    com.isomorphic.xml.XMLParsingException: [<BR>&nbsp;   "XML parser fatal error: file '(in memory stream)' line 1: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 245; The content of elements must consist of well-formed character data or markup."<BR>]<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.xml.XML.parseXML(XML.java:288)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.xml.XML.parseRestrictedXML(XML.java:148)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.xml.XML.toDSRecords(XML.java:431)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.xml.XML.toDSRecords(XML.java:427)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.rpc.RPCManager.parseRequest(RPCManager.java:2213)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.rpc.RPCManager.&lt;init&gt;(RPCManager.java:369)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.rpc.RPCManager.&lt;init&gt;(RPCManager.java:349)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:147)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.servlet.IDACall._processRequest(IDACall.java:119)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.servlet.IDACall.doPost(IDACall.java:79)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:162)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.servlet.CompressionFilter._doFilter(CompressionFilter.java:260)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at com.isomorphic.servlet.BaseFilter.doFilter(BaseFilter.java:88)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)<BR>&nbsp;&nbsp;&nbsp;&nbsp;at java.lang.Thread.run(Thread.java:745)<BR>

    #2
    To cover both "normal" DSRequest exceptions (like a failed database connection, for example) and more esoteric things like your use case, you would need to set two flags in your server.properties file:
    Code:
    servlet.sendStackTraceToClient: false
    exception.returns.stacktrace: false

    Comment


      #3
      Thank you for the information

      Comment

      Working...
      X