Opened 14 years ago

Closed 14 years ago

#776 closed enhancement (fixed)

ParameterType.validate should include parameter name in error messages

Reported by: Johan Enell Owned by: Nicklas Nordborg
Priority: trivial Milestone: BASE 2.4.3
Component: core Version: 2.4.1
Keywords: Cc:

Description

The exception message shown when you have entered wrong values in the plugin job parameters doesn't show enough information. It shows me an internal value name and it doesn't tell me the name of the parameter.

I guess that the exception comes from an enumeration parameter.

The stacktrace:

16:13:33,092 ERROR [jsp]:253 - Servlet.service() for servlet jsp threw exception
net.sf.basedb.core.InvalidDataException: The value 'auto_all_samples' isn't in the list of allowed values.
        at net.sf.basedb.core.ParameterType.validate(ParameterType.java:220)
        at net.sf.basedb.core.ParameterType.validate(ParameterType.java:252)
        at net.sf.basedb.core.Job.setParameterValuesInternal(Job.java:1132)
        at net.sf.basedb.core.ParameterValuesImpl.saveParameters(ParameterValuesImpl.java:209)
        at net.sf.basedb.core.PluginRequest.saveParameters(PluginRequest.java:253)
        at net.sf.basedb.core.PluginResponse.saveParameters(PluginResponse.java:144)
        at org.apache.jsp.common.plugin.index_jsp._jspService(index_jsp.java:529)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at net.sf.basedb.clients.web.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:72)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:199)
        at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:282)
        at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
        at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
        at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)

Change History (4)

comment:1 Changed 14 years ago by Nicklas Nordborg

Milestone: BASE 2.4.2BASE 2.5

comment:2 Changed 14 years ago by Nicklas Nordborg

Component: webcore
Priority: majortrivial
Summary: More info in exception messageParameterType.validate should include parameter name in error messages

It is the responsibility of the plug-in to validate the parameters and create a proper error message. In this case the plug-in has returned Response.setDone without actually validating that the value 'auto_all_samples' is a valid value for the parameter in question. What can be done better in the core is to give a clearer error message in this case:

The value 'auto_all_samples' isn't in the list of allowed values for parameter 'xxx'

where 'xxx' is replaced with the name of the parameter.

comment:3 Changed 14 years ago by Nicklas Nordborg

Milestone: BASE 2.5BASE 2.4.3

comment:4 Changed 14 years ago by Nicklas Nordborg

Resolution: fixed
Status: newclosed

(In [3779]) Fixes #776: ParameterType?.validate should include parameter name in error messages

Note: See TracTickets for help on using tickets.