Vojtech Szocs has posted comments on this change.

Change subject: userportal,webadmin:change Translator to interface
......................................................................


Patch Set 1:

(3 comments)

No score this time since this patch will most likely change due to changes in 
http://gerrit.ovirt.org/#/c/26048/

http://gerrit.ovirt.org/#/c/26596/1/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/EnumTranslator.java
File 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/EnumTranslator.java:

Line 40:         for (StackTraceElement stackTraceElement : new 
RuntimeException().getStackTrace()) {
Line 41:             stringBuilder.append(stackTraceElement.getMethodName());
Line 42:         }
Line 43: 
Line 44:         logger.info("trying to localize null, probable error\n"+ 
stringBuilder.toString());
You can simply do:

 logger.log(Level.INFO, "...", ex); // could be also Level.WARNING

Or just skip creating exception and log the message itself.
Line 45:     }
Line 46: 
Line 47:     private String notLocalizedKey(Enum<?> key) {
Line 48:         return notLocalizedKey(key, null);


Line 53:         if (e != null) {
Line 54:             logString += e.getLocalizedMessage();
Line 55:         }
Line 56: 
Line 57:         logger.info(logString);
You can simply do:

 logger.log(Level.INFO, "...", ex); // could be also Level.WARNING
Line 58:         return key.name();
Line 59:     }
Line 60: 
Line 61:     private String keyToTranslate(Enum<?> key) {


http://gerrit.ovirt.org/#/c/26596/1/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Translator.java
File 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/Translator.java:

Line 2: 
Line 3: 
Line 4: public interface Translator<T> {
Line 5: 
Line 6:     public String get(T key);
Hm, what about renaming this to "translate" method? (I think this would better 
communicate the intent of this method, but it's up to your consideration.)
Line 7: 
Line 8:     boolean containsKey(T key);


-- 
To view, visit http://gerrit.ovirt.org/26596
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib018c1faf0c2e1ebaa81217d5e3696d9c8de20cf
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Martin Mucha <[email protected]>
Gerrit-Reviewer: Alona Kaplan <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to