Mike McNally <emmecinque@...> writes:

Hi Mike,

> 
> 
> The fix for the bug you mention applies to SimpleMessage.  The SimpleError
constructor always extends the parameter list by 2 to make room for the two
standard parameters always passed in for errors.

Thanks for your replies :-) This is as far as I got as well, but I was wondering
if SimpleError shouldn't avoid using MessageFormat as well if there are no
replacement parameters? Or, should it in fact _always_ use MessageFormat on
account of the standard parameters?

Thanks again!

-- Thomas

> 
> On Thu, Jan 24, 2013 at 10:19 AM, Mike McNally
<[email protected]> wrote:
> sorry I need more coffee I guess 
> On Thu, Jan 24, 2013 at 10:18 AM, Mike McNally
<[email protected]> wrote:That's not Stripes,
it's the basic Java message system.  Use two single quotes instead of just one
in order to include a single quote in your message text.
> 
> 
> On Thu, Jan 24, 2013 at 10:09 AM, Thomas Jespersen
<[email protected]> wrote:Hi,
> I recently ran into a problem with SimpleError, where it removed all single
> quotes from my message string, when given no arguments. I use SimpleError
> something like this:
> new SimpleError("Error: Element 'foo' not found", new Object[0])
> But the _actual_ message printed, is: "Error: Element foo not found"
> Reading into it I found a similar issue addressed in release
1.5.5:http://sourceforge.net/projects/stripes/files/stripes/Stripes%201.5.5/
> but we use 1.5.7, so it should be fine. I also
found:http://www.stripesframework.org/jira/browse/STS-789
> which addressed the problem of SimpleMessage using MessageFormat when there 
> were no replacement parameters. And SimpleError extends SimpleMessage, so why 
> didn't it work?
> Well, the SimpleError constructor widens the parameter list to make room for 
> two standard parameters (field name and field value), so the check in
> SimpleMessage#getMessage _always_ succeeds when using SimpleError (it checks
> that the number of replacement parameters is greater than zero), and thus my
> single quotes got removed.
> My immediate fix has been to replace all single quotes by two single quotes,
> which works for my purposes, but it feels hacky. And I have the idea that
> SimpleError should work similarly to SimpleMessage (since it extends it), so I
> thought I'd post my findings here. Is this something that needs to be fixed, 
> or am I doing something wrong?
> Suggestions, ideas and comments are welcome! Thanks 





------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to