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 <t...@asseco.dk> 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 :-)
>
> -- Thomas
>
>
>
> ------------------------------------------------------------------------------
> 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
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
--
Turtle, turtle, on the ground,
Pink and shiny, turn around.
------------------------------------------------------------------------------
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
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users