You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Don Brown <mr...@twdata.org> on 2006/11/17 12:08:33 UTC

[s2] More line-precise error information

With the multiple levels of configuration, constant overrides, and bean 
selection, it can be confusing as to how Struts is configured and how it 
got there.  To assist debugging and provide the ability to continue to 
provide more line-precise error reporting, I've changed the 
configuration loading to remember the location of not only XML elements, 
but also Java Properties file properties.

How it works is instead of storing configuration properties in a plain 
java.util.Properties object, we have a special LocatableProperties class 
in XWork.  This class leverages the location classes in XWork to store 
location information for the whole properties file but also individual 
properties.  We use this to gather configuration properties during 
configuration loading.  This will allow us to display at any given point 
the location of each property setting.  This capability should be very 
useful when trying to determine what XML or Properties file overwrote 
what and when.

Interestingly, in addition to remembering the URI and line number of 
Properties properties, the parser I "borrowed" from Commons 
Configuration even gathers preceding comments, which are also stored in 
the Location object.  This means we can leverage the Properties 
comment-based documentation that we have in the o.a.s.default.properties 
file or the user's struts.properties file to further provide useful 
information in error reports.

Anyways, I think there are some very interesting possibilities here to 
increase the transparency of the framework in error and debugging 
conditions.

Don

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org