[
https://issues.apache.org/jira/browse/JSPWIKI-143?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12562736#action_12562736
]
Andrew Jaquith commented on JSPWIKI-143:
----------------------------------------
The quick fix is pretty easy: just make sure that we initialize the various
UserManager classes with a reference to WikiEngine, which would allow us to
retrieve the i18n manager and generate a proper message.
HOWEVER, that's not quite the end of the story. These errors, in particular,
are NOT internal errors, but errors that ought to be thrown back to the
end-user, and thus need to use the locale of the web user (as opposed to the
language of the JVM deployer or runtime). So, it would probably be better to
change the exception type to make it simply carry the message key and the name
of the user, rather than the error message itself. Web-tier JSPs and classes
with access to the user context should, instead, be responsible for creating a
locale-specific message.
I agree that we probably need to re-think this a bit. The general strategy you
suggest makes sense.
The sad thing is that we are going to have to do this in lots more places than
just here... It really suggests that we ought to add special constructors to
ALL custom JSPWiki Exception types so that they can accept message keys and
variable parameters. Yes, varargs would make this MUCH easier...
> Unlocalized messages in user management
> ---------------------------------------
>
> Key: JSPWIKI-143
> URL: https://issues.apache.org/jira/browse/JSPWIKI-143
> Project: JSPWiki
> Issue Type: Improvement
> Components: Localization
> Affects Versions: 2.6.0
> Reporter: Florian Holeczek
> Priority: Minor
>
> When trying to create a new user with an existing name, the page says: 'The
> login name 'flo' is already taken.'
> I guess it's an Exception from UserManager. It's the same problem with full
> name (a few lines down).
> Maybe there are the following mesages unlocalized, too:
> JDBCUserDatabase:
> throw new DuplicateUserException( "Cannot rename: the login name '" + newName
> + "' is already taken." );
> XMLUserDatabase:
> throw ( new DuplicateUserException( "Cannot rename: the login name '" +
> newName + "' is already taken." ) );
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.