[Yanel-commits] rev 23674 - public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/translatable

josias at wyona.com josias at wyona.com
Wed Apr 11 23:03:09 CEST 2007


Author: josias
Date: 2007-04-11 23:03:07 +0200 (Wed, 11 Apr 2007)
New Revision: 23674

Modified:
   public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/translatable/DefaultTranslationManager.java
Log:
changed handling of the case when no translation file exists: use exists check instead of catching the exception, because some repo implementations don't seem to throw the right exception

Modified: public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/translatable/DefaultTranslationManager.java
===================================================================
--- public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/translatable/DefaultTranslationManager.java	2007-04-11 20:49:54 UTC (rev 23673)
+++ public/yanel/trunk/src/core/java/org/wyona/yanel/core/attributes/translatable/DefaultTranslationManager.java	2007-04-11 21:03:07 UTC (rev 23674)
@@ -59,10 +59,13 @@
         try {
             this.pages = new HashSet();
             this.languageVersions = new HashMap();
-            this.node = realm.getRepository().getNode("/translations.xml");
-            load();
-        } catch (NoSuchNodeException e) {
-            log.info("Realm " + realm.getID() + " contains no translations.xml");
+            String translationsPath = "/translations.xml";
+            if (realm.getRepository().existsNode(translationsPath)) {
+                this.node = realm.getRepository().getNode(translationsPath);
+                load();
+            } else {
+                log.info("Realm " + realm.getID() + " contains no translations.xml");
+            }
         } catch (Exception e) {
             throw new TranslationException(e.getMessage(), e);
         }




More information about the Yanel-commits mailing list