Bug 877697

Summary: throws of new GoneException are not translated
Product: [Community] Candlepin Reporter: John Sefler <jsefler>
Component: candlepinAssignee: Bryan Kearney <bkearney>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 0.9CC: bkearney, mreid
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-29 19:05:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 863175    

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