cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r679991 - /cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
Date Sat, 26 Jul 2008 13:47:19 GMT
Author: reinhard
Date: Sat Jul 26 06:47:18 2008
New Revision: 679991

URL: http://svn.apache.org/viewvc?rev=679991&view=rev
Log:
. throw a meaningful exception if a variable can't be found or is null

Modified:
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java?rev=679991&r1=679990&r2=679991&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
Sat Jul 26 06:47:18 2008
@@ -330,7 +330,12 @@
             final String variable = matcher.group(2);
             final String replacement = languageInterpreter.resolve(variable, this.objectModel);
 
-            result.replace(matcher.start(), matcher.end(), replacement);
+            if (replacement != null) {
+                result.replace(matcher.start(), matcher.end(), replacement);
+            } else {
+                throw new VariableNotFoundException("Variable {" + language + ":" + variable
+                        + "} not found or is null.");
+            }
             matcher.reset();
         }
 
@@ -363,4 +368,11 @@
     public void setObjectModel(ObjectModel objectModel) {
         this.objectModel = objectModel;
     }
+
+    public class VariableNotFoundException extends RuntimeException {
+
+        public VariableNotFoundException(String msg) {
+            super(msg);
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message