Bug 877697 - throws of new GoneException are not translated
Summary: throws of new GoneException are not translated
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 0.9
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Bryan Kearney
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel70
TreeView+ depends on / blocked
 
Reported: 2012-11-18 03:17 UTC by John Sefler
Modified: 2015-05-14 16:04 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-09-29 19:05:13 UTC
Embargoed:


Attachments (Terms of Use)

Description John Sefler 2012-11-18 03:17:48 UTC
Description of problem:
It does not appear to me that when candlepin throws a new GoneException, the exception string remains untranslated.


Version-Release number of selected component (if applicable):
[root@jsefler-f14-candlepin candlepin]# git log | head -1
commit 0680c7840e5afc146ef38a9f5da4a0a53768523d


How reproducible:


Steps to Reproduce:
From a client system:
[root@jsefler-6 ~]# LANG=ja_JP.UTF-8 subscription-manager remove --serial 5530561923293555342
Consumer e98c8e54-3ac7-4d86-b584-d224565fb422 has been deleted
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
EXPECTED THAT TO BE TRANSLATED.


Looking at the candlepin source code:
[root@jsefler-f14-candlepin candlepin]# pwd
/root/candlepin/src/main/java/org/candlepin
[root@jsefler-f14-candlepin candlepin]# grep -r "new GoneException" *
> auth/interceptor/SecurityInterceptor.java:                throw new GoneException("Consumer " + key + " has been deleted", key);
> resource/UserResource.java:            throw new GoneException("user " + username + " not found");
> resource/HypervisorResource.java:                    throw new GoneException("Hypervisor " + hostEntry.getKey() +
> resteasy/interceptor/ConsumerAuth.java:                throw new GoneException("Consumer " + consumerUuid +
[root@jsefler-f14-candlepin candlepin]# 

I think the GoneException msg arguments should be passed to i18n.tr(...)



Additional info (for mreid):
Referencing bug 874816, there appears to be a lot of "Consumer" references in the candlepin message strings that should be changed to "Unit"/"System" based on the context of the message.  For example:
> auth/interceptor/SecurityInterceptor.java:                throw new GoneException("Consumer " + key + " has been deleted", key);
>                                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>                                                                                  i18n.tr("Unit " + key + " has been deleted", key)

Comment 1 Matt Reid 2012-11-19 16:19:35 UTC
Absolutely correct, I've tried to detail the necessary updates over several string bzs against CP, such as https://bugzilla.redhat.com/show_bug.cgi?id=876764

Comment 2 Bryan Kearney 2012-11-27 02:33:40 UTC
https://github.com/candlepin/candlepin/pull/120

Comment 4 Bryan Kearney 2012-11-29 17:52:57 UTC
commit 89549da37fcc7888fc1c1c91b2a45efdde15d8a9
Author: Bryan Kearney <bkearney>
Date:   Mon Nov 26 21:32:29 2012 -0500

    877697: Localize the GoneException.

Comment 5 John Sefler 2013-04-11 21:04:57 UTC
Verifying Version...
[root@jsefler-f14-candlepin candlepin]# git show-ref | grep master
10bc5f9576fc9168c357db9e7877343a01a48155 refs/heads/master

[root@jsefler-f14-candlepin candlepin]# pwd
/root/candlepin
[root@jsefler-f14-candlepin candlepin]# grep -r "new GoneException" * -A1
src/main/java/org/candlepin/auth/interceptor/SecurityInterceptor.java:                throw new GoneException(i18n.tr("Consumer {0} has been deleted", key), key);
src/main/java/org/candlepin/auth/interceptor/SecurityInterceptor.java-            }
--
src/main/java/org/candlepin/resteasy/interceptor/ConsumerAuth.java:                throw new GoneException(
src/main/java/org/candlepin/resteasy/interceptor/ConsumerAuth.java-                    i18n.tr("Consumer {0} has been deleted", consumerUuid), consumerUuid);
--
src/main/java/org/candlepin/resource/UserResource.java:            throw new GoneException(i18n.tr("User {0} not found", username), username);
src/main/java/org/candlepin/resource/UserResource.java-        }
--
src/main/java/org/candlepin/resource/HypervisorResource.java:                    throw new GoneException(
src/main/java/org/candlepin/resource/HypervisorResource.java-                        i18n.tr("Hypervisor {0} has been deleted previously",
[root@jsefler-f14-candlepin candlepin]# 

VERIFIED: All of the instatiated GoneException now wrap their message in i18n.tr(...)



[root@jsefler-f14-candlepin candlepin]# grep "Consumer {0} has been deleted" po/keys.pot
msgid "Consumer {0} has been deleted"
[root@jsefler-f14-candlepin candlepin]# grep "User {0} not found" po/keys.pot
msgid "User {0} not found"
[root@jsefler-f14-candlepin candlepin]# grep "Hypervisor {0} has been deleted previously" po/keys.pot
msgid "Hypervisor {0} has been deleted previously"

VERIFIED that these GoneException messages have been extracted for translation.

Comment 6 Bryan Kearney 2014-09-29 19:05:13 UTC
These bugs were fixed during 7.0 but not moved to CLOSED. They have been delivered


Note You need to log in before you can comment on or make changes to this bug.